/* Core Variables & Reset */
:root {
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --primary-light: #e0e7ff;
  --secondary: #0ea5e9;
  --secondary-hover: #0284c7;
  --success: #10b981;
  --success-light: #d1fae5;
  --warning: #f59e0b;
  --warning-light: #fef3c7;
  --danger: #ef4444;
  --danger-light: #fee2e2;
  --dark: #0f172a;
  --text: #334155;
  --text-muted: #64748b;
  --bg: #f8fafc;
  --card-bg: rgba(255, 255, 255, 0.85);
  --border: rgba(226, 232, 240, 0.8);
  --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.05);
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -4px rgba(0, 0, 0, 0.05);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.05), 0 8px 10px -6px rgba(0, 0, 0, 0.05);
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 20px;
  --font-title: 'Outfit', sans-serif;
  --font-body: 'Plus Jakarta Sans', sans-serif;
}

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

body {
  font-family: var(--font-body);
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
  padding-bottom: 60px;
}

/* Background Blurs */
.bg-blur {
  position: absolute;
  width: 500px;
  height: 500px;
  border-radius: 50%;
  filter: blur(140px);
  z-index: -1;
  opacity: 0.4;
  pointer-events: none;
  animation: float 20s ease-in-out infinite alternate;
}

.bg-blur-1 {
  background: radial-gradient(circle, #818cf8 0%, #c7d2fe 100%);
  top: -100px;
  right: -100px;
}

.bg-blur-2 {
  background: radial-gradient(circle, #38bdf8 0%, #bae6fd 100%);
  bottom: 100px;
  left: -200px;
  animation-delay: -10s;
}

@keyframes float {
  0% { transform: translate(0, 0) scale(1); }
  100% { transform: translate(60px, 40px) scale(1.1); }
}

/* Layout Utilities */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Card Style (Glassmorphism) */
.card {
  background: var(--card-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 30px;
  margin-bottom: 25px;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

/* Header */
.app-header {
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 15px 0;
}

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

.brand {
  display: flex;
  align-items: center;
  gap: 15px;
}

.brand-logo-img {
  height: 48px;
  width: auto;
  object-fit: contain;
  border-radius: 8px;
}

.brand-text h1 {
  font-family: var(--font-title);
  font-size: 22px;
  font-weight: 700;
  color: var(--dark);
  line-height: 1.1;
}

.brand-text p {
  font-size: 13px;
  color: var(--text-muted);
}

/* Real-time Badge */
.realtime-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 30px;
  font-size: 13px;
  font-weight: 600;
  transition: all 0.3s ease;
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.status-online {
  background-color: var(--success-light);
  color: var(--success);
}
.status-online .pulse-dot {
  background-color: var(--success);
  animation: pulse 1.5s infinite;
}

.status-connecting {
  background-color: var(--warning-light);
  color: var(--warning);
}
.status-connecting .pulse-dot {
  background-color: var(--warning);
  animation: pulse-warn 1.5s infinite;
}

.status-offline {
  background-color: var(--danger-light);
  color: var(--danger);
}
.status-offline .pulse-dot {
  background-color: var(--danger);
}

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
  70% { box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
  100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

@keyframes pulse-warn {
  0% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.7); }
  70% { box-shadow: 0 0 0 6px rgba(245, 158, 11, 0); }
  100% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0); }
}

/* Intro Section */
.intro-grid {
  display: grid;
  grid-template-columns: 1.2fr 1.8fr;
  gap: 30px;
  align-items: center;
}

.intro-text h2 {
  font-family: var(--font-title);
  font-size: 26px;
  color: var(--dark);
  margin-bottom: 12px;
}

.intro-text p {
  color: var(--text-muted);
  font-size: 15px;
}

.regulations {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.reg-item {
  display: flex;
  align-items: flex-start;
  gap: 15px;
  background: white;
  padding: 15px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.reg-icon {
  font-size: 24px;
  line-height: 1;
}

.reg-desc {
  font-size: 14px;
  color: var(--text);
}

.reg-desc strong {
  color: var(--dark);
}

/* Filters Section */
.section-title {
  font-family: var(--font-title);
  font-size: 20px;
  color: var(--dark);
  font-weight: 700;
  margin-bottom: 15px;
}

.filters-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)) auto;
  gap: 20px;
  align-items: flex-end;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.filter-group label {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
}

.filter-select {
  width: 100%;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid #cbd5e1;
  background-color: white;
  font-family: var(--font-body);
  font-size: 15px;
  color: var(--dark);
  outline: none;
  cursor: pointer;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.filter-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}

.filter-select:disabled {
  background-color: #f1f5f9;
  cursor: not-allowed;
  color: var(--text-muted);
}

.filter-actions {
  display: flex;
}

/* Buttons */
.btn {
  padding: 12px 24px;
  border-radius: var(--radius-sm);
  border: none;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: all 0.2s ease;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  color: white;
  box-shadow: 0 4px 10px rgba(79, 70, 229, 0.2);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 15px rgba(79, 70, 229, 0.3);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-secondary {
  background-color: #e2e8f0;
  color: var(--text);
}

.btn-secondary:hover {
  background-color: #cbd5e1;
}

/* Toast alert */
.update-toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--dark);
  color: white;
  padding: 14px 24px;
  border-radius: var(--radius);
  box-shadow: var(--shadow-xl);
  font-size: 14px;
  font-weight: 600;
  z-index: 1000;
  animation: slideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  transition: opacity 0.5s ease;
}

