/* ==========================================================================
   GradeCalc - CSS Design System & Responsive Stylesheet
   Dr. A.P.J. Abdul Kalam Inter College Theme (drapjakicbjb.ac.in)
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Root Variables & Theme Configuration
   -------------------------------------------------------------------------- */
:root {
  /* Color System - Dr. APJ Abdul Kalam Inter College Theme */
  --primary: #002147;          /* Royal Navy Blue */
  --primary-hover: #001630;
  --primary-light: #f0f6ff;
  --primary-border: #93c5fd;

  --secondary: #800000;        /* Deep Academic Crimson Maroon */
  --secondary-hover: #660000;

  --accent: #d97706;           /* Saffron Gold */
  --accent-hover: #b45309;
  --accent-light: #fef3c7;

  --background: #f8fafc;
  --surface: #ffffff;
  --surface-alt: #f1f5f9;

  --text: #0f172a;
  --text-muted: #475569;
  --text-light: #94a3b8;

  --border: #cbd5e1;
  --border-focus: #3b82f6;

  --success: #16a34a;
  --success-bg: #f0fdf4;
  --success-border: #bbf7d0;

  --warning: #d97706;
  --warning-bg: #fffbe8;
  --warning-border: #fef08a;

  --danger: #dc2626;
  --danger-hover: #b91c1c;
  --danger-bg: #fef2f2;
  --danger-border: #fecaca;

  --institution-bar-bg: #0b192c;
  --institution-gold: #fbbf24;

  /* Typography */
  --font-sans: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -1px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);

  /* Geometry & Radii */
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
  --radius-full: 9999px;

  --max-width: 1200px;
  --header-height: 72px;

  /* Transitions */
  --transition-fast: 150ms ease-in-out;
  --transition-normal: 250ms ease-in-out;
}

/* --------------------------------------------------------------------------
   2. Global Resets & Base Styles
   -------------------------------------------------------------------------- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.5;
  color: var(--text);
  background-color: var(--background);
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  background-color: var(--background);
}

img, svg {
  display: block;
  max-width: 100%;
}

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

a:hover {
  color: var(--primary-hover);
}

button, input, select, textarea {
  font: inherit;
}

/* Fluid Responsive Container */
.container {
  width: 100%;
  max-width: var(--max-width);
  margin-left: auto;
  margin-right: auto;
  padding-left: clamp(1rem, 3vw, 1.5rem);
  padding-right: clamp(1rem, 3vw, 1.5rem);
}

.main-content {
  flex: 1 0 auto;
  padding-top: clamp(1.25rem, 3vw, 2.5rem);
  padding-bottom: clamp(2.5rem, 5vw, 4.5rem);
}

/* --------------------------------------------------------------------------
   3. Institutional Top Bar & Header Navigation
   -------------------------------------------------------------------------- */
.institution-bar {
  background-color: var(--institution-bar-bg);
  color: #e2e8f0;
  border-bottom: 1px solid rgba(251, 191, 36, 0.3);
  font-size: clamp(0.775rem, 1.5vw, 0.85rem);
  padding: 0.45rem 0;
}

.institution-bar-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.institution-bar-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
  color: #ffffff;
  flex-wrap: wrap;
}

.institution-bar-link {
  color: var(--institution-gold);
  font-weight: 600;
  text-decoration: none;
  transition: color var(--transition-fast);
}

.institution-bar-link:hover {
  color: #ffffff;
  text-decoration: underline;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  height: var(--header-height);
  background-color: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  transition: background-color var(--transition-fast);
}

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

.brand-logo {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  font-size: clamp(1.15rem, 2.5vw, 1.35rem);
  font-weight: 700;
  color: var(--primary);
  letter-spacing: -0.025em;
}

.brand-logo svg {
  width: clamp(26px, 3vw, 32px);
  height: clamp(26px, 3vw, 32px);
  color: var(--accent);
}

.brand-logo span.highlight {
  color: var(--accent);
}

