/* ClassHub - Refreshed mobile-first UI */
:root {
  --bg: #f4f6fb;
  --bg-primary: var(--bg);
  --bg-secondary: #eef2f7;
  --bg-tertiary: #ffffff;
  --bg-elevated: #ffffff;
  --bg-soft: #f8fafc;
  --border: #e2e8f0;
  --border-color: var(--border);
  --card-bg: #ffffff;
  --accent: #4f46e5;
  --accent-strong: #4338ca;
  --accent-soft: rgba(79, 70, 229, 0.12);
  --text: #0f172a;
  --text-primary: var(--text);
  --text-muted: #64748b;
  --success: #0f9d7b;
  --warning: #d97706;
  --danger: #dc2626;
  --info: #2563eb;
  --radius: 18px;
  --nav-height: 74px;
  --shadow: 0 12px 30px rgba(15, 23, 42, 0.08);
}

body[data-theme="dark"] {
  --bg: #07111f;
  --bg-primary: #07111f;
  --bg-secondary: #0f172a;
  --bg-tertiary: #111c2f;
  --bg-elevated: #0f172a;
  --bg-soft: #0b1324;
  --border: #22304d;
  --border-color: #22304d;
  --card-bg: #0f172a;
  --accent: #818cf8;
  --accent-strong: #6366f1;
  --accent-soft: rgba(129, 140, 248, 0.18);
  --text: #f8fafc;
  --text-primary: #f8fafc;
  --text-muted: #94a3b8;
  --shadow: 0 16px 40px rgba(2, 8, 23, 0.45);
}

body[data-theme="dark"] .hero-card {
  background: linear-gradient(135deg, rgba(129, 140, 248, 0.16) 0%, rgba(15, 23, 42, 0.95) 100%);
  border-color: rgba(129, 140, 248, 0.24);
}

body[data-theme="dark"] input,
body[data-theme="dark"] select,
body[data-theme="dark"] textarea {
  background: var(--bg-secondary);
  border-color: var(--border);
  color: var(--text);
}

body[data-theme="dark"] .btn-secondary {
  background: rgba(148, 163, 184, 0.16);
  color: var(--text);
  border-color: rgba(148, 163, 184, 0.24);
}

body[data-theme="dark"] .stat-card,
body[data-theme="dark"] .card {
  background: var(--bg-elevated);
  box-shadow: 0 12px 28px rgba(2, 8, 23, 0.26);
}

body[data-theme="dark"] .modal-content {
  background: linear-gradient(180deg, var(--bg-elevated) 0%, var(--bg-secondary) 100%);
  color: var(--text);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Inter', 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

body {
  background: linear-gradient(180deg, var(--bg-soft) 0%, var(--bg) 100%);
  color: var(--text);
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  overflow-x: hidden;
  transition: background 0.2s ease, color 0.2s ease;
}

#app {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  width: 100%;
}

/* NAVIGATION BAR (Mobile Bottom Bar) */
.sidebar {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  height: var(--nav-height);
  background: var(--bg-elevated);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 100;
  padding: 0.55rem 0.8rem calc(0.7rem + env(safe-area-inset-bottom));
  box-shadow: 0 -8px 24px rgba(15, 23, 42, 0.06);
}

.sidebar .brand,
.user-badge {
  display: none !important;
}

.nav-menu {
  list-style: none;
  display: flex;
  flex-direction: row;
  justify-content: space-around;
  width: 100%;
  gap: 0.25rem;
}

.nav-item {
  color: var(--text-muted);
  text-decoration: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.6rem 0.8rem;
  border-radius: 999px;
  transition: all 0.2s ease;
}

.nav-item .material-icons {
  font-size: 1.2rem;
}

.nav-item.active {
  color: var(--accent);
  background: var(--accent-soft);
}

.nav-item.active .material-icons {
  background: transparent;
  padding: 0;
  border-radius: 0;
}

.sidebar-footer {
  border: none;
  padding: 0;
  position: absolute;
  top: -56px;
  right: 15px;
}

.btn-icon {
  background: var(--bg-elevated);
  color: var(--danger);
  border: 1px solid var(--border);
  padding: 0.8rem;
  border-radius: 999px;
  display: flex;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.08);
}

