/* ============================================
   DESIGN SYSTEM & VARIABLES
============================================ */
:root {
  --bg-dark: #0f172a;
  --bg-card: rgba(30, 41, 59, 0.7);
  --bg-glass: rgba(15, 23, 42, 0.6);
  --border-glass: rgba(255, 255, 255, 0.1);
  
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  
  --primary: #6366f1;
  --primary-hover: #4f46e5;
  
  --success: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;
  --info: #3b82f6;
  
  --badge-theory: rgba(99, 102, 241, 0.2);
  --badge-theory-text: #818cf8;
  --badge-practical: rgba(16, 185, 129, 0.2);
  --badge-practical-text: #34d399;
  --badge-tutorial: rgba(245, 158, 11, 0.2);
  --badge-tutorial-text: #fbbf24;
  
  --nav-height: 65px;
  --header-height: 60px;
}

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

body {
  font-family: 'Inter', sans-serif;
  background-color: var(--bg-dark);
  color: var(--text-main);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  /* Dark mode background gradient */
  background: radial-gradient(circle at top right, #1e1b4b, #0f172a);
  min-height: 100vh;
}

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

button {
  cursor: pointer;
  border: none;
  background: none;
  font-family: inherit;
}

/* ============================================
   SCREENS & VIEWS (SPA LOGIC)
============================================ */
.screen {
  display: none;
  height: 100vh;
  width: 100%;
}
.screen.active {
  display: flex;
  flex-direction: column;
}

.view {
  display: none;
  animation: fadeIn 0.3s ease;
  padding-bottom: 2rem;
}
.view.active {
  display: block;
}

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

/* ============================================
   AUTH SCREEN
============================================ */
#auth-screen {
  justify-content: center;
  align-items: center;
  padding: 20px;
}

.auth-container {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-glass);
  border-radius: 24px;
  padding: 40px 30px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.auth-header {
  text-align: center;
  margin-bottom: 30px;
}

.auth-logo {
  width: 60px;
  height: 60px;
  background: linear-gradient(135deg, var(--primary), #a855f7);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-weight: 700;
  margin: 0 auto 15px;
  box-shadow: 0 10px 25px rgba(99, 102, 241, 0.4);
}

.auth-header h1 {
  font-size: 24px;
  margin-bottom: 5px;
}
.auth-header p {
  color: var(--text-muted);
  font-size: 14px;
}

.form-group {
  margin-bottom: 20px;
}
.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 8px;
  color: var(--text-muted);
}
.form-group input {
  width: 100%;
  padding: 12px 16px;
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid var(--border-glass);
  color: white;
  font-size: 15px;
  transition: all 0.2s;
}
.form-group input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.btn {
  padding: 12px 24px;
  border-radius: 12px;
  font-weight: 600;
  font-size: 15px;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.btn-primary {
  background: var(--primary);
  color: white;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}
.btn-primary:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
}
.btn-block {
  width: 100%;
}

.auth-footer {
  text-align: center;
  margin-top: 25px;
  font-size: 14px;
  color: var(--text-muted);
}

/* ============================================
   APP LAYOUT (HEADER, MAIN, NAV)
============================================ */
.app-header {
  height: var(--header-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  background: var(--bg-glass);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-glass);
  position: sticky;
  top: 0;
  z-index: 10;
}

.app-logo {
  font-weight: 700;
  font-size: 18px;
  background: linear-gradient(to right, #fff, #a5b4fc);
  -webkit-background-clip: text;
  color: transparent;
}

.btn-icon {
  color: var(--text-muted);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}
.btn-icon:hover {
  background: rgba(255, 255, 255, 0.1);
  color: white;
}

.app-main {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  padding-bottom: calc(var(--nav-height) + 20px);
}

.app-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  height: var(--nav-height);
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  border-top: 1px solid var(--border-glass);
  display: flex;
  justify-content: space-around;
  align-items: center;
  z-index: 100;
  padding-bottom: env(safe-area-inset-bottom);
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  width: 60px;
  transition: all 0.2s;
}
.nav-item span {
  font-size: 11px;
  font-weight: 500;
  margin-top: 4px;
}
.nav-item.active {
  color: var(--primary);
}
.nav-item:hover:not(.active) {
  color: #e2e8f0;
}

/* ============================================
   DASHBOARD / TYPOGRAPHY
============================================ */
.dashboard-header {
  margin-bottom: 25px;
}
.dashboard-header h1 {
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 4px;
}
.dashboard-header .subtitle {
  color: var(--text-muted);
  font-size: 15px;
}

.section-title {
  margin: 30px 0 15px;
}
.section-title h2 {
  font-size: 18px;
  font-weight: 600;
  color: #e2e8f0;
}

/* ============================================
   CARDS
============================================ */
.stats-card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-glass);
  border-radius: 20px;
  padding: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.stats-overall {
  text-align: center;
}
.stats-label {
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 8px;
}
.stats-value {
  font-size: 48px;
  font-weight: 700;
  line-height: 1;
}

/* ============================================
   LECTURE LIST (ATTENDANCE MARKING)
============================================ */
.lectures-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.lecture-card {
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: 16px;
  padding: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: transform 0.2s;
}
.lecture-card:active {
  transform: scale(0.98);
}

.lecture-info {
  flex: 1;
}
.lecture-time {
  font-size: 12px;
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 4px;
}
.lecture-subject {
  font-size: 16px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}
.lecture-meta {
  font-size: 13px;
  color: var(--text-muted);
}

