/* ============================================================
   PhysMentor Portal — Shared Styles
   Extends main site CSS variables; does NOT import style.css
   ============================================================ */
:root {
  --ink:        #1a1a2e;
  --gold:       #c9a84c;
  --gold-light: #e8d5a3;
  --cream:      #f8f5ef;
  --muted:      #6b6b7a;
  --white:      #ffffff;
  --border:     rgba(201, 168, 76, 0.25);
  --shadow:     0 8px 48px rgba(26, 26, 46, 0.08);

  --font-display: 'Spectral', 'Noto Serif SC', Georgia, serif;
  --font-body:    'DM Sans', system-ui, sans-serif;

  --sidebar-w: 240px;

  /* Status colours */
  --status-done:      #4a9e6e;
  --status-pending:   #6b6b7a;
  --status-absent:    #c94c4c;
  --status-reschedule:#c97a2a;
  --alert-attention:  #c97a2a;
  --alert-warning:    #c94c4c;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  background: var(--cream);
  color: var(--ink);
  line-height: 1.6;
  overflow-x: hidden;
}

a { text-decoration: none; color: inherit; }
img { display: block; max-width: 100%; }
button { font-family: var(--font-body); cursor: pointer; }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4em;
  padding: 0.7rem 1.5rem;
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border-radius: 3px;
  border: 1px solid transparent;
  transition: opacity 0.2s, transform 0.15s, background 0.2s;
  white-space: nowrap;
}
.btn:hover { opacity: 0.88; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn-gold {
  background: var(--gold);
  color: var(--white);
  border-color: var(--gold);
}
.btn-gold:hover { opacity: 1; background: #b8963e; }

.btn-outline {
  background: transparent;
  color: var(--gold);
  border-color: var(--gold);
}
.btn-outline:hover { background: rgba(201, 168, 76, 0.08); opacity: 1; }

.btn-ghost {
  background: transparent;
  color: var(--muted);
  border-color: var(--border);
}
.btn-ghost:hover { color: var(--ink); border-color: var(--ink); opacity: 1; }

.btn-full { width: 100%; }

/* ============================================================
   FORM ELEMENTS
   ============================================================ */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.form-label {
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.05em;
  color: var(--muted);
  text-transform: uppercase;
}

.form-input {
  width: 100%;
  padding: 0.7rem 1rem;
  font-family: var(--font-body);
  font-size: 0.9rem;
  color: var(--ink);
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 3px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.form-input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(201, 168, 76, 0.12);
}
.form-input::placeholder { color: rgba(107, 107, 122, 0.5); }
.form-input[type="number"]::-webkit-inner-spin-button,
.form-input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.form-input[type="number"] { -moz-appearance: textfield; }

.form-error {
  font-size: 0.72rem;
  color: var(--alert-warning);
  min-height: 1em;
}

/* Password visibility toggle */
.pw-wrap { position: relative; }
.pw-wrap .form-input { padding-right: 2.75rem; }
.pw-toggle {
  position: absolute;
  right: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  transition: color 0.2s;
}
.pw-toggle:hover { color: var(--ink); }

/* Input with inline button (e.g. SMS code) */
.input-group {
  display: flex;
  gap: 0.5rem;
}
.input-group .form-input { flex: 1; }
.input-group .btn { flex-shrink: 0; white-space: nowrap; }

/* ============================================================
   PORTAL SHELL (sidebar + content)
   ============================================================ */
.portal-shell {
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ── */
.sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: var(--ink);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
}

.sidebar-top {
  padding: 2rem 1.5rem 1.5rem;
  border-bottom: 1px solid rgba(201, 168, 76, 0.15);
}

.sidebar-logo {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--white);
  letter-spacing: 0.02em;
  margin-bottom: 1.5rem;
}
.sidebar-logo span { color: var(--gold); }

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.sidebar-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(201, 168, 76, 0.2);
  border: 1.5px solid rgba(201, 168, 76, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 1rem;
  color: var(--gold);
  flex-shrink: 0;
  overflow: hidden;
}
.sidebar-avatar img { width: 100%; height: 100%; object-fit: cover; }
.sidebar-username {
  font-size: 0.88rem;
  color: rgba(255, 255, 255, 0.85);
  font-weight: 400;
}

/* Nav */
.sidebar-nav {
  flex: 1;
  padding: 1rem 0;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1.5rem;
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.55);
  cursor: pointer;
  transition: color 0.2s, background 0.2s;
  position: relative;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  text-decoration: none;
}
.nav-item:hover {
  color: rgba(255, 255, 255, 0.9);
  background: rgba(255, 255, 255, 0.04);
}
.nav-item.active {
  color: var(--white);
  background: rgba(201, 168, 76, 0.1);
}
.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--gold);
  border-radius: 0 2px 2px 0;
}