.nav-menu {
  display: flex;
  align-items: center;
  gap: clamp(0.25rem, 1vw, 0.5rem);
  list-style: none;
}

.nav-link {
  display: inline-block;
  padding: 0.5rem clamp(0.5rem, 1.2vw, 0.875rem);
  font-size: clamp(0.875rem, 1.5vw, 0.925rem);
  font-weight: 500;
  color: var(--text-muted);
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
}

.nav-link:hover {
  color: var(--primary);
  background-color: var(--primary-light);
}

.nav-link.active {
  color: var(--primary);
  background-color: var(--primary-light);
  font-weight: 600;
}

.mobile-toggle {
  display: none;
  background: none;
  border: none;
  padding: 0.5rem;
  color: var(--primary);
  cursor: pointer;
  border-radius: var(--radius-md);
  min-height: 44px;
  min-width: 44px;
}

.mobile-toggle:hover {
  background-color: var(--surface-alt);
}

.mobile-toggle svg {
  width: 24px;
  height: 24px;
}

/* --------------------------------------------------------------------------
   4. Hero & Page Intro Sections
   -------------------------------------------------------------------------- */
.hero-section {
  padding: clamp(2rem, 5vw, 3.5rem) 0 clamp(1.5rem, 4vw, 2.5rem);
  text-align: center;
  position: relative;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.375rem 0.875rem;
  font-size: clamp(0.775rem, 1.5vw, 0.85rem);
  font-weight: 600;
  color: var(--primary);
  background-color: var(--primary-light);
  border: 1px solid var(--primary-border);
  border-radius: var(--radius-full);
  margin-bottom: clamp(1rem, 2vw, 1.25rem);
}

.hero-title {
  font-size: clamp(1.75rem, 4.5vw, 2.75rem);
  font-weight: 800;
  line-height: 1.2;
  color: var(--primary);
  letter-spacing: -0.03em;
  margin-bottom: 1rem;
}

.hero-title span {
  background: linear-gradient(135deg, var(--secondary) 0%, var(--accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-subtitle {
  font-size: clamp(0.975rem, 2vw, 1.15rem);
  color: var(--text-muted);
  max-width: 680px;
  margin: 0 auto clamp(1.25rem, 3vw, 2rem);
  line-height: 1.6;
}

.page-intro {
  margin-bottom: clamp(1.5rem, 3vw, 2.25rem);
}

.page-title {
  font-size: clamp(1.75rem, 4vw, 2.25rem);
  font-weight: 800;
  color: var(--primary);
  letter-spacing: -0.025em;
  margin-bottom: 0.5rem;
}

.page-description {
  font-size: clamp(0.95rem, 1.8vw, 1.05rem);
  color: var(--text-muted);
  max-width: 750px;
  line-height: 1.6;
}

/* --------------------------------------------------------------------------
   5. Calculator Cards Grid (Home & Tools)
   -------------------------------------------------------------------------- */
.calculator-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(clamp(260px, 30vw, 340px), 1fr));
  gap: clamp(1rem, 2.5vw, 1.5rem);
  margin-top: 1.75rem;
  margin-bottom: 3rem;
}

.calc-card {
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: clamp(1.25rem, 3vw, 1.75rem);
  display: flex;
  flex-direction: column;
  transition: transform var(--transition-normal), box-shadow var(--transition-normal), border-color var(--transition-normal);
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}

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

.calc-card-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-lg);
  background-color: var(--primary-light);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1.25rem;
  flex-shrink: 0;
}

.calc-card-icon svg {
  width: 26px;
  height: 26px;
}

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

.calc-card-desc {
  font-size: 0.95rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 1.5rem;
  flex-grow: 1;
}

/* Button System */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.7rem 1.35rem;
  font-size: 0.95rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
  user-select: none;
  min-height: 44px;
}

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

.btn-primary:hover {
  background-color: var(--primary-hover);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(0, 33, 71, 0.25);
}

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

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

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