/* MAIN CONTENT */
.main-content {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 1rem calc(var(--nav-height) + 1rem) 1rem;
  background: transparent;
}

.header-bar {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  margin-bottom: 1rem;
  padding: 0.4rem 0 1rem;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  z-index: 10;
}

.header-copy {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.eyebrow {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
}

.header-bar h2 {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.header-bar p {
  color: var(--text-muted);
  font-size: 0.92rem;
  line-height: 1.55;
}

.header-bar .btn {
  width: 100%;
  justify-content: center;
}

.hero-card {
  background: linear-gradient(135deg, rgba(79, 70, 229, 0.08) 0%, rgba(255, 255, 255, 0.95) 100%);
  border: 1px solid rgba(79, 70, 229, 0.14);
}

.hero-content {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.hero-card h3 {
  font-size: 1.04rem;
  margin-bottom: 0.2rem;
}

.hero-card p {
  color: var(--text-muted);
  line-height: 1.55;
}

.hero-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.summary-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.42rem 0.7rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid var(--border);
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--text);
}

.section-card h3 {
  font-size: 1.03rem;
  margin-bottom: 0.15rem;
}

.section-list {
  margin-top: 1rem;
}

.section-form {
  margin-top: 1rem;
}

.full-width-btn {
  width: 100%;
  justify-content: center;
}

.stat-warning {
  color: var(--warning);
}

.nav-item-wrapper {
  list-style: none;
}

/* CARDS & BADGES */
.card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow);
  animation: fadeUp 0.35s ease both;
}

.request-card {
  animation: fadeUp 0.35s ease both;
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  padding: 1.2rem 1rem;
  text-align: center;
  border: 1px dashed var(--border);
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(79, 70, 229, 0.06), rgba(255, 255, 255, 0.4));
  color: var(--text-muted);
}

.empty-state .empty-icon {
  font-size: 1.6rem;
}

.empty-state h4 {
  color: var(--text);
  font-size: 1rem;
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.card-header {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  margin-bottom: 0.75rem;
}

.card-title {
  font-size: 1.03rem;
  font-weight: 700;
  line-height: 1.35;
  color: var(--text);
}

.badge {
  align-self: flex-start;
  padding: 0.34rem 0.62rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.badge-attente {
  background: rgba(217, 119, 6, 0.12);
  color: var(--warning);
  border: 1px solid rgba(217, 119, 6, 0.2);
}

.badge-discussion {
  background: rgba(37, 99, 235, 0.12);
  color: var(--info);
  border: 1px solid rgba(37, 99, 235, 0.2);
}

.badge-acceptee {
  background: rgba(15, 157, 123, 0.12);
  color: var(--success);
  border: 1px solid rgba(15, 157, 123, 0.2);
}

.badge-refusee {
  background: rgba(220, 38, 38, 0.12);
  color: var(--danger);
  border: 1px solid rgba(220, 38, 38, 0.2);
}

.badge-resolue {
  background: rgba(79, 70, 229, 0.12);
  color: var(--accent);
  border: 1px solid rgba(79, 70, 229, 0.2);
}

/* FORMS & BUTTONS */
.form-group {
  margin-bottom: 0.9rem;
}

.settings-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.8rem 0.9rem;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 14px;
  margin-top: 0.7rem;
}

.settings-toggle p {
  margin-top: 0.2rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.theme-switch {
  position: relative;
  width: 50px;
  height: 28px;
  flex-shrink: 0;
}

.theme-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.theme-switch span {
  position: absolute;
  inset: 0;
  cursor: pointer;
  background: #cbd5e1;
  border-radius: 999px;
  transition: all 0.2s ease;
}

.theme-switch span::before {
  content: "";
  position: absolute;
  width: 22px;
  height: 22px;
  left: 3px;
  top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: all 0.2s ease;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.15);
}

.theme-switch input:checked + span {
  background: var(--accent);
}

.theme-switch input:checked + span::before {
  transform: translateX(22px);
}

label {
  display: block;
  font-size: 0.76rem;
  font-weight: 700;
  margin-bottom: 0.45rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

input,
select,
textarea {
  width: 100%;
  padding: 0.9rem 0.95rem;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--bg-soft);
  color: var(--text);
  font-size: 0.96rem;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-strong) 100%);
  color: #fff;
  border: none;
  padding: 0.9rem 1rem;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 700;
  font-size: 0.96rem;
  box-shadow: 0 8px 18px rgba(79, 70, 229, 0.2);
}