.nav-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  opacity: 0.7;
}
.nav-item.active .nav-icon,
.nav-item:hover .nav-icon { opacity: 1; }

.nav-label { flex: 1; }

/* Notification badge */
.nav-badge {
  background: var(--gold);
  color: var(--ink);
  font-size: 0.6rem;
  font-weight: 600;
  min-width: 16px;
  height: 16px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
}

/* Sidebar bottom */
.sidebar-bottom {
  padding: 1rem 1.5rem 1.5rem;
  border-top: 1px solid rgba(201, 168, 76, 0.1);
}
.sidebar-logout {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.35);
  cursor: pointer;
  transition: color 0.2s;
  background: none;
  border: none;
  padding: 0;
  width: 100%;
  text-align: left;
}
.sidebar-logout:hover { color: rgba(255, 255, 255, 0.7); }

/* ── Main content ── */
.portal-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.content-header {
  background: var(--white);
  padding: 1.75rem 2.5rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.78rem;
  color: var(--muted);
}
.breadcrumb-sep { opacity: 0.4; }
.breadcrumb-current { color: var(--ink); font-weight: 500; }
.breadcrumb-link {
  color: var(--muted);
  cursor: pointer;
  transition: color 0.2s;
}
.breadcrumb-link:hover { color: var(--gold); }

.page-title {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.2;
}

.content-body {
  padding: 2rem 2.5rem;
  flex: 1;
}

/* ============================================================
   CARDS
   ============================================================ */
.card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow);
  padding: 1.5rem;
}

.card-title {
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 1rem;
}

/* ============================================================
   STATUS BADGES
   ============================================================ */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3em;
  padding: 0.2rem 0.6rem;
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  border-radius: 2px;
}
.status-badge::before {
  content: '';
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
}

.badge-done      { background: rgba(74,158,110,0.12); color: var(--status-done); }
.badge-active    { background: rgba(74,158,110,0.12); color: var(--status-done); }
.badge-pending   { background: rgba(107,107,122,0.1); color: var(--status-pending); }
.badge-absent    { background: rgba(201,76,76,0.1);   color: var(--status-absent); }
.badge-reschedule{ background: rgba(201,122,42,0.12); color: var(--status-reschedule); }
.badge-attention { background: rgba(201,122,42,0.12); color: var(--alert-attention); }
.badge-warning   { background: rgba(201,76,76,0.1);   color: var(--alert-warning); }

/* ============================================================
   EMPTY STATE
   ============================================================ */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  padding: 4rem 2rem;
  text-align: center;
  color: var(--muted);
}
.empty-state-icon {
  font-family: var(--font-display);
  font-size: 3rem;
  color: rgba(201, 168, 76, 0.3);
  line-height: 1;
}
.empty-state-title { font-size: 0.95rem; font-weight: 500; color: var(--ink); }
.empty-state-desc  { font-size: 0.85rem; max-width: 32ch; line-height: 1.6; }

/* ============================================================
   DISABLED FEATURE NOTICE
   ============================================================ */
.feature-unavailable {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  padding: 4rem 2rem;
  text-align: center;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 4px;
}
.feature-unavailable-icon {
  font-size: 2.5rem;
  color: rgba(201, 168, 76, 0.35);
  font-family: var(--font-display);
}
.feature-unavailable-title {
  font-size: 1rem;
  font-weight: 500;
  color: var(--ink);
}
.feature-unavailable-desc {
  font-size: 0.85rem;
  color: var(--muted);
  max-width: 36ch;
  line-height: 1.65;
}

/* ============================================================
   DIVIDER
   ============================================================ */
.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 1.5rem 0;
}

/* ============================================================
   TOAST NOTIFICATIONS
   ============================================================ */
