/* Custom styling for the Class 9 Math Simulations Portal */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;600;700&display=swap');

:root {
  --bg-dark: #070a13;
  --bg-card: rgba(21, 28, 48, 0.6);
  --bg-glass: rgba(15, 23, 42, 0.75);
  --border-color: rgba(255, 255, 255, 0.08);
  --border-glow: rgba(249, 115, 22, 0.2);
  
  --primary: #fb923c;
  --primary-hover: #ea580c;
  --primary-rgb: 251, 146, 60;
  
  --accent-purple: #a855f7;
  --accent-emerald: #10b981;
  --accent-blue: #3b82f6;
  
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  
  --font-sans: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  
  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Base Styles & Reset */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--bg-dark);
  background-image: 
    radial-gradient(circle at 10% 20%, rgba(249, 115, 22, 0.05) 0%, transparent 40%),
    radial-gradient(circle at 90% 80%, rgba(168, 85, 247, 0.05) 0%, transparent 45%),
    radial-gradient(circle at 50% 50%, rgba(15, 23, 42, 0.5) 0%, rgba(7, 10, 19, 1) 100%);
  background-attachment: fixed;
  color: var(--text-primary);
  font-family: var(--font-sans);
  min-height: 100vh;
  line-height: 1.5;
  overflow-x: hidden;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
::-webkit-scrollbar-track {
  background: rgba(15, 23, 42, 0.3);
}
::-webkit-scrollbar-thumb {
  background: rgba(249, 115, 22, 0.4);
  border: 2px solid var(--bg-dark);
  border-radius: 5px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--primary);
}

/* Layout container */
.container {
  width: 100%;
  max-width: 1300px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

/* Header / Hero Section */
.hero {
  text-align: center;
  margin-bottom: 3rem;
  animation: fadeInDown var(--transition-slow);
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(249, 115, 22, 0.1);
  border: 1px solid rgba(249, 115, 22, 0.2);
  color: var(--primary);
  padding: 0.5rem 1.25rem;
  border-radius: 9999px;
  font-weight: 600;
  font-size: 0.9rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 1.25rem;
  backdrop-filter: blur(4px);
}

.hero h1 {
  font-size: clamp(2.2rem, 5vw, 3.8rem);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.03em;
  background: linear-gradient(135deg, #fff 30%, #ffd4b2 70%, var(--primary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 1rem;
}

.hero p {
  color: var(--text-secondary);
  font-size: clamp(1.05rem, 2vw, 1.25rem);
  max-width: 700px;
  margin: 0 auto 2.5rem auto;
  font-weight: 300;
  line-height: 1.6;
}

/* Site Header / APMF Branding Banner */
.site-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1.5rem;
  padding: 1.25rem 2rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 1.25rem;
  margin-bottom: 2.5rem;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
  animation: fadeInDown var(--transition-slow);
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.site-logo {
  width: 52px;
  height: 52px;
  object-fit: cover;
  transition: transform var(--transition-fast);
}

.site-logo:hover {
  transform: scale(1.08) rotate(1deg);
}

.brand-text {
  display: flex;
  flex-direction: column;
  text-align: left;
}

.brand-title {
  font-size: clamp(1.1rem, 2.5vw, 1.4rem);
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.brand-sub {
  font-size: 0.8rem;
  color: var(--primary);
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.president-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  font-size: 0.9rem;
}

.president-name {
  font-weight: 700;
  color: var(--text-primary);
}

.president-title {
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.04);
  padding: 0.25rem 0.65rem;
  border-radius: 9999px;
  border: 1px solid var(--border-color);
  font-size: 0.8rem;
  font-weight: 500;
}

.president-phone {
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
  padding: 0.25rem 0.65rem;
  background: rgba(249, 115, 22, 0.1);
  border: 1px solid rgba(249, 115, 22, 0.2);
  border-radius: 9999px;
  transition: background var(--transition-fast), border-color var(--transition-fast);
}

.president-phone:hover {
  background: rgba(249, 115, 22, 0.2);
  border-color: var(--primary);
}

@media (max-width: 768px) {
  .site-header {
    flex-direction: column;
    align-items: stretch;
    text-align: center;
    padding: 1.5rem;
  }
  .header-brand {
    flex-direction: column;
    text-align: center;
    gap: 0.75rem;
  }
  .brand-text {
    text-align: center;
  }
  .president-info {
    justify-content: center;
    flex-direction: column;
    gap: 0.5rem;
  }
}

/* Metrics / Progress Hub */
.progress-panel {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: 1.25rem;
  padding: 1.5rem 2rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  margin-bottom: 3rem;
  box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.3);
  animation: fadeInUp var(--transition-slow);
}

.progress-info {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.progress-radial {
  position: relative;
  width: 70px;
  height: 70px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.progress-radial svg {
  transform: rotate(-90deg);
  width: 100%;
  height: 100%;
}

.progress-radial circle {
  fill: none;
  stroke-width: 6;
}

.progress-radial .bg {
  stroke: rgba(255, 255, 255, 0.05);
}

.progress-radial .bar {
  stroke: var(--primary);
  stroke-dasharray: 201; /* 2 * pi * r (r=32) */
  stroke-dashoffset: 201;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.progress-percentage {
  position: absolute;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
  font-family: var(--font-mono);
}

.progress-text h3 {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.progress-text p {
  font-size: 0.95rem;
  color: var(--text-secondary);
}

/* Filter / Search Bar Controls */
.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  width: 100%;
  max-width: 600px;
}

.search-box {
  position: relative;
  flex: 1 1 250px;
}

.search-box input {
  width: 100%;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 0.85rem 1rem 0.85rem 2.75rem;
  border-radius: 0.75rem;
  font-family: var(--font-sans);
  font-size: 1rem;
  font-weight: 500;
  transition: var(--transition-fast);
}

.search-box input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--border-glow);
  background: rgba(15, 23, 42, 0.8);
}

.search-box svg {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
  transition: var(--transition-fast);
}

.search-box input:focus + svg {
  color: var(--primary);
}

/* Category Filter Tabs */
.filter-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 2.5rem;
  animation: fadeInUp var(--transition-slow);
}

.filter-tab {
  background: rgba(15, 23, 42, 0.5);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 0.6rem 1.25rem;
  border-radius: 0.75rem;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: var(--transition-fast);
}

.filter-tab:hover {
  background: rgba(30, 41, 59, 0.6);
  color: var(--text-primary);
}

.filter-tab.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #000;
  font-weight: 700;
  box-shadow: 0 4px 15px rgba(251, 146, 60, 0.3);
}