.btn-outline:hover {
  background-color: var(--surface-alt);
  border-color: var(--text-light);
}

.btn-danger-ghost {
  background-color: transparent;
  color: var(--danger);
  border: 1px solid transparent;
}

.btn-danger-ghost:hover {
  background-color: var(--danger-bg);
  border-color: var(--danger-border);
}

.btn-sm {
  padding: 0.4rem 0.85rem;
  font-size: 0.875rem;
  min-height: 38px;
}

.btn-block {
  width: 100%;
}

/* --------------------------------------------------------------------------
   6. Calculator Box & Form Controls
   -------------------------------------------------------------------------- */
.calculator-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: clamp(1rem, 3.5vw, 2.25rem);
  box-shadow: var(--shadow-md);
  margin-bottom: clamp(1.5rem, 3.5vw, 2.5rem);
}

.calculator-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.875rem;
  margin-bottom: 1.5rem;
}

.calculator-header h2 {
  font-size: clamp(1.15rem, 2.5vw, 1.35rem);
  font-weight: 700;
  color: var(--primary);
}

.calc-table-wrapper {
  overflow-x: auto;
  margin-bottom: 1.25rem;
}

.calc-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin-bottom: 1rem;
}

.calc-table th {
  background-color: var(--surface-alt);
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.calc-table th:first-child {
  border-top-left-radius: var(--radius-md);
}

.calc-table th:last-child {
  border-top-right-radius: var(--radius-md);
}

.calc-table td {
  padding: 0.875rem 1rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.form-control {
  width: 100%;
  padding: 0.625rem 0.875rem;
  font-size: 0.95rem;
  color: var(--text);
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  outline: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  min-height: 44px;
}

.form-control:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.form-control.is-invalid {
  border-color: var(--danger);
  background-color: var(--danger-bg);
}

.error-msg {
  display: block;
  font-size: 0.8rem;
  color: var(--danger);
  margin-top: 0.375rem;
  font-weight: 500;
}

.calc-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.calc-actions-left, .calc-actions-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.form-group {
  margin-bottom: 1.25rem;
}

.form-label {
  display: block;
  font-weight: 600;
  font-size: 0.925rem;
  color: var(--primary);
  margin-bottom: 0.5rem;
}

.form-hint {
  display: block;
  font-size: 0.825rem;
  color: var(--text-muted);
  margin-top: 0.375rem;
}

.input-with-suffix {
  position: relative;
  display: flex;
  align-items: center;
}

.input-with-suffix .form-control {
  padding-right: 3rem;
}

.input-suffix {
  position: absolute;
  right: 1rem;
  font-weight: 600;
  color: var(--text-muted);
  pointer-events: none;
}

/* --------------------------------------------------------------------------
   7. Result Card & Breakdown Panels
   -------------------------------------------------------------------------- */
.result-card {
  display: none;
  background: linear-gradient(135deg, #ffffff 0%, var(--primary-light) 100%);
  border: 2px solid var(--primary-border);
  border-radius: var(--radius-xl);
  padding: clamp(1.25rem, 3.5vw, 2.25rem);
  margin-top: 2rem;
  box-shadow: var(--shadow-lg);
  position: relative;
  overflow: hidden;
}

.result-card.show {
  display: block;
  animation: slideUpFade 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

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

.result-header {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.075em;
  color: var(--primary);
  margin-bottom: 0.5rem;
}

.result-main {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.result-score {
  font-size: clamp(2.5rem, 6vw, 3.75rem);
  font-weight: 800;
  color: var(--primary);
  line-height: 1;
  letter-spacing: -0.03em;
}

.result-subtitle {
  font-size: clamp(1rem, 2vw, 1.15rem);
  font-weight: 600;
  color: var(--text-muted);
}

.result-breakdown {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: clamp(0.75rem, 2vw, 1.25rem);
  padding-top: 1.25rem;
  border-top: 1px dashed var(--primary-border);
}

.breakdown-item {
  background-color: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(4px);
  padding: 0.875rem 1rem;
  border-radius: var(--radius-lg);
  border: 1px solid rgba(147, 197, 253, 0.5);
}

.breakdown-label {
  font-size: 0.775rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 0.25rem;
}

.breakdown-value {
  font-size: clamp(1.1rem, 2vw, 1.35rem);
  font-weight: 700;
  color: var(--primary);
}

/* --------------------------------------------------------------------------
   8. Reusable Institutional Disclaimer Card
   -------------------------------------------------------------------------- */
.disclaimer-card {
  background-color: var(--warning-bg);
  border: 1px solid var(--warning-border);
  border-radius: var(--radius-lg);
  padding: clamp(1rem, 2.5vw, 1.35rem);
  display: flex;
  align-items: flex-start;
  gap: 0.875rem;
  margin-top: 2rem;
  margin-bottom: 2.5rem;
}

.disclaimer-icon {
  color: var(--warning);
  flex-shrink: 0;
  margin-top: 0.125rem;
}

.disclaimer-icon svg {
  width: 22px;
  height: 22px;
}

.disclaimer-text {
  font-size: clamp(0.85rem, 1.8vw, 0.925rem);
  color: #78350f;
  line-height: 1.55;
}

/* --------------------------------------------------------------------------
   9. Educational Content & FAQ Components
   -------------------------------------------------------------------------- */
.content-section {
  margin-top: clamp(2rem, 4vw, 3.5rem);
  margin-bottom: clamp(2rem, 4vw, 3.5rem);
}

.section-title {
  font-size: clamp(1.4rem, 3vw, 1.75rem);
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 1.25rem;
  letter-spacing: -0.02em;
}

.content-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(clamp(260px, 30vw, 320px), 1fr));
  gap: 1.5rem;
}

.info-box {
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: clamp(1.15rem, 2.5vw, 1.5rem);
  box-shadow: var(--shadow-sm);
}

.info-box h3 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 0.75rem;
}

.info-box p {
  font-size: 0.95rem;
  color: var(--text-muted);
  line-height: 1.6;
}

.formula-box {
  background-color: var(--surface-alt);
  border-left: 4px solid var(--accent);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  padding: 0.875rem 1.15rem;
  margin: 0.875rem 0;
  font-family: monospace, var(--font-sans);
  font-size: clamp(0.875rem, 2vw, 0.95rem);
  font-weight: 600;
  color: var(--primary);
  word-break: break-word;
}

.faq-section {
  margin-top: clamp(2rem, 4vw, 3.5rem);
  margin-bottom: clamp(2rem, 4vw, 3.5rem);
}

.faq-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-width: 900px;
}

.faq-item {
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: border-color var(--transition-fast);
}

.faq-item:hover {
  border-color: var(--primary-border);
}

.faq-question {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.15rem 1.35rem;
  background: none;
  border: none;
  font-size: clamp(0.95rem, 2vw, 1.05rem);
  font-weight: 600;
  color: var(--primary);
  text-align: left;
  cursor: pointer;
  gap: 1rem;
  min-height: 48px;
}

.faq-icon {
  color: var(--accent);
  transition: transform var(--transition-normal);
  flex-shrink: 0;
}

.faq-icon svg {
  width: 20px;
  height: 20px;
}

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

.faq-answer {
  max-height: 0;
  overflow: hidden;
  transition: max-height var(--transition-normal) cubic-bezier(0, 1, 0, 1), padding var(--transition-normal);
  padding: 0 1.35rem;
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.65;
}

.faq-item.open .faq-answer {
  max-height: 500px;
  padding: 0 1.35rem 1.15rem 1.35rem;
}

/* --------------------------------------------------------------------------
   10. Sleek Site Footer
   -------------------------------------------------------------------------- */
.site-footer {
  background-color: var(--primary);
  color: #cbd5e1;
  padding: 1rem 0;
  margin-top: auto;
  border-top: 1px solid #1e293b;
}

/* --------------------------------------------------------------------------
   11. Comprehensive Responsive Media Queries (320px to 1920px)
   -------------------------------------------------------------------------- */
/* 4K & Ultra-Wide Displays (1440px+) */
@media (min-width: 1440px) {
  .container {
    max-width: 1320px;
  }
}

/* Laptops & Standard Desktops (992px to 1200px) */
@media (max-width: 992px) {
  .calculator-grid {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  }
}

/* Tablets & Mobile Screens (768px and below) */
@media (max-width: 768px) {
  .site-header {
    height: 60px;
  }

  .mobile-toggle {
    display: block;
  }

  .institution-bar-content {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem;
  }

  .nav-menu {
    position: fixed;
    top: 60px;
    left: 0;
    right: 0;
    background-color: var(--surface);
    flex-direction: column;
    align-items: stretch;
    padding: 1rem;
    gap: 0.5rem;
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: all var(--transition-normal);
  }

  .nav-menu.open {
    max-height: 480px;
    opacity: 1;
    padding: 1.25rem 1rem;
  }

  .nav-link {
    padding: 0.75rem 1rem;
    font-size: 1rem;
  }

  /* Dynamic Table to Stacked Cards Transformation on Mobile */
  .calc-table, .calc-table tbody, .calc-table tr, .calc-table td {
    display: block;
    width: 100%;
  }

  .calc-table thead {
    display: none;
  }

  .calc-table tr {
    background-color: var(--surface-alt);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 0.875rem;
    margin-bottom: 1rem;
    position: relative;
  }

  .calc-table td {
    border: none;
    padding: 0.375rem 0;
  }

  .calc-table td::before {
    content: attr(data-label);
    display: block;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
  }

  .calc-table td.td-action {
    display: flex;
    justify-content: stretch;
    width: 100%;
    padding-top: 0.75rem;
    margin-top: 0.5rem;
    border-top: 1px dashed var(--border);
  }

  .calc-table td.td-action::before {
    display: none;
  }

  .calc-table td.td-action .btn {
    width: 100%;
    justify-content: center;
    min-height: 42px;
  }

  /* Perfect Mobile Button Order & Stretch Alignment */
  .calc-actions {
    display: flex;
    flex-direction: column-reverse;
    gap: 0.875rem;
    align-items: stretch;
    width: 100%;
  }

  .calc-actions-right {
    display: flex;
    flex-direction: column-reverse;
    gap: 0.75rem;
    width: 100%;
  }

  .calc-actions-left {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    width: 100%;
  }

  .calc-actions .btn {
    width: 100%;
    min-height: 48px;
    font-size: 1rem;
    justify-content: center;
    text-align: center;
    box-sizing: border-box;
  }

  .result-breakdown {
    grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  }
}

/* Small Mobile Phones (480px and below) */
@media (max-width: 480px) {
  .hero-section div[style*="display: flex"] {
    flex-direction: column;
    width: 100%;
    gap: 0.75rem !important;
  }
  
  .hero-section .btn {
    width: 100%;
    justify-content: center;
    min-height: 48px;
  }

  .calc-table td div[style*="display: flex"] {
    flex-direction: column !important;
    gap: 0.5rem !important;
    width: 100%;
  }

  .grade-select, .subject-gradepoint {
    width: 100% !important;
    flex: none !important;
  }

  .btn {
    padding: 0.65rem 1rem;
    font-size: 0.95rem;
  }

  .input-with-suffix .form-control {
    padding-right: 2.5rem;
  }
}

/* Ultra-Small Mobile Devices (320px to 375px) */
@media (max-width: 375px) {
  .container {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
  }
  .brand-logo {
    font-size: 1.15rem;
  }
  .calculator-box {
    padding: 0.75rem;
  }
  .calc-card {
    padding: 1.15rem;
  }
}

/* Accessibility: Prefers Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
