/* ═══════════════════════════════════════════════════════════
   design.css — Shared design tokens + base components
   Linked in <head> before any page-specific stylesheet.
   Font: Inter (Google Fonts, weights 400/500/600/700/800)
══════════════════════════════════════════════════════════ */

/* ── Dark theme (default) ─────────────────────────────────── */
:root {
  color-scheme: dark;

  /* Backgrounds */
  --bg:            #08080f;
  --surface:       #0f0f1c;
  --surface-2:     #161626;
  --surface-hover: #1e1e34;

  /* Text */
  --text:   #eeeef8;
  --text-2: #8080a8;
  --text-3: #46466a;

  /* Borders */
  --border:        rgba(255, 255, 255, 0.07);
  --border-strong: rgba(255, 255, 255, 0.13);

  /* Accent — vivid cobalt blue */
  --accent:        #4f8cff;
  --accent-hover:  #6fa0ff;
  --accent-glow:   rgba(79, 140, 255, 0.22);
  --accent-subtle: rgba(79, 140, 255, 0.10);

  /* Semantic */
  --ok:             #34d399;
  --ok-subtle:      rgba(52, 211, 153, 0.10);
  --danger:         #fb7185;
  --danger-subtle:  rgba(251, 113, 133, 0.10);
  --danger-hover:   #f84f68;
  --warning:        #fbbf24;
  --warning-subtle: rgba(251, 191, 36, 0.10);

  /* Shadows */
  --shadow:    0 1px 4px rgba(0,0,0,0.45), 0 1px 2px rgba(0,0,0,0.30);
  --shadow-md: 0 4px 20px rgba(0,0,0,0.55), 0 2px 8px rgba(0,0,0,0.30);
  --shadow-lg: 0 24px 64px rgba(0,0,0,0.70), 0 8px 24px rgba(0,0,0,0.40);
}

/* ── Light theme ──────────────────────────────────────────── */
@media (prefers-color-scheme: light) {
  :root {
    color-scheme: light;

    /* ── Named palette ──────────────────────────────── */
    --pearl:  #ffffff;               /* Main    — pure white         */
    --ink:    #18181b;               /* Contrast— near black         */
    --cobalt: #2563eb;               /* Accent  — vivid blue         */
    --mist:   #f0f0f6;               /* Surface — cool light grey    */
    --sky:    #dbeafe;               /* Accent tint — soft sky blue  */

    --bg:            var(--pearl);
    --surface:       var(--pearl);
    --surface-2:     var(--mist);
    --surface-hover: #e4e4ed;

    --text:   var(--ink);
    --text-2: #52525b;
    --text-3: #a1a1aa;

    --border:        rgba(0, 0, 0, 0.08);
    --border-strong: rgba(0, 0, 0, 0.16);

    --accent:        var(--cobalt);
    --accent-hover:  #1d4ed8;
    --accent-glow:   rgba(37, 99, 235, 0.18);
    --accent-subtle: var(--sky);

    --ok:             #16a34a;
    --ok-subtle:      rgba(22, 163, 74, 0.08);
    --danger:         #dc2626;
    --danger-subtle:  rgba(220, 38, 38, 0.08);
    --danger-hover:   #b91c1c;
    --warning:        #d97706;
    --warning-subtle: rgba(217, 119, 6, 0.08);

    --shadow:    0 1px 4px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.10), 0 2px 6px rgba(0,0,0,0.05);
    --shadow-lg: 0 20px 60px rgba(0,0,0,0.13), 0 8px 24px rgba(0,0,0,0.07);
  }
  select.inp {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23636366' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  }
  .lang-select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23636366' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  }
}

/* ── Constants (theme-independent) ───────────────────────── */
:root {
  --r-xs:  6px;
  --r-sm:  8px;
  --r:     12px;
  --r-lg:  16px;
  --r-xl:  20px;
  --r-2xl: 24px;

  /* back-compat aliases */
  --radius:  12px;
  --primary: var(--accent);

  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --t:    0.15s;

  --font: 'Inter', ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
          'Segoe UI', Roboto, Arial, sans-serif;
}

/* ── Reset ────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }

body {
  background:  var(--bg);
  color:       var(--text);
  font-family: var(--font);
  font-size:   14px;
  line-height: 1.5;
  -webkit-font-smoothing:  antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ── Scrollbar ────────────────────────────────────────────── */
::-webkit-scrollbar             { width: 5px; height: 5px; }
::-webkit-scrollbar-track       { background: transparent; }
::-webkit-scrollbar-thumb       { background: var(--border-strong); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-3); }

