/* =======================================================
   AGL Student Portal - Glassmorphism CSS Architecture
   Compatible with Hostinger Cloud Hosting, Modern Browsers
   ======================================================= */

:root {
  /* Light Glass Mode (Default) */
  --bg-gradient: linear-gradient(135deg, #f0f4f9 0%, #e2e8f0 50%, #dbe3ed 100%);
  --glass-bg: rgba(255, 255, 255, 0.72);
  --glass-border: rgba(255, 255, 255, 0.8);
  --glass-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.08);
  --glass-card: rgba(255, 255, 255, 0.65);
  --glass-input: rgba(255, 255, 255, 0.85);
  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  --accent-primary: #1e3a8a; /* Culinary Academy Royal Navy */
  --accent-gold: #d97706;    /* Gold Badge Accent */
  --accent-emerald: #059669; /* Success/Active */
  --accent-rose: #e11d48;    /* Alert/Dropped */
  --accent-indigo: #4f46e5;  /* Certificate/Graduated */
  --sidebar-bg: rgba(255, 255, 255, 0.75);
  --table-hover: rgba(241, 245, 249, 0.6);
  --border-radius: 16px;
  --transition-fast: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] {
  /* Premium Dark Glass Mode */
  --bg-gradient: linear-gradient(135deg, #0b1120 0%, #111827 50%, #0f172a 100%);
  --glass-bg: rgba(15, 23, 42, 0.75);
  --glass-border: rgba(255, 255, 255, 0.12);
  --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
  --glass-card: rgba(30, 41, 59, 0.65);
  --glass-input: rgba(30, 41, 59, 0.85);
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-light: #64748b;
  --accent-primary: #3b82f6;
  --accent-gold: #f59e0b;
  --accent-emerald: #10b981;
  --accent-rose: #f43f5e;
  --accent-indigo: #6366f1;
  --sidebar-bg: rgba(15, 23, 42, 0.85);
  --table-hover: rgba(30, 41, 59, 0.7);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
}

body {
  background: var(--bg-gradient);
  background-attachment: fixed;
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  overflow-x: hidden;
  transition: background 0.3s ease, color 0.3s ease;
}

/* Glassmorphism Common Utilities */
.glass-panel {
  background: var(--glass-bg);
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
  border-radius: var(--border-radius);
}

.glass-card {
  background: var(--glass-card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
  border-radius: var(--border-radius);
  padding: 1.5rem;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.glass-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 40px 0 rgba(31, 38, 135, 0.12);
}

.glass-input {
  background: var(--glass-input);
  border: 1px solid var(--glass-border);
  color: var(--text-main);
  padding: 0.65rem 1rem;
  border-radius: 10px;
  outline: none;
  font-size: 0.925rem;
  width: 100%;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.glass-input:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

/* Layout App Structure */
#app-root {
  display: flex;
  width: 100vw;
  min-height: 100vh;
}

/* Sidebar Navigation */
.sidebar {
  width: 280px;
  min-width: 280px;
  height: 100vh;
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 1.5rem 1.25rem;
  background: var(--sidebar-bg);
  backdrop-filter: blur(20px);
  border-right: 1px solid var(--glass-border);
  z-index: 100;
  transition: transform var(--transition-fast);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--glass-border);
}

.brand-logo-img {
  height: 48px;
  width: 48px;
  object-fit: cover;
  border-radius: 12px;
  border: 2px solid var(--accent-gold);
  background: #ffffff;
  padding: 2px;
}

.brand-text h1 {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-main);
  line-height: 1.2;
}

.brand-text span {
  font-size: 0.75rem;
  color: var(--accent-gold);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.sidebar-nav {
  margin-top: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  flex: 1;
  overflow-y: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  color: var(--text-muted);
  text-decoration: none;
  border-radius: 12px;
  font-weight: 500;
  font-size: 0.925rem;
  transition: all var(--transition-fast);
  cursor: pointer;
}

.nav-item:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.15);
}

.nav-item.active {
  background: var(--accent-primary);
  color: #ffffff;
  font-weight: 600;
  box-shadow: 0 4px 15px rgba(30, 58, 138, 0.3);
}

/* Main Content Area */
.main-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.top-bar {
  height: 70px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  background: var(--glass-bg);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--glass-border);
  position: sticky;
  top: 0;
  z-index: 90;
}

.page-title h2 {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-main);
}

