/* css/main.css - Premium unified stylesheet for BTS FED Platform */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&display=swap');

/* ================================================================
   1. DESIGN TOKENS
   ================================================================ */
:root {
  /* Core brand colors */
  --brand-primary: hsl(230, 85%, 60%);
  --brand-primary-hover: hsl(230, 85%, 50%);
  --brand-primary-light: hsl(230, 85%, 95%);
  --brand-secondary: hsl(35, 95%, 55%);
  --brand-secondary-hover: hsl(35, 95%, 45%);
  --brand-accent: hsl(190, 90%, 50%);
  --brand-accent-hover: hsl(190, 90%, 40%);

  /* Backgrounds */
  --bg-main: #f4f6f9;
  --bg-card: #ffffff;
  --bg-sidebar: rgba(255, 255, 255, 0.85);
  --bg-input: #f8fafc;
  --bg-overlay: rgba(15, 23, 42, 0.5);

  /* Text */
  --text-main: #1e293b;
  --text-muted: #64748b;
  --text-inverse: #ffffff;

  /* Status */
  --status-success: hsl(140, 65%, 45%);
  --status-danger: hsl(350, 75%, 55%);
  --status-warning: hsl(40, 90%, 50%);
  --status-info: hsl(210, 80%, 55%);

  /* Structure & Effects */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --radius-pill: 50px;
  --shadow-sm: 0 2px 4px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 8px 16px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 16px 32px rgba(15, 23, 42, 0.12);
  --shadow-glow: 0 0 20px rgba(99, 102, 241, 0.2);
  --font-main: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] {
  --bg-main: #0f172a;
  --bg-card: #1e293b;
  --bg-sidebar: rgba(30, 41, 59, 0.85);
  --bg-input: #0f172a;
  --bg-overlay: rgba(0, 0, 0, 0.6);

  --text-main: #f8fafc;
  --text-muted: #94a3b8;

  --brand-primary-light: hsl(230, 50%, 20%);

  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 8px 16px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 16px 32px rgba(0, 0, 0, 0.4);
}

/* ================================================================
   2. GLOBAL RESET & BASE
   ================================================================ */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  overscroll-behavior: none;
}

body {
  font-family: var(--font-main);
  background-color: var(--bg-main);
  color: var(--text-main);
  line-height: 1.6;
  min-height: 100vh;
  transition: background-color var(--transition-normal), color var(--transition-normal);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}

a {
  color: var(--brand-primary);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--brand-primary-hover);
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 3px solid rgba(99, 102, 241, 0.4);
  outline-offset: 2px;
}

img {
  max-width: 100%;
  height: auto;
}

/* Glassmorphism helpers */
.glass {
  background: var(--bg-sidebar);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .glass {
  border: 1px solid rgba(255, 255, 255, 0.05);
}

/* ================================================================
   3. APP SHELL LAYOUT (sidebar + main)
   ================================================================ */
.app-shell {
  display: grid;
  grid-template-columns: 280px 1fr;
  min-height: 100vh;
}

/* Sidebar */
.app-sidebar {
  background: var(--bg-sidebar);
  border-right: 1px solid rgba(0,0,0,0.05);
  padding: 32px 24px;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 10;
  backdrop-filter: blur(12px);
  transition: all var(--transition-normal);
}

[data-theme="dark"] .app-sidebar {
  border-right-color: rgba(255,255,255,0.05);
}

.sidebar-header {
  margin-bottom: 40px;
  text-align: center;
}

.sidebar-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--brand-primary);
  background: linear-gradient(135deg, var(--brand-primary), var(--brand-accent));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 8px;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}

.nav-link {
  display: flex;
  align-items: center;
  padding: 14px 20px;
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 500;
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
  position: relative;
  overflow: hidden;
  gap: 12px;
}

.nav-link::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  width: 0;
  background: var(--brand-secondary);
  transition: width var(--transition-fast);
  z-index: -1;
  opacity: 0.1;
}

.nav-link:hover {
  color: var(--brand-primary);
  background: rgba(99, 102, 241, 0.05);
  transform: translateX(4px);
}

