/* Core Components & Global Layout */
@import './variables.css';
@import './reset.css';

/* Layout Container */
.app-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem 4rem;
  position: relative;
}

/* Header Bar */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-light);
  padding: 0.85rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 800;
  font-size: 1.15rem;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  white-space: nowrap;
  flex-shrink: 0;
  cursor: pointer;
}

.logo-badge {
  width: 32px;
  height: 32px;
  background: var(--brand-black);
  color: #fff;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1rem;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.15);
}

.brand-sub {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-muted);
  background: var(--bg-subtle);
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-light);
}

/* Navigation Menu */
.nav-menu {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--bg-subtle);
  padding: 0.25rem 0.35rem;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-light);
}

.nav-link {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-secondary);
  padding: 0.45rem 1rem;
  border-radius: var(--radius-full);
  transition: var(--transition-fast);
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.nav-link:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.7);
}

.nav-link.active {
  background: var(--brand-black);
  color: #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
}

/* Header Right Actions */
.header-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: #fff;
  border: 1px solid var(--border-light);
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 600;
  box-shadow: var(--shadow-xs);
}

.point-pill {
  background: var(--color-amber-light);
  color: #B45309;
  border: 1px solid #FDE68A;
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.streak-pill {
  background: var(--color-coral-light);
  color: #B91C1C;
  border: 1px solid #FECACA;
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.2rem;
}

/* Common Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-weight: 600;
  font-size: 0.875rem;
  padding: 0.55rem 1.15rem;
  border-radius: var(--radius-full);
  transition: var(--transition-base);
  user-select: none;
}

.btn-primary {
  background: var(--brand-black);
  color: #fff;
}

.btn-primary:hover {
  background: #272B33;
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.btn-secondary {
  background: #fff;
  color: var(--text-primary);
  border: 1px solid var(--border-light);
}

.btn-secondary:hover {
  background: var(--bg-subtle);
  border-color: #D1D5DB;
}

.btn-mode-toggle {
  background: var(--brand-black);
  color: #fff;
  font-size: 0.8rem;
  padding: 0.4rem 0.85rem;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  gap: 0.4rem;
  transition: var(--transition-fast);
}

.btn-mode-toggle.teacher-active {
  background: #4F46E5;
}

.btn-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  font-size: 1rem;
  transition: var(--transition-fast);
}

.btn-icon:hover {
  background: #ECEFF1;
}

/* Base Cards */
.card {
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  border: 1px solid var(--border-light);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  transition: var(--transition-base);
}

.card-interactive:hover {
  box-shadow: var(--shadow-md);
  border-color: #D1D5DB;
  transform: translateY(-2px);
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-full);
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.badge-green {
  background: var(--color-emerald-light);
  color: #047857;
  border: 1px solid #A7F3D0;
}

.badge-orange {
  background: var(--color-amber-light);
  color: #B45309;
  border: 1px solid #FDE68A;
}

.badge-gray {
  background: var(--bg-subtle);
  color: var(--text-secondary);
  border: 1px solid var(--border-light);
}

.badge-blue {
  background: var(--color-blue-light);
  color: #1D4ED8;
  border: 1px solid #BFDBFE;
}

.badge-purple {
  background: var(--color-purple-light);
  color: #6D28D9;
  border: 1px solid #DDD6FE;
}

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

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

.modal-content {
  background: #fff;
  border-radius: var(--radius-xl);
  max-width: 520px;
  width: 100%;
  padding: 2rem;
  box-shadow: var(--shadow-lg);
  transform: scale(0.95);
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  text-align: center;
  position: relative;
}

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

/* Toast Notification */
.toast-container {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 999;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
}

.toast {
  background: var(--brand-black);
  color: #fff;
  padding: 0.8rem 1.25rem;
  border-radius: var(--radius-lg);
  font-size: 0.875rem;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 0.6rem;
  animation: slideUpToast 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  pointer-events: auto;
}

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

/* Responsive adjustments */
@media (max-width: 900px) {
  .site-header {
    flex-wrap: wrap;
    padding: 0.75rem 1rem;
  }
  .nav-menu {
    order: 3;
    width: 100%;
    justify-content: space-around;
    overflow-x: auto;
  }
  .app-container {
    padding: 0 1rem 3rem;
  }
}

/* =========================================
   RESPONSIVE DESIGN IMPROVEMENTS 
========================================= */
@media (max-width: 768px) {
  .hero-title {
    font-size: 2.2rem !important;
  }
  .podium-container {
    flex-direction: column !important;
    gap: 1.5rem !important;
    align-items: center !important;
  }
  .podium-card {
    width: 100% !important;
    max-width: 320px !important;
    transform: none !important;
  }
  .podium-1st {
    order: -1; /* Always show 1st place on top in mobile */
  }
  .category-nav-pills {
    flex-wrap: wrap !important;
  }
  .dashboard-grid {
    grid-template-columns: 1fr !important;
  }
  .hero-floating-card {
    margin-top: 1.5rem !important;
    width: 100% !important;
  }
  header .container {
    flex-direction: column !important;
    gap: 1rem !important;
  }
  header nav {
    width: 100% !important;
    justify-content: center !important;
    flex-wrap: wrap !important;
  }
  .modal-content {
    margin: 1rem !important;
    width: auto !important;
  }
}
