/* 
  NEIS School Dashboard - Premium Glassmorphism Theme (Dark & Modern)
*/

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Outfit:wght@300;400;500;600;700;800&display=swap');

:root {
  /* Color Palette */
  --bg-gradient: linear-gradient(135deg, #0f172a 0%, #1e1b4b 50%, #020617 100%);
  --panel-bg: rgba(30, 41, 59, 0.45);
  --panel-border: rgba(255, 255, 255, 0.08);
  --panel-glow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
  --panel-blur: blur(12px);
  
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  
  --accent-primary: #6366f1; /* Indigo */
  --accent-primary-rgb: 99, 102, 241;
  --accent-secondary: #ec4899; /* Pink */
  --accent-success: #10b981; /* Emerald */
  --accent-warning: #f59e0b; /* Amber */
  --accent-info: #06b6d4; /* Cyan */
  
  --input-bg: rgba(15, 23, 42, 0.6);
  --input-border: rgba(255, 255, 255, 0.1);
  --input-focus-border: rgba(99, 102, 241, 0.5);
  
  --card-radius: 20px;
  --button-radius: 12px;
  
  --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Light Theme override (optional toggle support) */
body.light-theme {
  --bg-gradient: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 50%, #cbd5e1 100%);
  --panel-bg: rgba(255, 255, 255, 0.65);
  --panel-border: rgba(0, 0, 0, 0.08);
  --panel-glow: 0 8px 32px 0 rgba(148, 163, 184, 0.18);
  --panel-blur: blur(12px);
  
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  
  --accent-primary: #4f46e5;
  --accent-primary-rgb: 79, 70, 229;
  --accent-secondary: #db2777;
  --accent-success: #059669;
  --accent-warning: #d97706;
  --accent-info: #0891b2;
  
  --input-bg: rgba(255, 255, 255, 0.8);
  --input-border: rgba(0, 0, 0, 0.15);
}

/* Base resets */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg-gradient);
  background-attachment: fixed;
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.5;
  overflow-x: hidden;
  transition: var(--transition-smooth);
}

h1, h2, h3, h4, .font-outfit {
  font-family: 'Outfit', sans-serif;
  letter-spacing: -0.02em;
}

/* App Layout */
.app-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 2rem;
  min-height: 100vh;
}

/* Glassmorphism Panel Base */
.glass-panel {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: var(--card-radius);
  backdrop-filter: var(--panel-blur);
  -webkit-backdrop-filter: var(--panel-blur);
  box-shadow: var(--panel-glow);
  padding: 1.75rem;
  transition: var(--transition-smooth);
}

.glass-panel:hover {
  border-color: rgba(var(--accent-primary-rgb), 0.2);
  box-shadow: var(--panel-glow), 0 0 20px rgba(var(--accent-primary-rgb), 0.05);
}

/* Header */
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1.5rem;
  flex-wrap: wrap;
  position: relative;
  z-index: 100;
}

.logo-section {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.logo-section svg {
  color: var(--accent-primary);
  filter: drop-shadow(0 0 8px rgba(var(--accent-primary-rgb), 0.5));
}

.logo-title {
  font-size: 1.75rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--text-primary) 30%, var(--accent-primary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* Action Buttons */
.btn-icon {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--panel-border);
  color: var(--text-primary);
  width: 44px;
  height: 44px;
  border-radius: var(--button-radius);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.btn-icon:hover {
  background: rgba(var(--accent-primary-rgb), 0.15);
  border-color: var(--accent-primary);
  transform: translateY(-2px);
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-primary) 0%, #4f46e5 100%);
  color: #ffffff;
  border: none;
  padding: 0.75rem 1.5rem;
  font-size: 0.95rem;
  font-weight: 600;
  border-radius: var(--button-radius);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  box-shadow: 0 4px 14px rgba(var(--accent-primary-rgb), 0.3);
  transition: var(--transition-smooth);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(var(--accent-primary-rgb), 0.4);
}

/* Search Area */
.search-container {
  position: relative;
  flex: 1;
  max-width: 500px;
  min-width: 280px;
}

.search-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.search-input {
  width: 100%;
  padding: 0.85rem 1rem 0.85rem 3rem;
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: var(--button-radius);
  color: var(--text-primary);
  font-size: 0.95rem;
  transition: var(--transition-smooth);
}

.search-input:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(var(--accent-primary-rgb), 0.2);
}

.search-icon {
  position: absolute;
  left: 1rem;
  color: var(--text-muted);
  pointer-events: none;
  transition: var(--transition-smooth);
}

.search-input:focus + .search-icon {
  color: var(--accent-primary);
}

/* Autocomplete Suggestion List */
.suggestions-list {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid var(--panel-border);
  border-radius: var(--button-radius);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5);
  max-height: 300px;
  overflow-y: auto;
  z-index: 9999;
  display: none;
}