.nav-link.active {
  color: #ffffff;
  background: var(--brand-secondary);
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
}

.nav-link.active::before {
  width: 100%;
  opacity: 1;
}

/* User Panel */
.user-panel-wrapper {
  position: absolute;
  top: 24px;
  right: 40px;
  z-index: 100;
}

.user-badge {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 8px 20px 8px 8px;
  background: var(--bg-card);
  border-radius: var(--radius-pill);
  box-shadow: var(--shadow-md);
  border: 1px solid rgba(0,0,0,0.05);
  cursor: pointer;
  transition: all var(--transition-normal);
  text-decoration: none;
}

[data-theme="dark"] .user-badge {
  border-color: rgba(255,255,255,0.05);
}

.user-badge:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  border-color: var(--brand-primary);
}

.user-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--brand-primary);
  background: var(--bg-input);
}

.user-name {
  font-weight: 600;
  font-size: 1rem;
  color: var(--text-main);
}

/* Main Content Area */
.app-main {
  padding: 40px 60px;
  width: 100%;
  max-width: 1600px;
  margin: 0 auto;
  position: relative;
}

/* ================================================================
   4. TYPOGRAPHY
   ================================================================ */
h1, h2, h3, h4 {
  color: var(--text-main);
  line-height: 1.3;
}

.page-title {
  font-size: 2.25rem;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--text-main);
}

.page-subtitle {
  color: var(--text-muted);
  font-size: 1.1rem;
  margin-bottom: 40px;
}

.text-gradient {
  background: linear-gradient(135deg, var(--brand-primary), var(--brand-accent));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* ================================================================
   5. CARDS
   ================================================================ */
.card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 32px;
  box-shadow: var(--shadow-sm);
  border: 1px solid rgba(0,0,0,0.03);
  transition: all var(--transition-normal);
  margin-bottom: 24px;
}

[data-theme="dark"] .card {
  border-color: rgba(255,255,255,0.03);
}

.card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-4px);
}

.card-title {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--text-main);
}

.card p {
  color: var(--text-muted);
}

/* Stat cards for dashboards */
.stat-card {
  background: var(--bg-card);
  padding: 28px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid rgba(0,0,0,0.03);
  transition: all var(--transition-normal);
}

[data-theme="dark"] .stat-card {
  border-color: rgba(255,255,255,0.03);
}

.stat-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.stat-card h3 {
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.stat-card .stat-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--brand-primary);
}

.stat-card .stat-label {
  font-size: 0.95rem;
  color: var(--text-muted);
}

/* Grid Layouts */
.grid-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 24px;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

.grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
}

/* ================================================================
   6. FORMS & INPUTS
   ================================================================ */
.form-group {
  margin-bottom: 20px;
}

label {
  display: block;
  font-weight: 500;
  margin-bottom: 8px;
  color: var(--text-main);
  font-size: 0.95rem;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="url"],
input[type="search"],
input[type="date"],
input[type="file"],
select,
textarea {
  width: 100%;
  padding: 14px 16px;
  background: var(--bg-input);
  border: 1px solid rgba(0,0,0,0.1);
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-family: inherit;
  font-size: 1rem;
  transition: all var(--transition-fast);
}

[data-theme="dark"] input,
[data-theme="dark"] select,
[data-theme="dark"] textarea {
  border-color: rgba(255,255,255,0.1);
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
  background: var(--bg-card);
}

textarea {
  min-height: 120px;
  resize: vertical;
}

/* Search bar */
.search-bar {
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
}

.search-bar input {
  flex: 1;
}

.search-bar button {
  flex-shrink: 0;
}

/* Password field */
.password-field {
  position: relative;
}

.password-field input {
  padding-right: 48px;
}