.toast-container {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  z-index: 9999;
}
.toast {
  background: var(--ink);
  color: var(--white);
  padding: 0.85rem 1.25rem;
  border-radius: 4px;
  font-size: 0.82rem;
  box-shadow: 0 4px 24px rgba(26,26,46,0.2);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 260px;
  animation: toastIn 0.25s ease;
}
.toast.toast-success { border-left: 3px solid var(--status-done); }
.toast.toast-error   { border-left: 3px solid var(--status-absent); }
.toast.toast-info    { border-left: 3px solid var(--gold); }
@keyframes toastIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   MODAL (导师端弹层)
   ============================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(26,26,46,0.45);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  opacity: 0;
  transition: opacity 0.2s ease;
}
.modal-overlay.open { opacity: 1; }

.modal {
  background: var(--white);
  border-radius: 8px;
  width: 100%;
  box-shadow: 0 20px 60px rgba(26,26,46,0.25);
  transform: translateY(12px);
  transition: transform 0.2s ease;
}
.modal-overlay.open .modal { transform: translateY(0); }

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.25rem 1.5rem 0;
}
.modal-title {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--ink);
}
.modal-close {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 1rem;
  padding: 0.1rem 0.3rem;
  line-height: 1;
  transition: color 0.2s;
  flex-shrink: 0;
}
.modal-close:hover { color: var(--ink); }

/* ============================================================
   BTN-TAB (week switcher etc.)
   ============================================================ */
.btn-tab {
  border-color: var(--border);
  color: var(--muted);
}
.btn-tab.active {
  background: var(--ink);
  color: var(--white);
  border-color: var(--ink);
}
.btn-tab.active:hover { opacity: 1; background: var(--ink); }

/* ============================================================
   SKELETON LOADING
   ============================================================ */
.sk {
  background: linear-gradient(90deg, rgba(26,26,46,0.06) 25%, rgba(26,26,46,0.10) 50%, rgba(26,26,46,0.06) 75%);
  background-size: 200% 100%;
  animation: skShimmer 1.5s ease infinite;
  border-radius: 4px;
}
@keyframes skShimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.sk-line    { height: 14px; margin-bottom: 0.5rem; }
.sk-line-sm { height: 10px; margin-bottom: 0.4rem; }
.sk-circle  { border-radius: 50%; }
.sk-pill    { border-radius: 99px; }

/* ============================================================
   MOBILE RESPONSIVE (≤ 768px)
   ============================================================ */

/* Hamburger button — hidden on desktop */
.menu-toggle {
  display: none;
  position: fixed;
  top: 0.85rem;
  left: 0.85rem;
  z-index: 201;
  width: 40px;
  height: 40px;
  border-radius: 8px;
  border: none;
  background: var(--ink);
  color: var(--white);
  cursor: pointer;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 12px rgba(26,26,46,0.2);
  transition: background 0.2s;
}
.menu-toggle:hover { background: var(--gold); color: var(--ink); }
.menu-toggle svg { width: 20px; height: 20px; }

/* Sidebar overlay backdrop — hidden on desktop */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(26,26,46,0.45);
  z-index: 99;
  opacity: 0;
  transition: opacity 0.25s;
}
.sidebar-overlay.open { opacity: 1; }

@media (max-width: 768px) {
  /* Show hamburger */
  .menu-toggle { display: flex; }

  /* Sidebar: off-screen by default, slide in */
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 200;
  }
  .sidebar.open { transform: translateX(0); }

  /* Overlay */
  .sidebar-overlay.open { display: block; opacity: 1; }

  /* Main content: full width */
  .portal-content {
    margin-left: 0;
  }

  /* Header: add left padding for hamburger */
  .content-header {
    padding: 1.25rem 1.25rem 1.25rem 3.5rem;
  }

  .page-title {
    font-size: 1.25rem;
  }

  /* Content body: tighter padding */
  .content-body {
    padding: 1.25rem 1rem;
  }

  /* Cards: reduce padding */
  .card {
    padding: 1rem 1.1rem;
  }

  /* Force single-column grids on mobile */
  .page-grid {
    grid-template-columns: 1fr !important;
  }

  /* Tables: horizontal scroll */
  table { display: block; overflow-x: auto; }

  /* Modal: full width on mobile */
  .modal-overlay {
    padding: 0.75rem;
    align-items: flex-start;
    padding-top: 2rem;
  }
  .modal {
    max-width: 100% !important;
    width: 100%;
    max-height: 85vh;
  }
}

