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

/* Modern CSS Reset & Variable Definitions */
:root {
  /* Font Families */
  --font-heading: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

  /* CSS Transitions */
  --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  
  /* Border Radius */
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;

  /* Colors (Light Theme Defaults) */
  --bg-primary: #f8fafc;
  --bg-secondary: #ffffff;
  --bg-tertiary: #f1f5f9;
  
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  
  --brand-primary: #3b82f6;      /* Vibrant Indigo-Blue */
  --brand-primary-hover: #2563eb;
  --brand-secondary: #10b981;    /* Emerald Accent */
  --brand-secondary-hover: #059669;
  --brand-soft: rgba(59, 130, 246, 0.1);
  --brand-soft-success: rgba(16, 185, 129, 0.1);
  
  --border-color: #e2e8f0;
  --border-focus: #3b82f6;
  --error-color: #ef4444;
  --error-bg: rgba(239, 68, 68, 0.1);
  
  /* Shadows & Glassmorphism */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 20px -2px rgba(15, 23, 42, 0.06), 0 2px 8px -1px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 20px 25px -5px rgba(15, 23, 42, 0.08), 0 10px 10px -5px rgba(15, 23, 42, 0.04);
  --glass-bg: rgba(255, 255, 255, 0.7);
  --glass-border: rgba(255, 255, 255, 0.5);
  --glass-backdrop: blur(12px);

  /* Layout Consts */
  --max-width: 1280px;
}

/* Dark Theme Variables */
[data-theme="dark"] {
  --bg-primary: #090d16;
  --bg-secondary: #111827;
  --bg-tertiary: #1f2937;
  
  --text-primary: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-muted: #64748b;
  
  --brand-primary: #60a5fa;
  --brand-primary-hover: #3b82f6;
  --brand-secondary: #34d399;
  --brand-secondary-hover: #10b981;
  --brand-soft: rgba(96, 165, 250, 0.15);
  --brand-soft-success: rgba(52, 211, 153, 0.15);
  
  --border-color: #374151;
  --border-focus: #60a5fa;
  --error-color: #f87171;
  --error-bg: rgba(248, 113, 113, 0.15);
  
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 20px -2px rgba(0, 0, 0, 0.4), 0 2px 8px -1px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 20px 30px -5px rgba(0, 0, 0, 0.5), 0 10px 15px -5px rgba(0, 0, 0, 0.4);
  --glass-bg: rgba(17, 24, 39, 0.7);
  --glass-border: rgba(255, 255, 255, 0.05);
}

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

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  font-family: var(--font-body);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  transition: background-color var(--transition-normal), color var(--transition-normal);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Typography styling */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: 700;
  line-height: 1.25;
  margin-bottom: 0.5em;
  color: var(--text-primary);
}

h1 { font-size: 2.5rem; letter-spacing: -0.03em; }
h2 { font-size: 1.85rem; letter-spacing: -0.02em; border-bottom: 2px solid var(--border-color); padding-bottom: 0.3rem; margin-top: 1.5rem; margin-bottom: 1rem; }
h3 { font-size: 1.4rem; letter-spacing: -0.01em; margin-top: 1rem; }
p { margin-bottom: 1.25rem; color: var(--text-secondary); }
a { color: var(--brand-primary); text-decoration: none; transition: color var(--transition-fast); }
a:hover { color: var(--brand-primary-hover); }

/* Layout Grid */
.container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.5rem;
}

.grid-cols-12 {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 1.5rem;
}

/* Header & Navbar */
header {
  background-color: var(--glass-bg);
  backdrop-filter: var(--glass-backdrop);
  border-bottom: 1px solid var(--glass-border);
  position: sticky;
  top: 0;
  z-index: 100;
  transition: background-color var(--transition-normal);
}

.nav-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 70px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 1.35rem;
  color: var(--text-primary);
  text-decoration: none;
}

