/* ══════════════════════════════════════════════════
   CSS VARIABLES — THEME ENGINE
══════════════════════════════════════════════════ */
    :root {
      --primary: #185FA5;
      --primary-dark: #0f4a87;
      --primary-light: #E6F1FB;
      --primary-rgb: 24, 95, 165;
      --accent: #1D9E75;
      --accent-light: #EAF3DE;
      --danger: #E24B4A;
      --danger-light: #FCEBEB;
      --warn: #F59E0B;
      --warn-light: #FFF8E6;
      --bg: #EEF3FA;
      --surface: #ffffff;
      --surface2: #F4F7FB;
      --border: #E0E5EF;
      --text: #1a1a2e;
      --text2: #555e72;
      --text3: #9aa0ae;
      --radius: 12px;
      --radius-sm: 7px;
      --font: 'Plus Jakarta Sans', system-ui, sans-serif;
      --shadow: 0 4px 20px rgba(24, 95, 165, 0.08);
      --shadow-lg: 0 12px 40px rgba(24, 95, 165, 0.14);
    }

/* ══════════════════════════════════════════════════
   DARK MODE
══════════════════════════════════════════════════ */
    body.dark {
      --bg: #0f1623;
      --surface: #1a2235;
      --surface2: #212d42;
      --border: #2d3a52;
      --text: #e8ecf4;
      --text2: #8b9ab5;
      --text3: #4d5e7a;
      --shadow: 0 4px 20px rgba(0, 0, 0, .3);
      --shadow-lg: 0 12px 40px rgba(0, 0, 0, .5);
      --primary-light: rgba(24, 95, 165, .18);
      --accent-light: rgba(29, 158, 117, .12);
      --danger-light: rgba(226, 75, 74, .12);
      --warn-light: rgba(245, 158, 11, .08);
    }

/* ══════════════════════════════════════════════════
   RESET & BASE
══════════════════════════════════════════════════ */
    *,
    *::before,
    *::after {
      box-sizing: border-box;
      margin: 0;
      padding: 0;
    }

    body {
      font-family: var(--font);
      background: var(--bg);
      color: var(--text);
      overflow-x: hidden;
      transition: background .3s, color .3s;
    }

    button {
      font-family: var(--font);
    }

    input,
    select,
    textarea {
      font-family: var(--font);
    }

/* ══════════════════════════════════════════════════
   KEYFRAMES
══════════════════════════════════════════════════ */
    @keyframes splashPop {
      from {
        opacity: 0;
        transform: translateY(14px) scale(.96)
      }
      to {
        opacity: 1;
        transform: none
      }
    }

    @keyframes fillBar {
      from { width: 0% }
      to { width: 100% }
    }

    @keyframes spin {
      to { transform: rotate(360deg); }
    }

    @keyframes toastIn {
      from {
        opacity: 0;
        transform: translateX(18px)
      }
      to {
        opacity: 1;
        transform: none
      }
    }

    @keyframes toastOut {
      to {
        opacity: 0;
        transform: translateX(18px);
        height: 0;
        padding: 0;
        margin: 0;
        overflow: hidden
      }
    }

    @keyframes screenIn {
      from {
        opacity: 0;
        transform: translateY(10px)
      }
      to {
        opacity: 1;
        transform: none
      }
    }

/* ══════════════════════════════════════════════════
   SPLASH (animation references)
══════════════════════════════════════════════════ */
    .splash-logo {
      animation: splashPop .6s cubic-bezier(.34, 1.56, .64, 1) both;
    }

    .splash-bar {
      animation: splashPop .6s .15s cubic-bezier(.34, 1.56, .64, 1) both;
    }

    .splash-sub {
      animation: splashPop .6s .25s cubic-bezier(.34, 1.56, .64, 1) both;
    }

    .splash-fill {
      height: 100%;
      background: white;
      border-radius: 99px;
      width: 0%;
      animation: fillBar 1.8s .3s cubic-bezier(.4, 0, .2, 1) forwards;
    }

