/* =====================================================================
   css/styles.css – Student Dashboard shared stylesheet
   ===================================================================== */

/* ── CSS custom properties ─────────────────────────────────────────── */
:root {
  --primary:        #7FC571;
  --primary-hover:  #6aaa5e;
  --primary-light:  #edf7eb;
  --secondary:      #0ea5e9;
  --bg:             #f8fafc;
  --surface:        #ffffff;
  --border:         #e2e8f0;
  --text:           #1e293b;
  --text-muted:     #64748b;
  --success:        #16a34a;
  --success-light:  #f0fdf4;
  --warning:        #d97706;
  --warning-light:  #fffbeb;
  --danger:         #dc2626;
  --danger-light:   #fef2f2;
  --sidebar-w:      240px;
  --radius:         8px;
  --shadow:         0 1px 3px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.06);
  --shadow-lg:      0 10px 15px -3px rgba(0,0,0,.1), 0 4px 6px -2px rgba(0,0,0,.05);
}

/* ── Reset / base ──────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  font-size: 14px;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

h1,h2,h3,h4 { line-height: 1.2; font-weight: 600; }

/* ── Utility ───────────────────────────────────────────────────────── */
.hidden   { display: none !important; }
.sr-only  { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }
.mt-1     { margin-top: .25rem; }
.mt-2     { margin-top: .5rem; }
.mt-3     { margin-top: .75rem; }
.mt-4     { margin-top: 1rem; }
.mb-4     { margin-bottom: 1rem; }
.text-sm  { font-size: .875rem; }
.text-muted { color: var(--text-muted); }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.bold     { font-weight: 600; }
.flex     { display: flex; }
.items-center { align-items: center; }
.gap-2    { gap: .5rem; }
.gap-3    { gap: .75rem; }
.gap-4    { gap: 1rem; }

/* ── Buttons ───────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .375rem;
  padding: .5rem 1rem;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-size: .875rem;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: background .15s, border-color .15s, color .15s;
  white-space: nowrap;
}
.btn:disabled { opacity: .6; cursor: not-allowed; }
.btn-primary   { background: var(--primary);  color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--primary-hover); text-decoration: none; }
.btn-secondary { background: var(--secondary); color: #fff; }
.btn-secondary:hover:not(:disabled) { background: #0284c7; text-decoration: none; }
.btn-outline   { background: transparent; color: var(--primary); border-color: var(--primary); }
.btn-outline:hover:not(:disabled) { background: var(--primary-light); text-decoration: none; }
.btn-danger    { background: var(--danger);  color: #fff; }
.btn-danger:hover:not(:disabled) { background: #b91c1c; text-decoration: none; }
.btn-ghost     { background: transparent; color: var(--text-muted); border-color: var(--border); }
.btn-ghost:hover:not(:disabled) { background: var(--bg); text-decoration: none; }
.btn-sm  { padding: .25rem .625rem; font-size: .8rem; }
.btn-lg  { padding: .75rem 1.5rem; font-size: 1rem; }
.btn-block { display: flex; width: 100%; justify-content: center; }

/* ── Form elements ─────────────────────────────────────────────────── */
.form-group  { display: flex; flex-direction: column; gap: .375rem; margin-bottom: 1rem; }
label        { font-size: .875rem; font-weight: 500; }
.form-input  {
  padding: .5rem .75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: .875rem;
  color: var(--text);
  background: var(--surface);
  width: 100%;
  transition: border-color .15s, box-shadow .15s;
}
.form-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(127,197,113,.15);
}
.form-input::placeholder { color: var(--text-muted); }
.form-hint   { font-size: .75rem; color: var(--text-muted); }
.form-error  { font-size: .75rem; color: var(--danger); }