.top-controls {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.theme-toggle-btn {
  background: var(--glass-input);
  border: 1px solid var(--glass-border);
  color: var(--text-main);
  padding: 0.5rem 0.85rem;
  border-radius: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  font-weight: 600;
  transition: background var(--transition-fast);
}

.content-container {
  padding: 2rem;
  flex: 1;
  overflow-y: auto;
}

/* Dashboard Metric Cards Grid */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.metric-card {
  position: relative;
  overflow: hidden;
}

.metric-card .metric-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.metric-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.metric-value {
  font-size: 1.85rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.1;
}

/* Status Badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.65rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: capitalize;
}

.badge-learning { background: rgba(16, 185, 129, 0.15); color: var(--accent-emerald); border: 1px solid rgba(16, 185, 129, 0.3); }
.badge-graduated { background: rgba(99, 102, 241, 0.15); color: var(--accent-indigo); border: 1px solid rgba(99, 102, 241, 0.3); }
.badge-hold { background: rgba(245, 158, 11, 0.15); color: var(--accent-gold); border: 1px solid rgba(245, 158, 11, 0.3); }
.badge-dropped { background: rgba(244, 63, 94, 0.15); color: var(--accent-rose); border: 1px solid rgba(244, 63, 94, 0.3); }
.badge-completed { background: rgba(5, 150, 105, 0.15); color: #059669; border: 1px solid rgba(5, 150, 105, 0.3); }

/* Buttons */
.btn {
  padding: 0.65rem 1.25rem;
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  border: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: all var(--transition-fast);
}

.btn-primary {
  background: var(--accent-primary);
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(30, 58, 138, 0.25);
}

.btn-primary:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--glass-input);
  color: var(--text-main);
  border: 1px solid var(--glass-border);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.25);
}

.btn-danger {
  background: var(--accent-rose);
  color: #ffffff;
}

.btn-block {
  width: 100%;
}

/* Table Design */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  border-radius: var(--border-radius);
}

.glass-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  text-align: left;
}

.glass-table th {
  padding: 1rem 1.25rem;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: rgba(255, 255, 255, 0.1);
  border-bottom: 1px solid var(--glass-border);
}

.glass-table td {
  padding: 1rem 1.25rem;
  font-size: 0.9rem;
  color: var(--text-main);
  border-bottom: 1px solid var(--glass-border);
  vertical-align: middle;
}

.glass-table tr:hover td {
  background: var(--table-hover);
}

.student-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--glass-border);
}

/* Modals */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1.5rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

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

.modal-content {
  width: 100%;
  max-width: 800px;
  max-height: 90vh;
  overflow-y: auto;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--border-radius);
  padding: 2rem;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
  transform: scale(0.95);
  transition: transform 0.25s ease;
}

.modal-overlay.active .modal-content {
  transform: scale(1);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--glass-border);
}

.close-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  line-height: 1;
}

/* Forms Grid */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.25rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.form-group.full-width {
  grid-column: 1 / -1;
}

.form-group label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
}

/* Login Page Styling */
.login-body {
  width: 100vw;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-gradient);
}

.login-container {
  width: 100%;
  max-width: 420px;
  padding: 2.5rem;
}

.login-header {
  margin-bottom: 2rem;
  text-align: center;
}

.login-header .logo-wrapper img {
  width: 80px;
  height: 80px;
  border-radius: 20px;
  margin-bottom: 1rem;
  box-shadow: 0 8px 20px rgba(0,0,0,0.15);
}

.login-header h2 {
  font-size: 1.5rem;
  font-weight: 800;
}

.login-header p {
  font-size: 0.875rem;
  color: var(--text-muted);
}

.alert {
  padding: 0.75rem 1rem;
  border-radius: 10px;
  font-size: 0.875rem;
  margin-bottom: 1.25rem;
}

.alert-danger {
  background: rgba(244, 63, 94, 0.15);
  border: 1px solid rgba(244, 63, 94, 0.3);
  color: var(--accent-rose);
}

/* Printable Elements (ID Card, Certificate, Receipt) */
.printable-card {
  width: 380px;
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  color: #ffffff;
  border-radius: 16px;
  padding: 1.5rem;
  border: 2px solid var(--accent-gold);
  box-shadow: 0 10px 30px rgba(0,0,0,0.4);
  position: relative;
  overflow: hidden;
}

.printable-card .card-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid rgba(255,255,255,0.15);
}

.printable-card .card-header img {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  background: #ffffff;
  padding: 2px;
}

.printable-card .card-body {
  display: flex;
  gap: 1.25rem;
  margin-top: 1.25rem;
  align-items: center;
}

.printable-card .photo-frame {
  width: 90px;
  height: 110px;
  border-radius: 10px;
  object-fit: cover;
  border: 2px solid var(--accent-gold);
}

.printable-card .student-details p {
  font-size: 0.8rem;
  color: #94a3b8;
  margin-bottom: 0.2rem;
}

.printable-card .student-details h3 {
  font-size: 1rem;
  color: #ffffff;
  margin-bottom: 0.5rem;
}

@media print {
  body * {
    visibility: hidden;
  }
  .print-section, .print-section * {
    visibility: visible;
  }
  .print-section {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
  }
}

/* Responsive adjustments */
@media (max-width: 900px) {
  .sidebar {
    position: fixed;
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .metrics-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 600px) {
  .metrics-grid {
    grid-template-columns: 1fr;
  }
  .content-container {
    padding: 1rem;
  }
}