.badge {
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 10px;
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 0.5px;
}
.badge-theory { background: var(--badge-theory); color: var(--badge-theory-text); }
.badge-practical { background: var(--badge-practical); color: var(--badge-practical-text); }
.badge-tutorial { background: var(--badge-tutorial); color: var(--badge-tutorial-text); }

.lecture-actions {
  display: flex;
  gap: 8px;
}

.btn-action {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-muted);
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}
.btn-action.active {
  transform: scale(1.1);
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}
.btn-present.active { background: rgba(16, 185, 129, 0.2); border-color: var(--success); color: var(--success); }
.btn-absent.active { background: rgba(239, 68, 68, 0.2); border-color: var(--danger); color: var(--danger); }
.btn-cancelled.active { background: rgba(245, 158, 11, 0.2); border-color: var(--warning); color: var(--warning); }

/* ============================================
   UTILITIES & OVERLAYS
============================================ */
.empty-state {
  padding: 40px 20px;
  text-align: center;
  background: var(--bg-card);
  border-radius: 16px;
  border: 1px dashed var(--border-glass);
  color: var(--text-muted);
}

/* Toast */
.toast-container {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 90%;
  max-width: 400px;
}
.toast {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-glass);
  padding: 12px 16px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
  opacity: 0;
  transform: translateY(-20px);
  transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}
.toast-visible {
  opacity: 1;
  transform: translateY(0);
}
.toast-hiding {
  opacity: 0;
  transform: scale(0.9);
}
.toast-icon { font-size: 18px; }
.toast-success .toast-icon { color: var(--success); }
.toast-error .toast-icon { color: var(--danger); }
.toast-warning .toast-icon { color: var(--warning); }
.toast-info .toast-icon { color: var(--info); }
.toast-message { font-size: 14px; font-weight: 500; }

/* Loader */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.8);
  backdrop-filter: blur(5px);
  z-index: 10000;
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}
.loading-overlay.active {
  opacity: 1;
  pointer-events: all;
}
.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(99, 102, 241, 0.3);
  border-radius: 50%;
  border-top-color: var(--primary);
  animation: spin 1s ease-in-out infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ============================================
   RESPONSIVE (DESKTOP TWEAKS)
============================================ */
@media (min-width: 768px) {
  .app-main {
    max-width: 800px;
    margin: 0 auto;
    padding: 30px;
  }
  .app-nav {
    max-width: 800px;
    left: 50%;
    transform: translateX(-50%);
    border-radius: 20px 20px 0 0;
  }
}
/* ============================================
   CALENDAR & ANALYTICS STYLES
============================================ */

/* Calendar Controls */
.calendar-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  background: var(--bg-card);
  padding: 10px 15px;
  border-radius: 16px;
  border: 1px solid var(--border-glass);
}
.cal-month-year {
  font-size: 18px;
  font-weight: 600;
}

/* Calendar Grid */
.calendar-grid {
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: 16px;
  padding: 15px;
  margin-bottom: 15px;
}
.cal-header-row {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  margin-bottom: 10px;
}
.cal-day-header {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
}
.cal-days-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 5px;
}
.cal-day {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 500;
  border-radius: 50%;
  cursor: pointer;
  position: relative;
  transition: all 0.2s;
}
.cal-day:not(.empty):hover {
  background: rgba(255, 255, 255, 0.1);
}
.cal-day.empty {
  pointer-events: none;
}
.cal-day.today {
  border: 2px solid var(--primary);
  color: var(--primary);
  font-weight: 700;
}
.cal-day.selected {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

/* Calendar Status Dots */
.cal-day::after {
  content: '';
  position: absolute;
  bottom: 4px;
  left: 50%;
  transform: translateX(-50%);
  width: 4px;
  height: 4px;
  border-radius: 50%;
  display: none;
}
.cal-day.status-perfect::after { display: block; background: var(--success); }
.cal-day.status-partial::after { display: block; background: var(--warning); }
.cal-day.status-missed::after { display: block; background: var(--danger); }
.cal-day.status-holiday::after { display: block; background: var(--info); }

/* Calendar Legend */
.cal-legend {
  display: flex;
  justify-content: center;
  gap: 15px;
  margin-bottom: 20px;
}
.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
}
.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

/* Day Details */
.cal-day-details {
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: 16px;
  padding: 20px;
  animation: fadeIn 0.3s ease;
}
.details-title {
  font-size: 16px;
  margin-bottom: 15px;
  border-bottom: 1px solid var(--border-glass);
  padding-bottom: 10px;
}
.holiday-alert {
  background: rgba(59, 130, 246, 0.2);
  color: #60a5fa;
  padding: 12px;
  border-radius: 12px;
  margin-bottom: 15px;
  font-size: 14px;
}

/* Analytics Subject Stats */
.subject-stats-list {
  display: flex;
  flex-direction: column;
  gap: 15px;
}
.subject-stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: 16px;
  padding: 16px;
}
.subject-stat-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
}
.subject-stat-title {
  font-size: 16px;
  font-weight: 700;
}
.subject-stat-subtitle {
  font-size: 12px;
  color: var(--text-muted);
}
.subject-stat-value {
  font-size: 20px;
  font-weight: 700;
}
.progress-bar-bg {
  height: 8px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 8px;
}
.progress-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
}
.subject-stat-footer {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-muted);
}
.danger-text {
  color: var(--danger);
  font-weight: 600;
}