/* ── Card ──────────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card-header { padding: 1rem 1.25rem; border-bottom: 1px solid var(--border); }
.card-body   { padding: 1.25rem; }
.card-footer { padding: .75rem 1.25rem; border-top: 1px solid var(--border); background: var(--bg); border-radius: 0 0 var(--radius) var(--radius); }

/* ── Auth pages (centered layout) ──────────────────────────────────── */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.auth-box {
  width: 100%;
  max-width: 400px;
}
.auth-logo {
  text-align: center;
  margin-bottom: 1.5rem;
}
.auth-logo h1 { font-size: 1.5rem; color: var(--primary); }
.auth-logo p  { color: var(--text-muted); margin-top: .25rem; font-size: .875rem; }
.auth-logo-img {
  height: 56px;
  width: auto;
  max-width: 200px;
  object-fit: contain;
  display: block;
  margin: 0 auto .5rem;
}
.auth-links   { text-align: center; margin-top: 1rem; font-size: .875rem; color: var(--text-muted); }
.auth-divider { border: none; border-top: 1px solid var(--border); margin: 1.25rem 0; }

/* ── Dashboard layout ───────────────────────────────────────────────── */
.app-layout {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  z-index: 100;
  transition: transform .25s;
}
.sidebar-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.sidebar-header h2 { font-size: 1rem; color: var(--primary); }
.sidebar-logo {
  height: 36px;
  width: auto;
  max-width: 160px;
  object-fit: contain;
  display: block;
}
.sidebar-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.25rem;
  color: var(--text-muted);
}

.sidebar-nav {
  flex: 1;
  padding: .75rem 0;
  overflow-y: auto;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: .625rem;
  padding: .625rem 1.25rem;
  color: var(--text-muted);
  font-size: .875rem;
  font-weight: 500;
  border-left: 3px solid transparent;
  transition: background .15s, color .15s, border-color .15s;
  cursor: pointer;
  text-decoration: none;
}
.nav-item:hover { background: var(--primary-light); color: var(--primary); text-decoration: none; }
.nav-item.active { background: var(--primary-light); color: var(--primary); border-left-color: var(--primary); }
.nav-icon { font-size: 1rem; width: 1.25rem; text-align: center; }

.sidebar-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--border);
}
.user-info { font-size: .8rem; color: var(--text-muted); margin-bottom: .5rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Main content */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-w);
  padding: 1.5rem;
  min-width: 0;
}

/* Section */
.section { display: none; }
.section.active { display: block; }

/* Page header */
.page-header {
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: .75rem;
}
.page-header h1 { font-size: 1.25rem; }
.page-header p  { color: var(--text-muted); font-size: .875rem; margin-top: .25rem; }

/* ── Stats cards ────────────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.stat-card {
  padding: 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.stat-card .stat-value { font-size: 1.75rem; font-weight: 700; color: var(--primary); }
.stat-card .stat-label { font-size: .8rem; color: var(--text-muted); margin-top: .25rem; }

/* ── Tabs ───────────────────────────────────────────────────────────── */
.tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1rem;
}
.tab-btn {
  padding: .625rem 1rem;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  font-size: .875rem;
  font-weight: 500;
  color: var(--text-muted);
  transition: color .15s, border-color .15s;
  margin-bottom: -1px;
}
.tab-btn:hover  { color: var(--primary); }
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── Table ──────────────────────────────────────────────────────────── */
.table-wrapper { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .875rem; }
thead th {
  text-align: left;
  padding: .625rem .75rem;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  color: var(--text-muted);
  font-size: .8rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  white-space: nowrap;
}
tbody tr { border-bottom: 1px solid var(--border); }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--bg); }
tbody td { padding: .75rem; vertical-align: middle; }

