/* ============================================================================
   BlockGraf UI — shared design system
   Use these tokens and .bgf-* classes for any new modal or common UI so the app
   stays consistent. See DESIGN.md for the rules.

   Theme: dark surfaces, gray delimiters, single accent #0072e6, Inter font.
   No emojis in the UI — use Font Awesome icons instead.
   ============================================================================ */

:root {
  /* Accent (the app's characteristic blue) */
  --bgf-accent: #0072e6;
  --bgf-accent-hover: #1a83ef;
  --bgf-accent-press: #005bb8;
  --bgf-accent-soft: rgba(0, 114, 230, 0.12);

  /* BlockWorld identity (the yellow of profile blockworld cards) */
  --bgf-world-accent: #f1c40f;

  /* Dark surfaces — near-black modals (matches the Edit Button essence) */
  --bgf-bg: #050506;          /* deepest: insets / panels */
  --bgf-surface: #0e0e10;     /* modal surface (reads black) */
  --bgf-surface-2: #1c1c1f;   /* elevated: inputs, chips, hover, bubbles */

  /* Gray delimiters */
  --bgf-border: #33373d;
  --bgf-border-strong: #454a52;

  /* Text */
  --bgf-text: #e7e9ec;
  --bgf-text-muted: #9aa1aa;
  --bgf-text-dim: #6b727b;

  /* Shape & type */
  --bgf-radius: 12px;
  --bgf-radius-sm: 8px;
  --bgf-shadow: 0 20px 60px rgba(0, 0, 0, 0.55);
  --bgf-font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

/* ---- Modal overlay + dialog -------------------------------------------- */
.bgf-modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.66);
  z-index: 10000;
  font-family: var(--bgf-font);
}
.bgf-modal.is-open {
  display: flex;
}

.bgf-modal__dialog {
  display: flex;
  flex-direction: column;
  width: 92%;
  max-width: 720px;
  max-height: 88vh;
  overflow: hidden;
  background: var(--bgf-surface);
  border: 1px solid var(--bgf-border);
  border-radius: var(--bgf-radius);
  box-shadow: var(--bgf-shadow);
  color: var(--bgf-text);
}

.bgf-modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--bgf-border);
}
.bgf-modal__title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--bgf-text);
  display: flex;
  align-items: center;
  gap: 10px;
}
.bgf-modal__title i {
  color: var(--bgf-accent);
  font-size: 1rem;
}
.bgf-modal__close {
  padding: 6px 8px;
  background: none;
  border: none;
  color: var(--bgf-text-muted);
  font-size: 1.05rem;
  line-height: 1;
  cursor: pointer;
  border-radius: 6px;
  transition: background 0.15s, color 0.15s;
}
.bgf-modal__close:hover {
  color: var(--bgf-text);
  background: var(--bgf-surface-2);
}

.bgf-modal__body {
  padding: 20px;
  overflow-y: auto;
  font-size: 0.95rem;
  line-height: 1.7;
  color: var(--bgf-text);
}
.bgf-modal__footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap; /* never let buttons overflow narrow dialogs */
  gap: 10px;
  padding: 14px 20px;
  border-top: 1px solid var(--bgf-border);
}

/* ---- Buttons ----------------------------------------------------------- */
.bgf-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 18px;
  font-family: var(--bgf-font);
  font-size: 0.9rem;
  font-weight: 500;
  border: 1px solid transparent;
  border-radius: var(--bgf-radius-sm);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.bgf-btn--primary {
  background: var(--bgf-accent);
  color: #fff;
}
.bgf-btn--primary:hover {
  background: var(--bgf-accent-hover);
}
.bgf-btn--primary:active {
  background: var(--bgf-accent-press);
}
.bgf-btn--secondary {
  background: transparent;
  color: var(--bgf-text-muted);
  border-color: var(--bgf-border-strong);
}
.bgf-btn--danger {
  background: #b30000;
  color: #fff;
}
.bgf-btn--danger:hover {
  background: #cc0000;
}
.bgf-btn--secondary:hover {
  color: var(--bgf-text);
  border-color: var(--bgf-text-muted);
}
.bgf-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ---- Segmented toggle (e.g. language selector) ------------------------- */
.bgf-toggle {
  display: inline-flex;
  gap: 8px;
}
.bgf-toggle__btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  font-family: var(--bgf-font);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--bgf-text-muted);
  background: transparent;
  border: 1px solid var(--bgf-border);
  border-radius: var(--bgf-radius-sm);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.bgf-toggle__btn:hover {
  color: var(--bgf-text);
  border-color: var(--bgf-accent);
}
.bgf-toggle__btn.is-active {
  color: #fff;
  background: var(--bgf-accent);
  border-color: var(--bgf-accent);
}