.update-toast.hidden {
  opacity: 0;
  pointer-events: none;
}

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

/* Timetable Section */
.timetable-section {
  margin-bottom: 40px;
}

.section-header {
  margin-bottom: 20px;
  text-align: center;
}

.section-subtitle {
  color: var(--text-muted);
  font-size: 15px;
}

/* Loading State */
.loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 0;
  gap: 15px;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid var(--primary-light);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 1s infinite linear;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 60px 40px;
}

.empty-icon {
  font-size: 50px;
  margin-bottom: 15px;
  line-height: 1;
}

.empty-state h4 {
  font-family: var(--font-title);
  font-size: 18px;
  color: var(--dark);
  margin-bottom: 8px;
}

.empty-state p {
  color: var(--text-muted);
  font-size: 14px;
  max-width: 400px;
  margin: 0 auto;
}

/* Timetable List & Card View (Desktop & Mobile) */
.timetable-list-view {
  width: 100%;
}

.classes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 25px;
}

.class-list-card {
  background: var(--card-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  display: flex;
  flex-direction: column;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.class-list-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: rgba(79, 70, 229, 0.3);
}

.card-badge-row {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.class-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 30px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-danghoc {
  background-color: var(--success-light);
  color: var(--success);
}

.badge-xinmo {
  background-color: var(--warning-light);
  color: var(--warning);
}

.goal-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
}

.goal-basic {
  background-color: #e0f2fe;
  color: #0369a1;
  border: 1px solid #bae6fd;
}

.goal-advanced {
  background-color: #fef3c7;
  color: #d97706;
  border: 1px solid #fde68a;
}

.goal-cappt {
  background-color: #ffe4e6;
  color: #e11d48;
  border: 1px solid #fecdd3;
}

.goal-elite {
  background-color: #f3e8ff;
  color: #7c3aed;
  border: 1px solid #e9d5ff;
}

.goal-combo {
  background-color: #ecfdf5;
  color: #059669;
  border: 1px solid #a7f3d0;
}

.goal-default {
  background-color: #f1f5f9;
  color: #475569;
  border: 1px solid #e2e8f0;
}

.class-subject-title {
  font-family: var(--font-title);
  font-size: 22px;
  color: var(--dark);
  font-weight: 800;
  margin-bottom: 4px;
}

.class-full-name {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 15px;
  font-style: italic;
  word-break: break-all;
}

.class-times-container {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 15px;
  margin-bottom: 20px;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.times-header {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.class-day-group {
  margin-bottom: 12px;
  border-bottom: 1px dashed #e2e8f0;
  padding-bottom: 12px;
}

.class-day-group:last-child {
  margin-bottom: 0;
  border-bottom: none;
  padding-bottom: 0;
}

.time-day {
  font-weight: 800;
  color: var(--dark);
  font-size: 14px;
  margin-bottom: 6px;
}

.day-sessions-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.class-time-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
}

.time-ca-label {
  font-weight: 600;
  color: var(--text-muted);
  font-size: 13px;
  min-width: 45px;
}

.time-hours {
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
  font-family: var(--font-title);
  flex-grow: 1;
}

.slot-status-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  text-align: center;
  white-space: nowrap;
}

.class-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: auto;
  border-top: 1px dashed var(--border);
  padding-top: 15px;
}