/* Status badges */
.badge {
  display: inline-block;
  padding: .2rem .55rem;
  border-radius: 9999px;
  font-size: .75rem;
  font-weight: 600;
}
.badge-scheduled  { background: #dbeafe; color: #1e40af; }
.badge-cancelled  { background: #fee2e2; color: #991b1b; }
.badge-rescheduled{ background: #fef9c3; color: #854d0e; }
.badge-completed  { background: #dcfce7; color: #166534; }
.badge-admin      { background: var(--primary-light); color: var(--primary); }
.badge-student    { background: #f1f5f9; color: var(--text-muted); }
.badge-pending    { background: #fef9c3; color: #854d0e; }

/* ── Calendar ───────────────────────────────────────────────────────── */
.calendar { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.calendar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .75rem 1rem;
  border-bottom: 1px solid var(--border);
}
.calendar-header h3 { font-size: 1rem; }
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
}
.cal-day-header {
  text-align: center;
  padding: .5rem;
  font-size: .75rem;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.cal-day {
  min-height: 70px;
  padding: .375rem;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  cursor: default;
  position: relative;
}
.cal-day:nth-child(7n) { border-right: none; }
.cal-day.empty { background: var(--bg); }
.cal-day.past  { background: #f9fafb; }
.cal-day.today .day-number { background: var(--primary); color: #fff; border-radius: 50%; }
.cal-day.has-bookings { cursor: pointer; }
.cal-day.has-bookings:hover { background: var(--primary-light); }
.day-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  font-size: .8rem;
  font-weight: 500;
}
.booking-dots { display: flex; flex-wrap: wrap; gap: 2px; margin-top: .25rem; }
.booking-dot  { width: 7px; height: 7px; border-radius: 50%; background: var(--primary); }
.booking-dot.cancelled  { background: var(--danger); }
.booking-dot.rescheduled{ background: var(--warning); }

/* ── File manager ───────────────────────────────────────────────────── */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: .375rem;
  flex-wrap: wrap;
  font-size: .875rem;
  margin-bottom: .75rem;
}
.breadcrumb-item { color: var(--primary); cursor: pointer; }
.breadcrumb-item:last-child { color: var(--text); cursor: default; }
.breadcrumb-sep { color: var(--text-muted); }
.file-list { list-style: none; }
.file-item {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .625rem .75rem;
  border-bottom: 1px solid var(--border);
  transition: background .1s;
}
.file-item:last-child  { border-bottom: none; }
.file-item:hover       { background: var(--bg); }
.file-item-icon  { font-size: 1.1rem; flex-shrink: 0; }
.file-item-name  { flex: 1; font-size: .875rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-item-size  { font-size: .75rem; color: var(--text-muted); flex-shrink: 0; }
.file-item-actions { display: flex; gap: .25rem; flex-shrink: 0; }

/* ── Booking card (overview next session) ───────────────────────────── */
.next-session {
  padding: 1.25rem;
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  color: #fff;
  border-radius: var(--radius);
  margin-bottom: 1.5rem;
}
.next-session h2    { font-size: 1rem; opacity: .85; margin-bottom: .25rem; }
.next-session .time { font-size: 1.5rem; font-weight: 700; margin-bottom: .75rem; }
.next-session .btn  { background: rgba(255,255,255,.2); color: #fff; border-color: rgba(255,255,255,.4); }
.next-session .btn:hover { background: rgba(255,255,255,.35); }

/* ── Toast notifications ────────────────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: .5rem;
  pointer-events: none;
}
.toast {
  min-width: 280px;
  max-width: 380px;
  padding: .875rem 1rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  font-size: .875rem;
  font-weight: 500;
  pointer-events: all;
  animation: slideIn .2s ease;
}
.toast-success { background: #166534; color: #fff; }
.toast-error   { background: var(--danger); color: #fff; }
.toast-info    { background: var(--primary); color: #fff; }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ── Loading spinner ────────────────────────────────────────────────── */
.spinner {
  display: inline-block;
  width: 1em;
  height: 1em;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin .6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-state {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3rem;
  color: var(--text-muted);
  gap: .75rem;
}

/* ── Empty state ────────────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 3rem 1.5rem;
  color: var(--text-muted);
}
.empty-state .empty-icon { font-size: 2.5rem; margin-bottom: .75rem; }
.empty-state p { font-size: .9rem; }

/* ── Alert ──────────────────────────────────────────────────────────── */
.alert {
  padding: .875rem 1rem;
  border-radius: var(--radius);
  font-size: .875rem;
  margin-bottom: 1rem;
}
.alert-error   { background: var(--danger-light);  color: #991b1b; border: 1px solid #fecaca; }
.alert-success { background: var(--success-light); color: #166534; border: 1px solid #bbf7d0; }
.alert-info    { background: var(--primary-light); color: var(--primary); border: 1px solid #b9e5b1; }

/* ── Modal / dialog ─────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 500;
  padding: 1rem;
}
.modal {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 440px;
  padding: 1.5rem;
}
.modal h3 { margin-bottom: .75rem; }
.modal-actions { display: flex; gap: .5rem; justify-content: flex-end; margin-top: 1.25rem; }

/* ── Cal.com embeds ─────────────────────────────────────────────────── */
.cal-embed-container {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  min-height: 650px;
}
.cal-tabs { display: flex; gap: .5rem; margin-bottom: 1rem; flex-wrap: wrap; }
.cal-embed-wrapper { display: none; }
.cal-embed-wrapper.active { display: block; }

/* ── Search input ───────────────────────────────────────────────────── */
.search-bar {
  display: flex;
  align-items: center;
  gap: .5rem;
  margin-bottom: 1rem;
}
.search-bar .form-input { max-width: 300px; }

/* ── Responsive ─────────────────────────────────────────────────────── */
/* Hide mobile-only elements on desktop by default */
.mobile-menu-btn { display: none; }

@media (max-width: 768px) {
  :root { --sidebar-w: 0px; }

  .sidebar {
    width: 240px;
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .sidebar-toggle { display: block; }

  .main-content {
    margin-left: 0;
    padding: 1rem;
  }
  .mobile-menu-btn {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .5rem 1rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    font-size: .875rem;
    margin-bottom: 1rem;
  }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .next-session .time { font-size: 1.2rem; }
}

/* ── Misc ───────────────────────────────────────────────────────────── */
.divider { border: none; border-top: 1px solid var(--border); margin: 1.5rem 0; }
.danger-zone {
  border: 1px solid #fecaca;
  border-radius: var(--radius);
  padding: 1.25rem;
  background: var(--danger-light);
}
.danger-zone h3 { color: var(--danger); margin-bottom: .5rem; }

/* ── Drag-and-drop upload zone ──────────────────────────────────────── */
.drop-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 1.5rem 1rem;
  text-align: center;
  color: var(--text-muted);
  font-size: .875rem;
  transition: border-color .15s, background .15s;
  margin-top: .75rem;
  cursor: default;
}
.drop-zone.drag-over {
  border-color: var(--primary);
  background: var(--primary-light);
  color: var(--primary);
}
.drop-zone .drop-icon { font-size: 1.5rem; margin-bottom: .375rem; }

/* ── Upload progress list ───────────────────────────────────────────── */
.upload-progress-list {
  list-style: none;
  margin-top: .75rem;
  display: flex;
  flex-direction: column;
  gap: .375rem;
}
.upload-progress-item {
  display: flex;
  align-items: center;
  gap: .625rem;
  padding: .5rem .75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: .8rem;
}
.upload-progress-item .up-name   { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upload-progress-item .up-status { flex-shrink: 0; font-size: .75rem; color: var(--text-muted); }
.up-status.done  { color: var(--success); }
.up-status.error { color: var(--danger); }

/* ── File drag-and-drop ─────────────────────────────────────────────── */
.drag-handle {
  cursor: grab;
  color: var(--text-muted);
  flex-shrink: 0;
  padding: 0 .125rem;
  opacity: 0;
  transition: opacity .15s;
  font-size: .85rem;
}
.file-item:hover .drag-handle,
.file-item:focus-within .drag-handle { opacity: .6; }
.file-item.dragging { opacity: .35; background: var(--bg); }
.file-item.drop-folder {
  outline: 2px dashed var(--primary);
  outline-offset: -2px;
  background: var(--primary-light);
}
.file-item.drop-before { box-shadow: inset 0 2px 0 var(--primary); }
.file-item.drop-after  { box-shadow: inset 0 -2px 0 var(--primary); }