.password-toggle {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 50%;
  background: rgba(99, 102, 241, 0.1);
  color: var(--brand-primary);
  border: none;
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.password-toggle:hover {
  background: rgba(99, 102, 241, 0.2);
}

/* ================================================================
   7. BUTTONS
   ================================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 24px;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  transition: all var(--transition-fast);
  border: none;
  text-decoration: none;
  gap: 8px;
  font-family: inherit;
}

.btn-primary {
  background: var(--brand-primary);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover {
  background: var(--brand-primary-hover);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(99, 102, 241, 0.4);
  color: #ffffff;
}

.btn-secondary {
  background: var(--brand-secondary);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
}

.btn-secondary:hover {
  background: var(--brand-secondary-hover);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(245, 158, 11, 0.4);
  color: #ffffff;
}

.btn-accent {
  background: var(--brand-accent);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(14, 165, 233, 0.3);
}

.btn-accent:hover {
  background: var(--brand-accent-hover);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(14, 165, 233, 0.4);
  color: #ffffff;
}

.btn-danger {
  background: rgba(239, 68, 68, 0.1);
  color: var(--status-danger);
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.btn-danger:hover {
  background: var(--status-danger);
  color: #ffffff;
  transform: translateY(-2px);
}

.btn-outline {
  background: transparent;
  color: var(--brand-primary);
  border: 2px solid var(--brand-primary);
}

.btn-outline:hover {
  background: var(--brand-primary);
  color: #ffffff;
  transform: translateY(-2px);
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid rgba(0,0,0,0.1);
}

.btn-ghost:hover {
  background: var(--bg-input);
  color: var(--text-main);
}

[data-theme="dark"] .btn-ghost {
  border-color: rgba(255,255,255,0.1);
}

.btn-block {
  width: 100%;
}

.btn-sm {
  padding: 8px 16px;
  font-size: 0.875rem;
}

.btn-lg {
  padding: 16px 32px;
  font-size: 1.1rem;
}

/* ================================================================
   8. TABLES
   ================================================================ */
.table-container {
  width: 100%;
  overflow-x: auto;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  background: var(--bg-card);
  border: 1px solid rgba(0,0,0,0.03);
}

[data-theme="dark"] .table-container {
  border-color: rgba(255,255,255,0.03);
}

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

th, td {
  padding: 16px 20px;
  text-align: left;
  border-bottom: 1px solid rgba(0,0,0,0.05);
}

[data-theme="dark"] th,
[data-theme="dark"] td {
  border-bottom-color: rgba(255,255,255,0.05);
}

th {
  background: rgba(99, 102, 241, 0.04);
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  font-size: 0.85rem;
  letter-spacing: 0.05em;
}

[data-theme="dark"] th {
  background: rgba(99, 102, 241, 0.08);
}

tr:last-child td {
  border-bottom: none;
}

tr:hover td {
  background: rgba(99, 102, 241, 0.02);
}

[data-theme="dark"] tr:hover td {
  background: rgba(99, 102, 241, 0.04);
}

/* Table inline inputs */
table input[type="text"],
table input[type="email"],
table input[type="password"] {
  padding: 8px 12px;
  font-size: 0.9rem;
  background: var(--bg-input);
  border-radius: var(--radius-sm);
}

table button,
table .btn {
  padding: 8px 14px;
  font-size: 0.85rem;
}

table form {
  display: inline;
}

/* ================================================================
   9. ALERTS / NOTICES
   ================================================================ */
.alert {
  padding: 16px 20px;
  border-radius: var(--radius-md);
  margin-bottom: 24px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 12px;
}

.alert-success,
.notice,
.message {
  background: rgba(34, 197, 94, 0.1);
  color: var(--status-success);
  border: 1px solid rgba(34, 197, 94, 0.2);
  padding: 16px 20px;
  border-radius: var(--radius-md);
  margin-bottom: 24px;
}

.alert-error,
.error {
  background: rgba(239, 68, 68, 0.1);
  color: var(--status-danger);
  border: 1px solid rgba(239, 68, 68, 0.2);
  padding: 16px 20px;
  border-radius: var(--radius-md);
  margin-bottom: 24px;
}

.alert-warning {
  background: rgba(245, 158, 11, 0.1);
  color: var(--status-warning);
  border: 1px solid rgba(245, 158, 11, 0.2);
}

.alert-info {
  background: rgba(99, 102, 241, 0.1);
  color: var(--status-info);
  border: 1px solid rgba(99, 102, 241, 0.2);
}

/* ================================================================
   10. AUTH PAGES (Login / Register / CGU)
   ================================================================ */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 16px;
  background:
    radial-gradient(circle at 15% 0%, rgba(99, 102, 241, 0.15), transparent 30%),
    radial-gradient(circle at 85% 100%, rgba(14, 165, 233, 0.1), transparent 30%),
    var(--bg-main);
}