/* ── Inputs ───────────────────────────────────────────────── */
.inp,
select.inp {
  display:       block;
  width:         100%;
  padding:       9px 13px;
  border-radius: var(--r);
  border:        1.5px solid var(--border);
  background:    var(--surface-2);
  color:         var(--text);
  font-family:   var(--font);
  font-size:     14px;
  line-height:   1.4;
  outline:       none;
  transition:    border-color    var(--t) var(--ease),
                 box-shadow      var(--t) var(--ease),
                 background-color var(--t) var(--ease);
}
.inp::placeholder { color: var(--text-3); }
.inp:focus {
  border-color:     var(--accent);
  box-shadow:       0 0 0 3px var(--accent-glow);
  background-color: var(--surface);
}
.inp:disabled { opacity: 0.5; cursor: not-allowed; }
select.inp {
  cursor:             pointer;
  padding-right:      36px;
  -webkit-appearance: none;
  appearance:         none;
  background-image:   url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238080a8' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat:  no-repeat;
  background-position: right 10px center;
  background-size:    16px;
}
.inp--error {
  border-color: var(--danger)        !important;
  box-shadow:   0 0 0 3px var(--danger-subtle) !important;
}

/* ── Buttons ──────────────────────────────────────────────── */
.btn {
  display:         inline-flex;
  align-items:     center;
  justify-content: center;
  gap:             6px;
  border:          none;
  border-radius:   var(--r);
  padding:         9px 16px;
  background:      var(--accent);
  color:           #fff;
  font-family:     var(--font);
  font-size:       14px;
  font-weight:     600;
  line-height:     1.4;
  cursor:          pointer;
  white-space:     nowrap;
  text-decoration: none;
  user-select:     none;
  -webkit-user-select: none;
  transition: background var(--t) var(--ease),
              box-shadow  var(--t) var(--ease),
              opacity     var(--t) var(--ease),
              transform 0.08s ease;
}
.btn:hover    { background: var(--accent-hover); box-shadow: 0 2px 12px var(--accent-glow); }
.btn:active   { transform: scale(0.97); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; pointer-events: none; }

.btn.secondary {
  background: transparent;
  border:     1.5px solid var(--border-strong);
  color:      var(--text);
  font-weight: 500;
}
.btn.secondary:hover { background: var(--surface-hover); box-shadow: none; }

.btn.ghost {
  background: transparent;
  border:     none;
  color:      var(--text-2);
  font-weight: 400;
  padding:    6px 10px;
}
.btn.ghost:hover { background: var(--surface-hover); color: var(--text); box-shadow: none; }

.btn.danger       { background: var(--danger); }
.btn.danger:hover { background: var(--danger-hover); box-shadow: 0 2px 10px var(--danger-subtle); }

.btn.sm { font-size: 12px; padding: 6px 11px; border-radius: var(--r-sm); }

/* ── Pill modifier (34px height, radius 17px) ─────────────── */
:root {
  --pill-h:   34px;
  --pill-r:   17px;
  --pill-pad: 14px;
  --pill-pl:  20px;
}
.inp--pill {
  height:        var(--pill-h);
  border-radius: var(--pill-r);
  padding:       0 var(--pill-pad);
}
select.inp--pill {
  height:        var(--pill-h);
  border-radius: var(--pill-r);
  padding:       0 36px 0 var(--pill-pl);
}
.btn--pill {
  height:        var(--pill-h);
  border-radius: var(--pill-r);
  padding:       0 var(--pill-pad);
}

/* ── Badge ────────────────────────────────────────────────── */
.badge {
  display:        inline-flex;
  align-items:    center;
  padding:        3px 9px;
  border-radius:  999px;
  font-size:      11px;
  font-weight:    600;
  letter-spacing: 0.015em;
  border:         1px solid var(--border-strong);
  background:     var(--surface-2);
  color:          var(--text-2);
}