.suggestions-list.active {
  display: block;
  animation: slideDown 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.suggestion-item {
  padding: 0.85rem 1.25rem;
  cursor: pointer;
  transition: var(--transition-smooth);
  display: flex;
  flex-direction: column;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.suggestion-item:last-child {
  border-bottom: none;
}

.suggestion-item:hover {
  background: rgba(var(--accent-primary-rgb), 0.15);
}

.suggestion-name {
  font-weight: 600;
  color: var(--text-primary);
}

.suggestion-desc {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 0.25rem;
}

/* Dashboard Grid Layout */
.dashboard-grid {
  display: grid;
  grid-template-columns: 350px 1fr;
  gap: 1.5rem;
}

.side-column {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.main-column {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* Dashboard Info Cards */
.info-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  padding-bottom: 0.75rem;
}

.info-header h2 {
  font-size: 1.25rem;
  font-weight: 700;
}

.info-header svg {
  color: var(--accent-primary);
}

/* School Info Widget */
.school-details {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.detail-item {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.detail-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}

.detail-value {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-primary);
}

.detail-value a {
  color: var(--accent-primary);
  text-decoration: none;
  transition: var(--transition-smooth);
}

.detail-value a:hover {
  text-decoration: underline;
  color: var(--accent-secondary);
}

.school-badges {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 0.5rem;
}

.badge {
  padding: 0.35rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-indigo {
  background: rgba(99, 102, 241, 0.15);
  color: #818cf8;
  border: 1px solid rgba(99, 102, 241, 0.2);
}

.badge-pink {
  background: rgba(236, 72, 153, 0.15);
  color: #f472b6;
  border: 1px solid rgba(236, 72, 153, 0.2);
}

/* Meal Widget */
.widget-header-with-tabs {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.25rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  padding-bottom: 0.75rem;
}

.tab-controls {
  display: flex;
  background: rgba(0, 0, 0, 0.2);
  padding: 0.25rem;
  border-radius: var(--button-radius);
  border: 1px solid var(--panel-border);
}

.tab-btn {
  background: transparent;
  border: none;
  padding: 0.45rem 1rem;
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 0.85rem;
  border-radius: 8px;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.tab-btn:hover {
  color: var(--text-primary);
}

.tab-btn.active {
  background: var(--accent-primary);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(var(--accent-primary-rgb), 0.3);
}

/* Meal Card Content */
.meal-container {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
}

.meal-container.grid-layout {
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

.meal-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: var(--button-radius);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  transition: var(--transition-smooth);
}

.meal-card:hover {
  background: rgba(255, 255, 255, 0.04);
  transform: translateY(-2px);
}

.meal-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.meal-date {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-primary);
}

.meal-type {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.25rem 0.5rem;
  border-radius: 6px;
  background: rgba(6, 182, 212, 0.15);
  color: #22d3ee;
}

.meal-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.meal-item {
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.meal-item-emoji {
  font-size: 1.1rem;
}

.meal-nutrition {
  margin-top: 0.5rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  border-top: 1px dashed rgba(255, 255, 255, 0.05);
  padding-top: 0.75rem;
  display: flex;
  justify-content: space-between;
}

.meal-calories {
  font-weight: 600;
  color: var(--accent-warning);
}

/* Schedule Widget (Academic Calendar) */
.schedule-list {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  position: relative;
}

.schedule-list::before {
  content: '';
  position: absolute;
  left: 15px;
  top: 5px;
  bottom: 5px;
  width: 2px;
  background: rgba(255, 255, 255, 0.05);
}

.schedule-item {
  display: flex;
  gap: 1.25rem;
  position: relative;
}

.schedule-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--text-muted);
  border: 3px solid rgba(15, 23, 42, 1);
  position: relative;
  left: 10px;
  top: 6px;
  z-index: 2;
  transition: var(--transition-smooth);
}

.schedule-item.today .schedule-dot {
  background: var(--accent-secondary);
  box-shadow: 0 0 10px var(--accent-secondary);
}

.schedule-item.upcoming .schedule-dot {
  background: var(--accent-primary);
}

.schedule-content {
  flex: 1;
  padding-left: 0.5rem;
}

.schedule-date {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
}

.schedule-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
}

.schedule-desc {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 0.15rem;
}

/* Timetable Widget */
.timetable-controls {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

.select-custom {
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  color: var(--text-primary);
  padding: 0.5rem 2rem 0.5rem 0.75rem;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2394a3b8' stroke-width='2'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M19.5 8.25l-7.5 7.5-7.5-7.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  background-size: 1rem;
  transition: var(--transition-smooth);
}

.select-custom:focus {
  outline: none;
  border-color: var(--accent-primary);
}

.timetable-grid {
  display: grid;
  grid-template-columns: 60px repeat(5, 1fr);
  gap: 0.5rem;
  overflow-x: auto;
}

.timetable-header-cell {
  text-align: center;
  padding: 0.75rem 0.5rem;
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--text-secondary);
  border-bottom: 2px solid rgba(255, 255, 255, 0.05);
}

.timetable-period-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--text-muted);
  background: rgba(0, 0, 0, 0.1);
  border-radius: 8px;
  height: 60px;
}

.timetable-cell {
  background: rgba(255, 255, 255, 0.02);
  border: 1px dashed rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0.5rem;
  min-height: 60px;
  transition: var(--transition-smooth);
}