.auth-card {
  width: min(100%, 440px);
  padding: 40px;
  background: var(--bg-card);
  border: 1px solid rgba(0,0,0,0.05);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(12px);
}

[data-theme="dark"] .auth-card {
  border-color: rgba(255,255,255,0.05);
}

.auth-card h2 {
  text-align: center;
  margin-bottom: 32px;
  font-size: 1.75rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--brand-primary), var(--brand-accent));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.auth-card input {
  margin-bottom: 18px;
}

.auth-card button[type="submit"],
.auth-card .btn-primary {
  width: 100%;
  margin-top: 8px;
}

.auth-card .auth-links {
  margin-top: 24px;
  text-align: center;
}

.auth-card .auth-links a {
  display: block;
  margin-top: 12px;
  color: var(--text-muted);
  font-weight: 500;
  transition: color var(--transition-fast);
}

.auth-card .auth-links a:hover {
  color: var(--brand-primary);
}

.auth-card p.error {
  text-align: center;
  margin-bottom: 18px;
}

/* ================================================================
   11. HOMEPAGE / LANDING PAGE
   ================================================================ */
.landing-page {
  min-height: 100vh;
}

/* Banner / Hero */
.banner {
  text-align: center;
  padding: clamp(56px, 8vw, 92px) 20px clamp(42px, 6vw, 68px);
  background: linear-gradient(135deg, var(--brand-primary), var(--brand-accent));
  color: white;
  position: relative;
  overflow: hidden;
}

.banner::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(255,255,255,0.08) 0%, transparent 60%);
  animation: banner-glow 15s ease-in-out infinite;
}

@keyframes banner-glow {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(20%, 20%); }
}

.banner h1 {
  max-width: 960px;
  margin: 0 auto 14px;
  font-size: clamp(2.1rem, 5vw, 3.7rem);
  line-height: 1.08;
  font-weight: 800;
  color: white;
  position: relative;
}

.banner p {
  max-width: 780px;
  margin: 0 auto 24px;
  font-size: clamp(1rem, 2vw, 1.22rem);
  opacity: 0.9;
  position: relative;
}

.banner .buttons {
  display: flex;
  justify-content: center;
  gap: 14px;
  margin-top: 24px;
  position: relative;
}

.banner .buttons a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 12px 24px;
  border-radius: var(--radius-md);
  font-weight: 700;
  background: rgba(255,255,255,0.95);
  color: var(--brand-primary);
  box-shadow: 0 12px 24px rgba(0,0,0,0.15);
  transition: all var(--transition-fast);
}

.banner .buttons a:hover {
  background: #ffffff;
  transform: translateY(-2px);
  box-shadow: 0 16px 32px rgba(0,0,0,0.2);
  color: var(--brand-primary-hover);
}

/* Simple Features Grid */
.features-grid-section {
  width: min(100% - 32px, 1100px);
  margin: 60px auto;
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
}

@media (max-width: 768px) {
  .features-grid {
    grid-template-columns: 1fr;
  }
}

.feature-card {
  background: var(--bg-card);
  border: 1px solid rgba(0,0,0,0.05);
  border-radius: var(--radius-lg);
  padding: 32px;
  display: flex;
  flex-direction: column;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  box-shadow: var(--shadow-sm);
}

[data-theme="dark"] .feature-card {
  border-color: rgba(255,255,255,0.05);
}

.feature-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-md);
  border-color: rgba(99, 102, 241, 0.2);
}