/* Simulations Grid */
.sim-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 2rem;
  margin-bottom: 4rem;
  animation: fadeIn var(--transition-slow);
}

/* Individual Card Styling */
.sim-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 1.25rem;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  height: 100%;
  transition: var(--transition-normal);
  position: relative;
}

.sim-card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 1.25rem;
  padding: 1.5px;
  background: linear-gradient(180deg, rgba(255,255,255,0.08), rgba(255,255,255,0.02));
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}

.sim-card:hover {
  transform: translateY(-6px);
  border-color: var(--primary-glow);
  box-shadow: 
    0 15px 35px -10px rgba(0, 0, 0, 0.4),
    0 0 20px -5px var(--border-glow);
  background: rgba(28, 37, 63, 0.7);
}

.sim-card:hover::before {
  background: linear-gradient(135deg, var(--primary), transparent 60%);
}

.card-header-visual {
  height: 140px;
  background: rgba(15, 23, 42, 0.8);
  border-bottom: 1px solid var(--border-color);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.card-header-visual svg.math-icon {
  width: 100%;
  height: 100%;
  max-height: 120px;
  color: var(--primary);
  opacity: 0.85;
  transition: var(--transition-normal);
}

.sim-card:hover .card-header-visual svg.math-icon {
  transform: scale(1.08);
  opacity: 1;
}

.card-content {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

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

.chapter-badge {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--primary);
  background: rgba(251, 146, 60, 0.1);
  padding: 0.25rem 0.65rem;
  border-radius: 0.5rem;
  border: 1px solid rgba(251, 146, 60, 0.15);
}

.category-tag {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.25rem 0.5rem;
  border-radius: 0.35rem;
}

.tag-algebra { color: #f472b6; background: rgba(244, 114, 182, 0.1); }
.tag-geometry { color: #60a5fa; background: rgba(96, 165, 250, 0.1); }
.tag-mensuration { color: #fbbf24; background: rgba(251, 191, 36, 0.1); }
.tag-statistics { color: #34d399; background: rgba(52, 211, 153, 0.1); }

.sim-card h2 {
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 0.5rem;
  color: var(--text-primary);
}

.sim-card p {
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.5;
  margin-bottom: 1.25rem;
  flex-grow: 1;
}

/* Master Checkbox */
.mastery-checkbox {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
  user-select: none;
  cursor: pointer;
  font-size: 0.9rem;
  color: var(--text-secondary);
  font-weight: 500;
  transition: var(--transition-fast);
}

.mastery-checkbox:hover {
  color: var(--text-primary);
}

.mastery-checkbox input {
  display: none;
}

.checkbox-custom {
  width: 18px;
  height: 18px;
  border: 2px solid var(--text-muted);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-fast);
}

.mastery-checkbox input:checked + .checkbox-custom {
  border-color: var(--accent-emerald);
  background-color: var(--accent-emerald);
}

.checkbox-custom svg {
  width: 12px;
  height: 12px;
  color: #000;
  font-weight: 800;
  display: none;
}

.mastery-checkbox input:checked + .checkbox-custom svg {
  display: block;
}

.mastery-checkbox.checked-label {
  color: var(--accent-emerald);
}

/* Card Actions */
.card-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: auto;
}

.btn {
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 0.95rem;
  text-decoration: none;
  border-radius: 0.75rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  cursor: pointer;
  transition: var(--transition-fast);
  border: none;
}

.btn-primary {
  flex-grow: 1.5;
  background: var(--primary);
  color: #000;
  padding: 0.75rem 1rem;
}

.btn-primary:hover {
  background: var(--primary-hover);
  box-shadow: 0 4px 15px rgba(251, 146, 60, 0.25);
}

.btn-secondary {
  flex-grow: 1;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 0.75rem 1rem;
}

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

/* In-App Simulation Overlay Modal */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(5, 7, 13, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity var(--transition-normal);
  padding: 1.5rem;
}

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

.overlay-container {
  width: 100%;
  max-width: 1100px;
  height: 85vh;
  max-height: 800px;
  background: var(--bg-dark);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 1.25rem;
  box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.8);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateY(40px) scale(0.95);
  transition: transform var(--transition-normal);
  position: relative;
}

.overlay.active .overlay-container {
  transform: translateY(0) scale(1);
}

.overlay-header {
  padding: 1rem 1.5rem;
  background: rgba(15, 23, 42, 0.9);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.overlay-title {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.overlay-title h2 {
  font-size: 1.25rem;
  font-weight: 700;
}

.overlay-title .chapter-badge {
  font-size: 0.7rem;
  padding: 0.15rem 0.5rem;
}

.overlay-controls {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.overlay-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  width: 38px;
  height: 38px;
  border-radius: 0.50rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition-fast);
}

.overlay-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
  border-color: rgba(255, 255, 255, 0.2);
}

.overlay-btn.btn-close:hover {
  background: rgba(239, 68, 68, 0.2);
  color: #ef4444;
  border-color: rgba(239, 68, 68, 0.3);
}

.overlay-body {
  flex-grow: 1;
  position: relative;
  background: #000;
}

.overlay-iframe {
  width: 100%;
  height: 100%;
  border: none;
  background: #0f172a;
}

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

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

/* Empty State */
.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.3s ease;
}

.empty-state svg {
  width: 64px;
  height: 64px;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}

.empty-state h3 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.empty-state p {
  color: var(--text-secondary);
  max-width: 400px;
}

/* Footer Section */
footer {
  text-align: center;
  padding: 3rem 1.5rem;
  border-top: 1px solid var(--border-color);
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-top: auto;
}

footer p {
  margin-bottom: 0.5rem;
}

footer a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
  transition: var(--transition-fast);
}