/* ══════════════════════════════════════════════════
   THEME CONFIGURATOR PANEL
══════════════════════════════════════════════════ */
    #themeBtn {
      position: fixed;
      right: 0;
      top: 50%;
      transform: translateY(-50%);
      z-index: 500;
      background: var(--primary);
      color: white;
      border: none;
      border-radius: var(--radius) 0 0 var(--radius);
      width: 38px;
      height: 54px;
      display: flex;
      align-items: center;
      justify-content: center;
      cursor: pointer;
      box-shadow: -2px 0 12px rgba(var(--primary-rgb), .3);
      transition: background .15s, width .15s;
    }

    #themeBtn:hover {
      background: var(--primary-dark);
    }

    #themeBtn svg {
      width: 18px;
      height: 18px;
      stroke: white;
      fill: none;
      stroke-width: 1.8;
    }

    #themePanel {
      position: fixed;
      right: -280px;
      top: 50%;
      transform: translateY(-50%);
      width: 270px;
      max-height: 82vh;
      background: var(--surface);
      border: 1px solid var(--border);
      border-radius: var(--radius) 0 0 var(--radius);
      box-shadow: -8px 0 32px rgba(0, 0, 0, .12);
      z-index: 499;
      overflow-y: auto;
      transition: right .35s cubic-bezier(.4, 0, .2, 1);
    }

    #themePanel.open {
      right: 0;
    }

    .tp-toggle {
      width: 38px;
      height: 20px;
      background: var(--border);
      border-radius: 99px;
      cursor: pointer;
      position: relative;
      border: none;
      transition: background .2s;
    }

    .tp-toggle.on {
      background: var(--primary);
    }

    .tp-toggle::after {
      content: '';
      position: absolute;
      width: 14px;
      height: 14px;
      background: white;
      border-radius: 50%;
      top: 3px;
      left: 3px;
      transition: left .2s;
      box-shadow: 0 1px 3px rgba(0, 0, 0, .2);
    }

    .tp-toggle.on::after {
      left: 21px;
    }

    .swatch::after {
      content: '✓';
      position: absolute;
      inset: 0;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 12px;
      color: white;
      font-weight: 800;
      opacity: 0;
    }

    .swatch.active::after {
      opacity: 1;
    }

/* ══════════════════════════════════════════════════
   PASSWORD STRENGTH
══════════════════════════════════════════════════ */
    .pwd-strength {
      height: 4px;
      background: var(--surface2);
      border-radius: 2px;
      margin-top: 4px;
      overflow: hidden;
    }

    .pwd-fill {
      height: 100%;
      border-radius: 2px;
      transition: width .3s, background .3s;
    }

/* ══════════════════════════════════════════════════
   MODAL SYSTEM
══════════════════════════════════════════════════ */
    .modal-overlay {
      position: fixed;
      inset: 0;
      z-index: 600;
      background: rgba(10, 20, 40, .5);
      backdrop-filter: blur(3px);
      display: flex;
      align-items: center;
      justify-content: center;
      padding: 20px;
      opacity: 0;
      pointer-events: none;
      transition: opacity .25s;
    }

    .modal-overlay.open {
      opacity: 1;
      pointer-events: all;
    }

    .modal {
      background: var(--surface);
      border-radius: var(--radius);
      width: 100%;
      max-width: 520px;
      max-height: 90vh;
      overflow-y: auto;
      box-shadow: var(--shadow-lg);
      border: 1px solid var(--border);
      transform: scale(.95) translateY(12px);
      transition: transform .3s cubic-bezier(.34, 1.56, .64, 1);
    }

    .modal-overlay.open .modal {
      transform: none;
    }

    .modal-lg {
      max-width: 680px;
    }

    .modal-header {
      padding: 18px 22px 14px;
      border-bottom: 1px solid var(--border);
      display: flex;
      align-items: center;
      justify-content: space-between;
      position: sticky;
      top: 0;
      background: var(--surface);
      z-index: 2;
      border-radius: var(--radius) var(--radius) 0 0;
    }

    .modal-title {
      font-size: 15px;
      font-weight: 700;
      color: var(--text);
      display: flex;
      align-items: center;
      gap: 8px;
    }

    .modal-title svg {
      flex-shrink: 0;
    }

    .modal-close {
      width: 30px;
      height: 30px;
      border-radius: 7px;
      border: 1px solid var(--border);
      background: none;
      display: flex;
      align-items: center;
      justify-content: center;
      cursor: pointer;
      color: var(--text3);
      font-size: 15px;
      transition: all .15s;
    }

    .modal-close:hover {
      border-color: var(--danger);
      color: var(--danger);
      background: var(--danger-light);
    }

    .modal-body {
      padding: 18px 22px;
    }

    .modal-footer {
      padding: 14px 22px;
      border-top: 1px solid var(--border);
      display: flex;
      justify-content: flex-end;
      gap: 10px;
      background: var(--surface2);
      border-radius: 0 0 var(--radius) var(--radius);
      position: sticky;
      bottom: 0;
    }

/* ══════════════════════════════════════════════════
   SELECT & TEXTAREA MODAL INPUTS
══════════════════════════════════════════════════ */
    .sel-arrow {
      background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239aa0ae' stroke-width='2.5'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
      background-repeat: no-repeat;
      background-position: right 10px center;
    }