/* ---- Inset panel (content surface inside a modal) ---------------------- */
/* Keep borders even/gray on all sides — no accent "stripe" on one edge. */
.bgf-panel {
  padding: 16px 18px;
  background: var(--bgf-bg);
  border: 1px solid var(--bgf-border);
  border-radius: var(--bgf-radius-sm);
}

/* ---- Text input -------------------------------------------------------- */
.bgf-input {
  width: 100%;
  box-sizing: border-box; /* keep padding inside the modal body width */
  padding: 11px 14px;
  font-family: var(--bgf-font);
  font-size: 0.95rem;
  color: var(--bgf-text);
  background: var(--bgf-surface-2);
  border: 1px solid var(--bgf-border);
  border-radius: var(--bgf-radius-sm);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.bgf-input:focus {
  border-color: var(--bgf-accent);
  box-shadow: 0 0 0 3px var(--bgf-accent-soft);
}

/* ---- Bootstrap modal skin ---------------------------------------------
   For template modals that use Bootstrap's markup/JS: add the class
   "bgf-bs-modal" to the .modal to give it the BlockGraf look without changing
   the markup or the Bootstrap show/hide behavior. */
.bgf-bs-modal .modal-content {
  background: var(--bgf-surface);
  border: 1px solid var(--bgf-border);
  border-radius: var(--bgf-radius);
  color: var(--bgf-text);
  font-family: var(--bgf-font);
}
.bgf-bs-modal .modal-header,
.bgf-bs-modal .modal-footer {
  border-color: var(--bgf-border);
}
.bgf-bs-modal .modal-title {
  color: var(--bgf-text);
  font-weight: 600;
}
.bgf-bs-modal .btn-close {
  filter: invert(1) grayscale(1) brightness(1.4);
  opacity: 0.7;
}
.bgf-bs-modal .btn-close:hover {
  opacity: 1;
}
.bgf-bs-modal .col-form-label,
.bgf-bs-modal label {
  color: var(--bgf-text-muted);
  font-size: 0.85rem;
  font-weight: 500;
}
.bgf-bs-modal .form-control {
  background: var(--bgf-surface-2);
  border: 1px solid var(--bgf-border);
  border-radius: var(--bgf-radius-sm);
  color: var(--bgf-text);
}
.bgf-bs-modal .form-control:focus {
  background: var(--bgf-surface-2);
  border-color: var(--bgf-accent);
  box-shadow: 0 0 0 3px var(--bgf-accent-soft);
  color: var(--bgf-text);
}
.bgf-bs-modal .form-control::placeholder {
  color: var(--bgf-text-dim);
}
.bgf-bs-modal .btn-primary {
  background: var(--bgf-accent);
  border-color: var(--bgf-accent);
}
.bgf-bs-modal .btn-primary:hover {
  background: var(--bgf-accent-hover);
  border-color: var(--bgf-accent-hover);
}
.bgf-bs-modal .btn-secondary {
  background: transparent;
  color: var(--bgf-text-muted);
  border-color: var(--bgf-border-strong);
}
.bgf-bs-modal .btn-secondary:hover {
  background: var(--bgf-surface-2);
  color: var(--bgf-text);
  border-color: var(--bgf-text-muted);
}

/* ---- Small caption (e.g. timing) --------------------------------------- */
.bgf-caption {
  font-size: 0.8rem;
  color: var(--bgf-text-muted);
  font-variant-numeric: tabular-nums;
}
.bgf-caption:empty {
  display: none;
}