footer a:hover {
  text-decoration: underline;
  color: var(--primary-hover);
}

/* Media Queries for responsive spacing */
@media (max-width: 768px) {
  .progress-panel {
    flex-direction: column;
    align-items: stretch;
    padding: 1.25rem;
  }
  
  .progress-info {
    justify-content: center;
  }
  
  .controls {
    max-width: none;
  }
  
  .overlay {
    padding: 0;
  }
  
  .overlay-container {
    height: 100vh;
    max-height: none;
    border-radius: 0;
    border: none;
  }
}

/* Hero Section Split Layout & Pinned Note */
.hero-split-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 3rem;
  max-width: 1200px;
  margin: 0 auto;
  text-align: left;
}

.hero-main-content {
  flex: 1.3;
}

.hero-main-content h1 {
  font-size: clamp(2rem, 4.5vw, 3.5rem) !important;
  margin-bottom: 1rem !important;
  text-align: left !important;
  background: linear-gradient(135deg, #fff 30%, #ffd4b2 70%, var(--primary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-main-content p {
  text-align: left !important;
  margin: 0 !important;
  max-width: 650px;
  font-size: clamp(1rem, 1.8vw, 1.15rem);
}

.hero-pinned-note {
  flex: 0.9;
  background: rgba(251, 191, 36, 0.04);
  border: 1px solid rgba(251, 191, 36, 0.25);
  border-radius: 1.25rem;
  padding: 1.5rem 1.75rem;
  position: relative;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2), inset 0 0 15px rgba(251, 191, 36, 0.02);
  transform: rotate(1deg);
  transition: transform var(--transition-fast), border-color var(--transition-fast);
}

.hero-pinned-note:hover {
  transform: rotate(0deg) scale(1.02);
  border-color: rgba(251, 191, 36, 0.4);
}

.pinned-note-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #fbbf24;
  margin-bottom: 0.75rem;
}

.hero-pinned-note p {
  color: var(--text-primary) !important;
  font-size: 1.1rem !important;
  font-weight: 500 !important;
  line-height: 1.5 !important;
  margin: 0 !important;
  text-align: left !important;
}

/* Responsive hero split container */
@media (max-width: 900px) {
  .hero-split-container {
    flex-direction: column;
    align-items: stretch;
    text-align: center;
    gap: 2rem;
  }
  .hero-main-content h1, .hero-main-content p {
    text-align: center !important;
  }
  .hero-main-content p {
    margin: 0 auto !important;
  }
  .hero-pinned-note {
    transform: none !important;
    max-width: 500px;
    margin: 0 auto !important;
  }
}