.feature-icon-wrapper {
  width: 50px;
  height: 50px;
  background: rgba(99, 102, 241, 0.1);
  color: var(--brand-primary);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  margin-bottom: 20px;
  transition: all 0.3s ease;
}

.feature-card:hover .feature-icon-wrapper {
  background: var(--brand-primary);
  color: white;
}

.feature-card h2 {
  font-size: 1.4rem;
  font-weight: 600;
  margin-bottom: 10px;
  color: var(--text-main);
}

.feature-card p {
  color: var(--text-muted);
  font-size: 1rem;
  line-height: 1.5;
}

/* Content sections on landing */
.content-section {
  width: min(100% - 32px, 1160px);
  margin: 64px auto;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 22px;
}

.content-block {
  background: var(--bg-card);
  border: 1px solid rgba(0,0,0,0.05);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 28px;
  transition: all var(--transition-normal);
}

[data-theme="dark"] .content-block {
  border-color: rgba(255,255,255,0.05);
}

.content-block:hover {
  border-color: rgba(99, 102, 241, 0.2);
  box-shadow: var(--shadow-md);
  transform: translateY(-4px);
}

.content-block h3 {
  font-size: 1.25rem;
  line-height: 1.3;
  margin-bottom: 10px;
}

.content-block p {
  color: var(--text-muted);
}

/* Access section (login cards) */
.access-section {
  width: min(100% - 32px, 1160px);
  margin: 64px auto;
  text-align: center;
}

.access-section h2 {
  font-size: clamp(1.8rem, 3vw, 2.3rem);
  margin-bottom: 30px;
}

.panel-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 24px;
}

.panel-card {
  display: flex;
  min-height: 100%;
  padding: 24px;
  flex-direction: column;
  text-align: left;
  background: var(--bg-card);
  border: 1px solid rgba(0,0,0,0.05);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-normal);
}

[data-theme="dark"] .panel-card {
  border-color: rgba(255,255,255,0.05);
}

.panel-card:hover {
  border-color: rgba(99, 102, 241, 0.2);
  box-shadow: var(--shadow-md);
  transform: translateY(-4px);
}

.panel-card img {
  width: 100%;
  height: 180px;
  object-fit: contain;
  border-radius: var(--radius-md);
  margin-bottom: 16px;
  background: var(--bg-input);
}

.panel-card h3 {
  font-size: 1.25rem;
  margin-bottom: 8px;
}

.panel-card p {
  color: var(--text-muted);
  margin-bottom: 18px;
}

.panel-card a.btn,
.panel-card a {
  align-self: flex-start;
  margin-top: auto;
  padding: 10px 18px;
  border-radius: var(--radius-md);
  font-weight: 700;
  color: white;
  box-shadow: 0 4px 12px rgba(0,0,0,0.12);
  transition: all var(--transition-fast);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.panel-card a:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 16px rgba(0,0,0,0.16);
}

.panel-card.student a { background: var(--brand-primary); }
.panel-card.teacher a { background: var(--brand-secondary); }
.panel-card.admin a { background: var(--status-danger); }

.student-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: auto;
}

.student-actions a {
  flex: 1;
  min-width: 100px;
  justify-content: center;
  text-align: center;
}

/* Landing footer */
.landing-footer {
  background: var(--bg-card);
  color: var(--text-main);
  border-top: 1px solid rgba(0,0,0,0.05);
  padding: 60px 20px 20px;
  margin-top: 60px;
}

[data-theme="dark"] .landing-footer {
  border-top-color: rgba(255,255,255,0.05);
  background: var(--bg-input);
}

.footer-container {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 40px;
}

.footer-brand {
  flex: 1;
  min-width: 250px;
}

.footer-brand h2 {
  color: var(--brand-primary);
  font-size: 1.8rem;
  margin-bottom: 12px;
}

.footer-brand p {
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.5;
  max-width: 300px;
}

.footer-links {
  display: flex;
  gap: 60px;
  flex-wrap: wrap;
}

.footer-column h4 {
  font-size: 1.1rem;
  margin-bottom: 16px;
  color: var(--text-main);
}