.btn-secondary {
  background: #f1f5f9;
  color: #334155;
  box-shadow: none;
  border: 1px solid #e2e8f0;
}

.btn-danger {
  background: linear-gradient(135deg, var(--danger) 0%, #b91c1c 100%);
}

/* BOTTOM SHEET MODAL */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100dvh;
  background: rgba(15, 23, 42, 0.56);
  display: flex;
  align-items: flex-end;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-content {
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  border-radius: 24px 24px 0 0;
  padding: 1.25rem 1rem 1.5rem;
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1);
  box-shadow: 0 -10px 30px rgba(15, 23, 42, 0.12);
}

.modal-overlay.active .modal-content {
  transform: translateY(0);
}

/* STATS GRID */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.2rem;
}

.stat-card {
  background: linear-gradient(145deg, var(--bg-elevated), var(--bg-soft));
  border: 1px solid var(--border);
  padding: 0.95rem;
  border-radius: 16px;
  text-align: center;
  animation: fadeUp 0.35s ease both;
}

.stat-number {
  font-size: 1.55rem;
  font-weight: 800;
  color: var(--accent);
}

.stat-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.3rem;
}

/* COMMENTS */
.comments-panel {
  margin-top: 0.8rem;
  padding-top: 0.8rem;
  border-top: 1px solid var(--border);
}

.comments-list {
  max-height: 220px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin-bottom: 0.6rem;
}

.comment-row {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.7rem 0.8rem;
}

.comment-row strong {
  font-size: 0.78rem;
  color: var(--accent);
}

.comment-row p {
  font-size: 0.9rem;
  margin-top: 0.2rem;
  color: var(--text-muted);
}

.form-comment {
  display: flex;
  gap: 0.5rem;
}

.form-comment .comment-input {
  flex: 1;
  padding: 0.8rem 0.9rem;
  border-radius: 12px;
}

.btn-comment-send {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 12px;
  width: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}

/* Toaster */
.toast-stack {
  position: fixed;
  right: 1rem;
  bottom: calc(1rem + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  z-index: 1200;
  max-width: min(360px, calc(100vw - 2rem));
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 0.7rem;
  padding: 0.85rem 0.95rem;
  border-radius: 14px;
  background: var(--bg-elevated);
  color: var(--text);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  animation: slideInToast 0.3s ease both;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.toast-success {
  border-color: rgba(15, 157, 123, 0.25);
  background: linear-gradient(135deg, rgba(15, 157, 123, 0.15), rgba(15, 157, 123, 0.05));
}

.toast-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 999px;
  background: rgba(79, 70, 229, 0.14);
  color: var(--accent);
  font-weight: 800;
  flex-shrink: 0;
}

.toast-success .toast-icon {
  background: rgba(15, 157, 123, 0.16);
  color: var(--success);
}

.toast strong {
  display: block;
  font-size: 0.9rem;
  margin-bottom: 0.2rem;
}

.toast p {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.45;
}

@keyframes slideInToast {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Admin layout */
#admin-content {
  flex-direction: column;
  height: 100%;
  width: 100%;
}

/* Login Page */
body.login-page {
  justify-content: center;
  align-items: center;
  padding: 1rem;
  background: linear-gradient(135deg, #eef2ff 0%, #f8fafc 100%);
}

body.login-page .card {
  width: 100%;
  max-width: 400px;
  margin: 0 auto;
  border: 1px solid rgba(226, 232, 240, 0.9);
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.08);
  background: rgba(255, 255, 255, 0.96);
}

body.login-page .card h1 {
  font-size: 1.8rem;
  font-weight: 800;
}

body.login-page .card p {
  margin-bottom: 1.5rem;
  color: var(--text-muted);
}

@media (min-width: 768px) {
  .main-content {
    padding: 1.25rem 1.25rem calc(var(--nav-height) + 1.25rem) 1.25rem;
  }

  .header-bar {
    flex-direction: row;
    align-items: flex-start;
    justify-content: space-between;
  }

  .header-bar .btn {
    width: auto;
    white-space: nowrap;
  }

  .hero-content {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }

  .card {
    padding: 1.15rem;
  }
}