/* ══════════════════════════════════════════════════
   FULLCALENDAR OVERRIDES
══════════════════════════════════════════════════ */
    .fc {
      font-family: var(--font) !important;
    }

    .fc-toolbar-title {
      font-size: 15px !important;
      font-weight: 700 !important;
      color: var(--text) !important;
    }

    .fc .fc-button {
      background: var(--surface) !important;
      border: 1px solid var(--border) !important;
      color: var(--text2) !important;
      font-family: var(--font) !important;
      font-size: 11px !important;
      font-weight: 600 !important;
      border-radius: 6px !important;
      padding: 5px 10px !important;
      box-shadow: none !important;
      transition: all .15s !important;
    }

    .fc .fc-button:hover {
      border-color: var(--primary) !important;
      color: var(--primary) !important;
      background: var(--primary-light) !important;
    }

    .fc .fc-button-primary:not(:disabled).fc-button-active,
    .fc .fc-button-primary:not(:disabled):active {
      background: var(--primary) !important;
      border-color: var(--primary) !important;
      color: white !important;
    }

    .fc .fc-col-header-cell {
      background: var(--surface2);
    }

    .fc .fc-col-header-cell-cushion {
      font-size: 10px;
      font-weight: 700;
      text-transform: uppercase;
      letter-spacing: .04em;
      color: var(--text3);
      text-decoration: none;
    }

    .fc-daygrid-day-number {
      font-size: 11px;
      font-weight: 600;
      color: var(--text2);
      text-decoration: none;
    }

    .fc-day-today {
      background: rgba(var(--primary-rgb), .05) !important;
    }

    .fc-day-today .fc-daygrid-day-number {
      color: var(--primary) !important;
    }

    .fc-event {
      border-radius: 5px !important;
      border: none !important;
      font-size: 10px !important;
      font-weight: 500 !important;
      cursor: pointer;
      transition: transform .1s;
    }

    .fc-event:hover {
      transform: scale(1.02);
    }

    .fc-timegrid-slot {
      height: 36px !important;
    }

    .fc-list-event:hover td {
      background: var(--primary-light) !important;
    }

    .fc .fc-toolbar.fc-header-toolbar {
      margin-bottom: 12px !important;
    }

/* ══════════════════════════════════════════════════
   SWEETALERT2 OVERRIDES
══════════════════════════════════════════════════ */
    .swal2-popup {
      font-family: var(--font) !important;
      border-radius: var(--radius) !important;
      border: 1px solid var(--border) !important;
      background: var(--surface) !important;
    }

    .swal2-title {
      font-size: 17px !important;
      font-weight: 800 !important;
      color: var(--text) !important;
    }

    .swal2-html-container {
      font-size: 13px !important;
      color: var(--text2) !important;
    }

    .swal2-confirm {
      background: var(--primary) !important;
      border-radius: 7px !important;
      font-family: var(--font) !important;
      font-weight: 600 !important;
      padding: 9px 20px !important;
    }

    .swal2-cancel {
      background: none !important;
      border: 1px solid var(--border) !important;
      color: var(--text2) !important;
      border-radius: 7px !important;
      font-family: var(--font) !important;
      font-weight: 500 !important;
      padding: 9px 16px !important;
    }


/* Skeleton loader */
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: .45; }
}


/* ══════════════════════════════════════════════════
   FORM VALIDATION ERRORS
══════════════════════════════════════════════════ */
.input-error {
  border-color: var(--danger) !important;
  background: var(--danger-light) !important;
}
.field-err {
  color: var(--danger);
  font-size: 10px;
  margin-top: 3px;
  display: block;
}

/* ══════════════════════════════════════════════════
   DAY STRIP CELLS
══════════════════════════════════════════════════ */
.day-cell {
  text-align: center;
  border-radius: 8px;
  padding: 9px 4px;
  transition: border-color .2s, background .2s, transform .15s;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.day-cell:not(.day-cell--sun):hover {
  border-color: var(--primary) !important;
  transform: translateY(-1px);
}
.day-cell--sel { box-shadow: 0 2px 8px rgba(var(--primary-rgb), .18); }
.day-cell__dow { font-size: 10px; text-transform: uppercase; letter-spacing: .04em; }
.day-cell__num { font-size: 17px; margin: 3px 0; line-height: 1; }
.day-cell__mon { font-size: 10px; }

/* ══════════════════════════════════════════════════
   DOCTOR CARD RESPONSIVE
══════════════════════════════════════════════════ */
.doctor-card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: border-color .2s, box-shadow .2s;
}
.doctor-card:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow);
}
.doctor-card-info {
  flex: 1;
  min-width: 0;
}
.doctor-card-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex-shrink: 0;
  min-width: 140px;
}

@media (max-width: 600px) {
  .doctor-card {
    flex-wrap: wrap;
    align-items: flex-start;
  }
  .doctor-card-info {
    flex: 1;
    min-width: calc(100% - 68px);
  }
  .doctor-card-actions {
    width: 100%;
    min-width: unset;
    flex-direction: row;
  }
  .doctor-card-actions button {
    flex: 1;
    font-size: 11px !important;
    padding: 9px 8px !important;
  }
}