.footer-column a {
  display: block;
  color: var(--text-muted);
  text-decoration: none;
  margin-bottom: 10px;
  font-size: 0.95rem;
  transition: color var(--transition-fast);
}

.footer-column a:hover {
  color: var(--brand-primary);
}

.footer-bottom {
  max-width: 1100px;
  margin: 40px auto 0;
  padding-top: 20px;
  border-top: 1px solid rgba(0,0,0,0.05);
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
}

[data-theme="dark"] .footer-bottom {
  border-top-color: rgba(255,255,255,0.05);
}

/* ================================================================
   12. STATS & DASHBOARD COMPONENTS
   ================================================================ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 20px;
  margin-bottom: 32px;
}

.stats-grid .stat-card {
  margin-bottom: 0;
}

.chart-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  border: 1px solid rgba(0,0,0,0.03);
}

[data-theme="dark"] .chart-card {
  border-color: rgba(255,255,255,0.03);
}

/* ================================================================
   13. RESOURCE CARDS & LISTS
   ================================================================ */
.resource-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 24px;
}

.resource-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  border: 1px solid rgba(0,0,0,0.03);
  transition: all var(--transition-normal);
  display: flex;
  flex-direction: column;
}

[data-theme="dark"] .resource-card {
  border-color: rgba(255,255,255,0.03);
}

.resource-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-4px);
  border-color: rgba(99, 102, 241, 0.15);
}

.resource-card h3 {
  font-size: 1.1rem;
  margin-bottom: 8px;
}

.resource-card p {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-bottom: 16px;
}

.resource-card .resource-actions {
  margin-top: auto;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ================================================================
   14. CATEGORIES
   ================================================================ */
.category-list {
  display: grid;
  gap: 18px;
}

.category-card {
  background: var(--bg-card);
  padding: 24px;
  border-radius: var(--radius-lg);
  border: 1px solid rgba(0,0,0,0.03);
  box-shadow: var(--shadow-sm);
  display: grid;
  gap: 14px;
}

[data-theme="dark"] .category-card {
  border-color: rgba(255,255,255,0.03);
}

.category-header {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.chapter-list {
  display: grid;
  gap: 8px;
}

.chapter-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  background: var(--bg-input);
  border-radius: var(--radius-sm);
}

.chapter-row input {
  flex: 1;
  padding: 8px 12px;
}

/* ================================================================
   15. MODALS
   ================================================================ */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--bg-overlay);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal.active {
  display: flex;
}

.modal-content {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 32px;
  max-width: 800px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  position: relative;
}

.modal-content iframe {
  width: 100%;
  min-height: 500px;
  border: none;
  border-radius: var(--radius-md);
}

.close-modal {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: rgba(0,0,0,0.05);
  color: var(--text-muted);
  cursor: pointer;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.close-modal:hover {
  background: var(--status-danger);
  color: white;
}

/* ================================================================
   16. BADGES & TAGS
   ================================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  font-size: 0.8rem;
  font-weight: 600;
  gap: 4px;
}

.badge-primary {
  background: rgba(99, 102, 241, 0.1);
  color: var(--brand-primary);
}

.badge-success {
  background: rgba(34, 197, 94, 0.1);
  color: var(--status-success);
}

.badge-danger {
  background: rgba(239, 68, 68, 0.1);
  color: var(--status-danger);
}

.badge-warning {
  background: rgba(245, 158, 11, 0.1);
  color: var(--status-warning);
}

/* ================================================================
   17. EMPTY STATE
   ================================================================ */
.empty-state {
  padding: 48px 24px;
  text-align: center;
  color: var(--text-muted);
  border: 2px dashed rgba(0,0,0,0.08);
  border-radius: var(--radius-lg);
  background: rgba(0,0,0,0.01);
}

[data-theme="dark"] .empty-state {
  border-color: rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.01);
}

.empty-state i {
  font-size: 3rem;
  margin-bottom: 16px;
  opacity: 0.4;
}

.empty-state p {
  max-width: 400px;
  margin: 0 auto;
}