/* Booking statuses */
.badge--new       { background: var(--accent-subtle);   border-color: var(--accent-glow);         color: var(--accent); }
.badge--confirmed { background: var(--ok-subtle);       border-color: rgba(52,211,153,0.25);       color: var(--ok);     }
.badge--done      { background: rgba(20,184,166,0.10);  border-color: rgba(20,184,166,0.30);       color: #2dd4bf;       }
.badge--cancelled,
.badge--no_answer { background: var(--danger-subtle);   border-color: rgba(251,113,133,0.30);      color: var(--danger); }

/* Slot states */
.badge--free      { background: var(--ok-subtle);       border-color: rgba(52,211,153,0.25);       color: var(--ok);     }
.badge--booked    { background: var(--accent-subtle);   border-color: var(--accent-glow);          color: var(--accent); }

/* ── Layout utils ─────────────────────────────────────────── */
.row   { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.col   { display: flex; flex-direction: column; }
.muted { color: var(--text-2); font-size: 13px; }
.hr    { border: none; border-top: 1px solid var(--border); margin: 14px 0; }
.spacer { height: 10px; }
.field-error { font-size: 12px; color: var(--danger); margin-top: 4px; }

/* ── Loader ring ──────────────────────────────────────────── */
.loader-ring {
  width:  32px;
  height: 32px;
  border: 2.5px solid var(--border-strong);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Toast ────────────────────────────────────────────────── */
.toast-root {
  position:   fixed;
  bottom:     24px;
  left:       50%;
  transform:  translateX(-50%);
  z-index:    9999;
  display:    flex;
  flex-direction: column;
  gap:        8px;
  align-items: center;
  pointer-events: none;
}
.toast {
  background:    var(--surface);
  border:        1.5px solid var(--border-strong);
  color:         var(--text);
  padding:       11px 20px;
  border-radius: var(--r-lg);
  font-size:     13px;
  font-weight:   500;
  pointer-events: auto;
  box-shadow:    var(--shadow-md);
  animation:     toastIn 0.22s var(--ease);
  max-width:     320px;
  text-align:    center;
}
.toast.ok  { border-color: rgba(52,211,153,0.40);  color: var(--ok);     }
.toast.bad { border-color: rgba(251,113,133,0.40); color: var(--danger); }

@keyframes toastIn {
  from { opacity: 0; transform: translateY(10px) scale(0.95); }
  to   { opacity: 1; transform: translateY(0)    scale(1);    }
}

/* ── Animations ───────────────────────────────────────────── */
@keyframes overlayIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes modalIn {
  from { opacity: 0; transform: scale(0.95) translateY(6px); }
  to   { opacity: 1; transform: scale(1)    translateY(0);   }
}

/* ── Modal overlay ────────────────────────────────────────── */
.modal-overlay {
  position:  fixed;
  inset:     0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index:   500;
  display:   flex;
  align-items: center;
  justify-content: center;
  padding:   16px;
  animation: overlayIn 0.18s var(--ease);
}
.modal-box {
  background:    var(--surface);
  border:        1.5px solid var(--border-strong);
  border-radius: var(--r-xl);
  padding:       24px 22px;
  width:         100%;
  max-width:     440px;
  box-shadow:    var(--shadow-lg);
  animation:     modalIn 0.2s var(--ease);
}
.modal-box__title {
  font-weight: 700;
  font-size:   17px;
  margin-bottom: 16px;
  line-height:  1.3;
}

/* ── Alert ────────────────────────────────────────────────── */
.alert-error {
  padding:       10px 14px;
  border-radius: var(--r);
  background:    var(--danger-subtle);
  border:        1px solid rgba(251, 113, 133, 0.22);
  color:         var(--danger);
  font-size:     13px;
}

/* ── Manual theme overrides (override system preference) ─────
   html[data-theme] takes priority over @media prefers-color-scheme
   because attribute selector [data-theme] has higher specificity
   than :root inside a media query.
─────────────────────────────────────────────────────────── */
html[data-theme="dark"] {
  color-scheme: dark;
  --bg:            #08080f;
  --surface:       #0f0f1c;
  --surface-2:     #161626;
  --surface-hover: #1e1e34;
  --text:   #eeeef8;
  --text-2: #8080a8;
  --text-3: #46466a;
  --border:        rgba(255, 255, 255, 0.07);
  --border-strong: rgba(255, 255, 255, 0.13);
  --accent:        #4f8cff;
  --accent-hover:  #6fa0ff;
  --accent-glow:   rgba(79, 140, 255, 0.22);
  --accent-subtle: rgba(79, 140, 255, 0.10);
  --ok:             #34d399;
  --ok-subtle:      rgba(52, 211, 153, 0.10);
  --danger:         #fb7185;
  --danger-subtle:  rgba(251, 113, 133, 0.10);
  --danger-hover:   #f84f68;
  --warning:        #fbbf24;
  --warning-subtle: rgba(251, 191, 36, 0.10);
  --shadow:    0 1px 4px rgba(0,0,0,0.45), 0 1px 2px rgba(0,0,0,0.30);
  --shadow-md: 0 4px 20px rgba(0,0,0,0.55), 0 2px 8px rgba(0,0,0,0.30);
  --shadow-lg: 0 24px 64px rgba(0,0,0,0.70), 0 8px 24px rgba(0,0,0,0.40);
}

html[data-theme="light"] {
  color-scheme: light;

  /* ── Named palette ──────────────────────────────── */
  --pearl:  #ffffff;               /* Main    — pure white         */
  --ink:    #18181b;               /* Contrast— near black         */
  --cobalt: #2563eb;               /* Accent  — vivid blue         */
  --mist:   #f0f0f6;               /* Surface — cool light grey    */
  --sky:    #dbeafe;               /* Accent tint — soft sky blue  */

  --bg:            var(--pearl);
  --surface:       var(--pearl);
  --surface-2:     var(--mist);
  --surface-hover: #e4e4ed;
  --text:   var(--ink);
  --text-2: #52525b;
  --text-3: #a1a1aa;
  --border:        rgba(0, 0, 0, 0.08);
  --border-strong: rgba(0, 0, 0, 0.16);
  --accent:        var(--cobalt);
  --accent-hover:  #1d4ed8;
  --accent-glow:   rgba(37, 99, 235, 0.18);
  --accent-subtle: var(--sky);
  --ok:             #16a34a;
  --ok-subtle:      rgba(22, 163, 74, 0.08);
  --danger:         #dc2626;
  --danger-subtle:  rgba(220, 38, 38, 0.08);
  --danger-hover:   #b91c1c;
  --warning:        #d97706;
  --warning-subtle: rgba(217, 119, 6, 0.08);
  --shadow:    0 1px 4px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.10), 0 2px 6px rgba(0,0,0,0.05);
  --shadow-lg: 0 20px 60px rgba(0,0,0,0.13), 0 8px 24px rgba(0,0,0,0.07);
}
html[data-theme="light"] select.inp {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23636366' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
}
html[data-theme="light"] .lang-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23636366' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
}

/* ── Lang select ──────────────────────────────────────────── */
/* ── Segmented control ─────────────────────────────────── */
.seg {
  display:       inline-flex;
  background:    var(--surface-2);
  border-radius: 999px;
  padding:       0;
  gap:           2px;
}
.seg__item {
  height:        34px;
  padding:       0 16px;
  border-radius: 999px;
  border:        none;
  background:    transparent;
  color:         var(--text);
  font-family:   var(--font);
  font-size:     14px;
  font-weight:   500;
  cursor:        pointer;
  white-space:   nowrap;
  transition:    background var(--t) var(--ease),
                 color      var(--t) var(--ease);
}
.seg__item:hover { }
.seg__item.active {
  background:  var(--accent);
  color:       #fff;
  font-weight: 600;
}

.lang-select {
  background:    var(--surface-2);
  border:        1.5px solid var(--border);
  color:         var(--text);
  border-radius: 17px;
  padding:       0 30px 0 12px;
  height:        34px;
  font-size:     13px;
  font-family:   var(--font);
  cursor:        pointer;
  outline:       none;
  -webkit-appearance: none;
  appearance:         none;
  background-image:   url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238080a8' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat:  no-repeat;
  background-position: right 8px center;
  background-size:    14px;
  transition:    border-color var(--t) var(--ease);
}
.lang-select:focus { border-color: var(--accent); }

/* ── Theme toggle button ──────────────────────────────────── */
.theme-toggle-btn {
  line-height: 0;
  flex-shrink: 0;
  color:       var(--text-2);
}
/* Override .btn.ghost padding/border-radius for round shape */
.btn.ghost.theme-toggle-btn {
  width:         34px;
  height:        34px;
  padding:       0;
  border-radius: 50%;
}
.theme-toggle-btn:hover { color: var(--text); }

/* ── Confirm modal (confirm.js) ───────────────────────────── */
.confirm-overlay {
  position:   fixed;
  inset:      0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index:    9000;
  display:    flex;
  align-items: center;
  justify-content: center;
  animation:  overlayIn 0.18s var(--ease);
}
.confirm-box {
  background:    var(--surface);
  border:        1.5px solid var(--border-strong);
  border-radius: var(--r-xl);
  padding:       26px;
  max-width:     420px;
  width:         90%;
  box-shadow:    var(--shadow-lg);
  animation:     modalIn 0.2s var(--ease);
}
.confirm-box__title { font-weight: 700; font-size: 16px; margin-bottom: 10px; }
.confirm-box__msg   { color: var(--text-2); margin-bottom: 12px; line-height: 1.5; }
.confirm-box__warn  { color: var(--danger); font-weight: 600; margin-bottom: 12px; }
.confirm-box__check {
  display:       flex;
  align-items:   flex-start;
  gap:           9px;
  margin-bottom: 20px;
  cursor:        pointer;
  color:         var(--text-2);
  line-height:   1.4;
}
.confirm-box__check input { accent-color: var(--accent); margin-top: 2px; flex-shrink: 0; }
.confirm-box__actions { display: flex; gap: 8px; justify-content: flex-end; }