.timetable-cell:hover {
  background: rgba(255, 255, 255, 0.05);
  border-style: solid;
  transform: scale(1.02);
}

.timetable-subject {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-primary);
  text-align: center;
}

.timetable-teacher {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}

/* Coloring classes for different school subjects */
.subj-korean { background: rgba(239, 68, 68, 0.15); color: #f87171; border: 1px solid rgba(239, 68, 68, 0.25); }
.subj-math { background: rgba(59, 130, 246, 0.15); color: #60a5fa; border: 1px solid rgba(59, 130, 246, 0.25); }
.subj-english { background: rgba(16, 185, 129, 0.15); color: #34d399; border: 1px solid rgba(16, 185, 129, 0.25); }
.subj-science { background: rgba(245, 158, 11, 0.15); color: #fbbf24; border: 1px solid rgba(245, 158, 11, 0.25); }
.subj-social { background: rgba(139, 92, 246, 0.15); color: #a78bfa; border: 1px solid rgba(139, 92, 246, 0.25); }
.subj-art { background: rgba(236, 72, 153, 0.15); color: #f472b6; border: 1px solid rgba(236, 72, 153, 0.25); }
.subj-pe { background: rgba(6, 182, 212, 0.15); color: #22d3ee; border: 1px solid rgba(6, 182, 212, 0.25); }
.subj-special { background: rgba(100, 116, 139, 0.15); color: #94a3b8; border: 1px solid rgba(100, 116, 139, 0.25); }

/* Api Settings Modal */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

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

.modal-content {
  width: 90%;
  max-width: 500px;
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--card-radius);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7);
  padding: 2rem;
  transform: scale(0.95);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

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

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h3 {
  font-size: 1.5rem;
  font-weight: 700;
}

.modal-close {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-smooth);
}

.modal-close:hover {
  color: var(--text-primary);
}

.modal-body {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

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

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

.form-input {
  width: 100%;
  padding: 0.75rem 1rem;
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: var(--button-radius);
  color: var(--text-primary);
  font-size: 0.9rem;
  transition: var(--transition-smooth);
}

.form-input:focus {
  outline: none;
  border-color: var(--accent-primary);
}

.form-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.form-hint a {
  color: var(--accent-primary);
  text-decoration: none;
}

.form-hint a:hover {
  text-decoration: underline;
}

.toggle-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255, 255, 255, 0.02);
  padding: 0.75rem 1rem;
  border-radius: var(--button-radius);
  border: 1px solid var(--panel-border);
}

.toggle-label {
  display: flex;
  flex-direction: column;
}

.toggle-title {
  font-size: 0.9rem;
  font-weight: 600;
}

.toggle-desc {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Switch element */
.switch {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 24px;
}

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

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--text-muted);
  transition: .4s;
  border-radius: 34px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .4s;
  border-radius: 50%;
}

input:checked + .slider {
  background-color: var(--accent-primary);
}

input:checked + .slider:before {
  transform: translateX(24px);
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 0.5rem;
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--panel-border);
  color: var(--text-primary);
  padding: 0.75rem 1.25rem;
  font-size: 0.9rem;
  font-weight: 600;
  border-radius: var(--button-radius);
  cursor: pointer;
  transition: var(--transition-smooth);
}

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

/* Toast Notification */
.toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid var(--panel-border);
  border-radius: var(--button-radius);
  padding: 1rem 1.5rem;
  color: var(--text-primary);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(10px);
  z-index: 10000;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.toast.active {
  transform: translateY(0);
  opacity: 1;
}

.toast-success svg { color: var(--accent-success); }
.toast-error svg { color: var(--accent-secondary); }
.toast-info svg { color: var(--accent-primary); }

/* Animation keyframes */
@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* Loading skeleton */
.skeleton {
  background: linear-gradient(90deg, rgba(255,255,255,0.03) 25%, rgba(255,255,255,0.08) 50%, rgba(255,255,255,0.03) 75%);
  background-size: 200% 100%;
  animation: loadingSkeleton 1.5s infinite;
  border-radius: 8px;
}

@keyframes loadingSkeleton {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.skeleton-text {
  height: 1rem;
  margin-bottom: 0.5rem;
}

.skeleton-text.short {
  width: 60%;
}

.skeleton-card {
  height: 120px;
}

/* No data state styling */
.no-data-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4rem 2rem;
  text-align: center;
  color: var(--text-secondary);
}

.no-data-panel svg {
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.no-data-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.no-data-desc {
  font-size: 0.9rem;
  max-width: 400px;
}

/* Responsive adjustments */
@media (max-width: 968px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
  
  .app-container {
    padding: 1.5rem 1rem;
  }
}

@media (max-width: 640px) {
  header {
    flex-direction: column;
    align-items: stretch;
  }
  
  .search-container {
    max-width: 100%;
  }
  
  .header-actions {
    justify-content: space-between;
  }
  
  .timetable-grid {
    grid-template-columns: 50px repeat(5, 120px);
  }
}