/* ================================================================
   18. FORM PANEL (for CGU, settings etc.)
   ================================================================ */
.form-panel {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 32px;
  box-shadow: var(--shadow-sm);
  border: 1px solid rgba(0,0,0,0.03);
  margin-bottom: 24px;
}

[data-theme="dark"] .form-panel {
  border-color: rgba(255,255,255,0.03);
}

/* ================================================================
   19. THEME TOGGLE
   ================================================================ */
.theme-toggle {
  margin-top: 24px;
  background: transparent;
  color: var(--text-muted);
  border: 1px solid rgba(0,0,0,0.1);
  padding: 12px;
  border-radius: var(--radius-md);
  width: 100%;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
  font-family: inherit;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

[data-theme="dark"] .theme-toggle {
  border-color: rgba(255,255,255,0.1);
}

.theme-toggle:hover {
  background: var(--bg-input);
  color: var(--text-main);
}

/* ================================================================
   20. UTILITIES
   ================================================================ */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }
.text-muted { color: var(--text-muted); }
.text-primary { color: var(--brand-primary); }
.text-success { color: var(--status-success); }
.text-danger { color: var(--status-danger); }
.font-bold { font-weight: 700; }

.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.mt-8 { margin-top: 32px; }
.mb-2 { margin-bottom: 8px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.mb-8 { margin-bottom: 32px; }
.mx-auto { margin-left: auto; margin-right: auto; }

.d-flex { display: flex; }
.d-grid { display: grid; }
.flex-wrap { flex-wrap: wrap; }
.align-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-4 { gap: 16px; }
.gap-6 { gap: 24px; }

.w-full { width: 100%; }
.hidden { display: none; }

/* ================================================================
   21. ANIMATIONS
   ================================================================ */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes slideInRight {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}

.animate-fade-in {
  animation: fadeIn 0.5s ease both;
}

.animate-slide-in {
  animation: slideInRight 0.5s ease both;
}

/* Staggered card animations */
.grid-cards > *:nth-child(1) { animation-delay: 0s; }
.grid-cards > *:nth-child(2) { animation-delay: 0.1s; }
.grid-cards > *:nth-child(3) { animation-delay: 0.2s; }
.grid-cards > *:nth-child(4) { animation-delay: 0.3s; }
.grid-cards > *:nth-child(5) { animation-delay: 0.4s; }
.grid-cards > *:nth-child(6) { animation-delay: 0.5s; }

/* ================================================================
   22. RESPONSIVE
   ================================================================ */
@media (max-width: 1024px) {
  .app-shell {
    grid-template-columns: 240px 1fr;
  }
  .app-main {
    padding: 30px 40px;
  }
  .grid-4 {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .app-sidebar {
    height: auto;
    position: relative;
    padding: 20px;
    border-right: none;
    border-bottom: 1px solid rgba(0,0,0,0.05);
  }

  .sidebar-nav {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
  }

  .nav-link {
    padding: 10px 14px;
    font-size: 0.9rem;
  }

  .app-main {
    padding: 20px;
  }

  .user-panel-wrapper {
    position: relative;
    top: 0;
    right: 0;
    margin-bottom: 20px;
    display: flex;
    justify-content: center;
  }

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

  .grid-cards {
    grid-template-columns: 1fr;
  }

  .grid-2,
  .grid-3,
  .grid-4 {
    grid-template-columns: 1fr;
  }

  .panel-cards {
    grid-template-columns: 1fr;
  }

  .panel-card {
    max-width: 520px;
    margin: 0 auto;
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }

  .resource-grid {
    grid-template-columns: 1fr;
  }

  .search-bar {
    flex-direction: column;
  }

  table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
  }

  .banner .buttons {
    flex-direction: column;
    align-items: center;
  }

  .student-actions {
    flex-direction: column;
  }
}

@media (max-width: 480px) {
  .auth-card {
    padding: 28px 20px;
  }

  .slide {
    min-height: 220px;
    padding: 38px 24px;
  }

  .nav-arrow {
    width: 36px;
    height: 36px;
    font-size: 1.5rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