.logo span {
  background: linear-gradient(135deg, var(--brand-primary), var(--brand-secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.nav-menu {
  display: flex;
  list-style: none;
  gap: 1.5rem;
  align-items: center;
}

.nav-link {
  color: var(--text-secondary);
  font-weight: 500;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}

.nav-link:hover, .nav-link.active {
  color: var(--brand-primary);
  background-color: var(--brand-soft);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

/* Custom UI Toggle (Dark / Light Theme) */
.theme-toggle {
  background: none;
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 0.5rem;
  border-radius: var(--radius-full);
  cursor: pointer;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.theme-toggle:hover {
  background-color: var(--bg-tertiary);
  border-color: var(--text-muted);
}

.theme-toggle svg {
  width: 20px;
  height: 20px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-body);
  font-weight: 600;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  transition: all var(--transition-fast);
  gap: 0.5rem;
}

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

.btn-primary:hover {
  background-color: var(--brand-primary-hover);
  color: #ffffff;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.25);
}

.btn-secondary {
  background-color: var(--brand-secondary);
  color: #ffffff;
}

.btn-secondary:hover {
  background-color: var(--brand-secondary-hover);
  color: #ffffff;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.25);
}

.btn-outline {
  background-color: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-primary);
}

.btn-outline:hover {
  background-color: var(--bg-tertiary);
  transform: translateY(-2px);
}

.btn-danger {
  background-color: var(--error-bg);
  color: var(--error-color);
}

.btn-danger:hover {
  background-color: var(--error-color);
  color: #ffffff;
}

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

/* Card Structures */
.card {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: var(--shadow-md);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast), border-color var(--transition-fast);
}

.card:hover {
  box-shadow: var(--shadow-lg);
  border-color: var(--brand-primary);
}

/* Interactive Calculator Container */
.calc-card {
  border-top: 4px solid var(--brand-primary);
}

/* Hero Elements */
.hero-section {
  padding: 4rem 0 3rem;
  text-align: center;
  background: radial-gradient(circle at top, var(--brand-soft) 0%, transparent 70%);
}

.hero-tagline {
  display: inline-block;
  background-color: var(--brand-soft);
  color: var(--brand-primary);
  padding: 0.35rem 1rem;
  border-radius: var(--radius-full);
  font-weight: 600;
  font-size: 0.85rem;
  margin-bottom: 1.5rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.hero-title {
  font-size: 3rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  margin-bottom: 1rem;
}

.hero-title span {
  color: var(--brand-primary);
}

.hero-subtitle {
  font-size: 1.15rem;
  max-width: 700px;
  margin: 0 auto 2.5rem;
  color: var(--text-secondary);
}

/* Form Fields */
.form-group {
  margin-bottom: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

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

.form-input, .form-select {
  font-family: var(--font-body);
  font-size: 1rem;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background-color: var(--bg-secondary);
  color: var(--text-primary);
  transition: all var(--transition-fast);
}

.form-input:focus, .form-select:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--brand-soft);
}

/* Dynamic Semester Calculator Grid */
.calc-table-header {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr 40px;
  gap: 1rem;
  margin-bottom: 0.75rem;
  padding: 0 0.5rem;
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--text-secondary);
  text-transform: uppercase;
}

.calc-row {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr 40px;
  gap: 1rem;
  margin-bottom: 0.75rem;
  align-items: center;
  animation: slideIn var(--transition-fast) forwards;
}

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

.calc-result-box {
  background: linear-gradient(135deg, var(--brand-primary), #1d4ed8);
  color: #ffffff;
  border-radius: var(--radius-lg);
  padding: 2rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  box-shadow: 0 10px 25px rgba(59, 130, 246, 0.3);
}

.calc-result-val {
  font-family: var(--font-heading);
  font-size: 4rem;
  font-weight: 800;
  line-height: 1;
  margin: 0.5rem 0;
}

/* Table Style */
.table-responsive {
  overflow-x: auto;
  margin-bottom: 1.5rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.table-data {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  background-color: var(--bg-secondary);
}

.table-data th, .table-data td {
  padding: 1rem;
  border-bottom: 1px solid var(--border-color);
}

.table-data th {
  background-color: var(--bg-tertiary);
  font-weight: 600;
  color: var(--text-primary);
}

.table-data tr:last-child td {
  border-bottom: none;
}

/* AdSense Premium Non-CLS Containers */
.ad-slot {
  margin: 2rem 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  border: 1px dashed var(--text-muted);
  background: linear-gradient(90deg, var(--bg-tertiary) 25%, var(--bg-secondary) 50%, var(--bg-tertiary) 75%);
  background-size: 200% 100%;
  animation: skeleton-glow 1.5s infinite linear;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.ad-slot::before {
  content: "Sponsored Academic Link";
  position: absolute;
  top: 5px;
  left: 5px;
  font-size: 0.65rem;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.05em;
  font-weight: 500;
}

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

.ad-header-h728 {
  width: 100%;
  max-width: 728px;
  height: 90px;
}

.ad-card-w300 {
  width: 300px;
  height: 250px;
}

.ad-inline-h280 {
  width: 100%;
  height: 280px;
}

/* FAQs and Accordion */
.faq-container {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 2rem;
}

.faq-item {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background-color: var(--bg-secondary);
  overflow: hidden;
  transition: all var(--transition-fast);
}

.faq-question {
  width: 100%;
  padding: 1.25rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: none;
  border: none;
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
  text-align: left;
  cursor: pointer;
}

.faq-question:hover {
  background-color: var(--brand-soft);
}

.faq-answer {
  max-height: 0;
  padding: 0 1.5rem;
  overflow: hidden;
  transition: all var(--transition-normal);
  color: var(--text-secondary);
}

.faq-item.active .faq-answer {
  padding: 0 1.5rem 1.5rem;
  max-height: 500px;
  border-top: 1px solid var(--border-color);
}

.faq-icon {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: var(--text-primary);
  stroke-width: 2.5;
  transition: transform var(--transition-fast);
}

.faq-item.active .faq-icon {
  transform: rotate(180deg);
}

/* Footer Section */
footer {
  margin-top: auto;
  background-color: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
  padding: 4rem 0 2rem;
}

.footer-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 2rem;
  margin-bottom: 3rem;
}

.footer-logo-desc {
  grid-column: span 1;
}

.footer-links {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.footer-links a {
  color: var(--text-secondary);
}

.footer-links a:hover {
  color: var(--brand-primary);
}

.footer-bottom {
  border-top: 1px solid var(--border-color);
  padding-top: 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* Hub Grid & Category Selection */
.hub-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
  margin: 2rem 0;
}

.hub-card {
  display: flex;
  flex-direction: column;
  padding: 1.5rem;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  text-decoration: none;
  color: inherit;
  transition: all var(--transition-fast);
}

.hub-card:hover {
  border-color: var(--brand-primary);
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
}

.hub-card .icon {
  background-color: var(--brand-soft);
  color: var(--brand-primary);
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1rem;
  font-size: 1.5rem;
}

.hub-card h3 {
  margin: 0.5rem 0;
  font-size: 1.2rem;
}

.hub-card p {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 0;
}

/* Utilities */
.text-center { text-align: center; }
.my-4 { margin-top: 1rem; margin-bottom: 1rem; }
.my-8 { margin-top: 2rem; margin-bottom: 2rem; }
.py-4 { padding-top: 1rem; padding-bottom: 1rem; }
.py-8 { padding-top: 2rem; padding-bottom: 2rem; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }

/* Responsive adjustments */
@media (max-width: 1024px) {
  .footer-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  h1 { font-size: 2rem; }
  h2 { font-size: 1.5rem; }
  .grid-cols-12 {
    display: flex;
    flex-direction: column;
  }
  
  .calc-table-header {
    display: none; /* Hide header on mobile, use stack rows */
  }
  
  .calc-row {
    grid-template-columns: 1fr;
    gap: 0.5rem;
    border: 1px solid var(--border-color);
    padding: 1rem;
    border-radius: var(--radius-md);
    background-color: var(--bg-tertiary);
  }
  
  .calc-row select, .calc-row input {
    width: 100%;
  }

  .calc-row .btn-danger {
    margin-top: 0.5rem;
    width: 100%;
  }
  
  .footer-grid {
    grid-template-columns: 1fr;
  }
  
  .footer-bottom {
    flex-direction: column;
    gap: 1rem;
    text-align: center;
  }
}