.operation-mode {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
}

.btn-sm {
  padding: 8px 16px;
  font-size: 13px;
  border-radius: var(--radius-sm);
}

/* Consultation Form Section */
.consultation-section {
  background: linear-gradient(to bottom right, #ffffff, #f0f4ff);
}

.consultation-header {
  text-align: center;
  margin-bottom: 25px;
}

.consultation-header h2 {
  font-family: var(--font-title);
  font-size: 26px;
  color: var(--dark);
  margin-bottom: 8px;
}

.consultation-header p {
  color: var(--text-muted);
  font-size: 14px;
  max-width: 700px;
  margin: 0 auto;
}

.consultation-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-group label {
  font-size: 14px;
  font-weight: 600;
  color: var(--dark);
}

.form-group label .required {
  color: var(--danger);
}

.form-group input,
.form-group textarea {
  width: 100%;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid #cbd5e1;
  background-color: white;
  font-family: var(--font-body);
  font-size: 15px;
  color: var(--dark);
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-group input:focus,
.form-group textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}

.form-actions {
  display: flex;
  justify-content: center;
  margin-top: 10px;
}

.btn-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid white;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  display: inline-block;
}

.hidden {
  display: none !important;
}

/* Success Message styling */
.form-success {
  text-align: center;
  padding: 30px 10px;
  animation: scaleUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes scaleUp {
  from { transform: scale(0.95); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.success-icon {
  width: 64px;
  height: 64px;
  background-color: var(--success-light);
  color: var(--success);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  margin: 0 auto 20px;
  box-shadow: 0 4px 10px rgba(16, 185, 129, 0.2);
}

.form-success h3 {
  font-family: var(--font-title);
  font-size: 22px;
  color: var(--dark);
  margin-bottom: 10px;
}

.form-success p {
  color: var(--text-muted);
  font-size: 15px;
  max-width: 500px;
  margin: 0 auto 25px;
}

/* Footer styling */
.app-footer {
  text-align: center;
  padding: 30px 0;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 13px;
  margin-top: 60px;
  background-color: rgba(255, 255, 255, 0.5);
  backdrop-filter: blur(8px);
  width: 100%;
}

.footer-note {
  font-size: 11px;
  margin-top: 5px;
  opacity: 0.8;
}

/* Mobile Responsive Optimization */
@media (max-width: 768px) {
  .filters-grid {
    grid-template-columns: 1fr;
    gap: 15px;
  }
  
  .intro-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }
  
  .classes-grid {
    grid-template-columns: 1fr;
    gap: 15px;
  }
  
  .class-list-card {
    padding: 16px;
  }
  
  .card {
    padding: 20px;
  }
  
  .section-title {
    font-size: 18px;
  }
  
  .app-header {
    padding: 10px 0;
  }
  
  .logo {
    width: 40px;
    height: 40px;
    font-size: 18px;
    border-radius: 8px;
  }
  
  .brand-text h1 {
    font-size: 18px;
  }
  
  .brand-text p {
    font-size: 11px;
  }
}

