/* ============================================
   GPA Calculator - Premium Single Page Design
   ============================================ */

/* CSS Variables */
:root {
  --bg-primary: #0a0a0f;
  --bg-secondary: #12121a;
  --bg-card: rgba(18, 18, 26, 0.8);
  --text-primary: #ffffff;
  --text-secondary: rgba(255, 255, 255, 0.6);
  --text-muted: rgba(255, 255, 255, 0.4);
  --accent-primary: #a855f7;
  --accent-secondary: #6366f1;
  --accent-tertiary: #06b6d4;
  --gradient-primary: linear-gradient(135deg, #a855f7 0%, #6366f1 50%, #06b6d4 100%);
  --gradient-glow: linear-gradient(135deg, rgba(168, 85, 247, 0.4), rgba(99, 102, 241, 0.4), rgba(6, 182, 212, 0.4));
  --border-color: rgba(255, 255, 255, 0.08);
  --border-glow: rgba(168, 85, 247, 0.3);
  --shadow-color: rgba(0, 0, 0, 0.5);
  --success: #22c55e;
  --warning: #f59e0b;
  --error: #ef4444;
}

[data-theme="light"] {
  --bg-primary: #fafafa;
  --bg-secondary: #ffffff;
  --bg-card: rgba(255, 255, 255, 0.9);
  --text-primary: #0f0f0f;
  --text-secondary: rgba(15, 15, 15, 0.7);
  --text-muted: rgba(15, 15, 15, 0.5);
  --border-color: rgba(0, 0, 0, 0.08);
  --shadow-color: rgba(0, 0, 0, 0.1);
}

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

html {
  height: 100%;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  height: 100%;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* Hide number input spinners */
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

input[type="number"] {
  -moz-appearance: textfield;
  appearance: textfield;
}

/* Performance optimizations */
.gradient-orb,
.form-card,
.course-card,
.result-card,
.stat-card,
.submit-btn {
  will-change: transform;
  transform: translateZ(0);
  backface-visibility: hidden;
}

/* Touch-friendly sizing */
@media (pointer: coarse) {
  .mini-select,
  .mini-input,
  .submit-btn,
  .back-btn,
  .reset-btn,
  .theme-toggle {
    min-height: 44px;
  }
}

body {
  font-family: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.5;
}

/* ============================================
   Animated Background
   ============================================ */
.bg-container {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
}

.gradient-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.6;
  animation: float 20s ease-in-out infinite;
}

[data-theme="light"] .gradient-orb {
  opacity: 0.4;
}

.orb-1 {
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(168, 85, 247, 0.5) 0%, transparent 70%);
  top: -200px;
  left: -200px;
  animation-delay: 0s;
}

.orb-2 {
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.5) 0%, transparent 70%);
  top: 50%;
  right: -150px;
  animation-delay: -5s;
  animation-duration: 25s;
}

.orb-3 {
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, rgba(6, 182, 212, 0.4) 0%, transparent 70%);
  bottom: -100px;
  left: 30%;
  animation-delay: -10s;
  animation-duration: 22s;
}

.orb-4 {
  width: 300px;
  height: 300px;
  background: radial-gradient(circle, rgba(236, 72, 153, 0.3) 0%, transparent 70%);
  top: 40%;
  left: 10%;
  animation-delay: -15s;
  animation-duration: 18s;
}

@keyframes float {
  0%, 100% { transform: translate(0, 0) scale(1); }
  25% { transform: translate(30px, -30px) scale(1.05); }
  50% { transform: translate(-20px, 20px) scale(0.95); }
  75% { transform: translate(20px, 30px) scale(1.02); }
}

.grid-overlay {
  position: absolute;
  inset: 0;
  background-image: 
    linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
  background-size: 50px 50px;
  mask-image: radial-gradient(ellipse at center, black 0%, transparent 70%);
}

[data-theme="light"] .grid-overlay {
  background-image: 
    linear-gradient(rgba(0, 0, 0, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 0, 0, 0.03) 1px, transparent 1px);
}

.noise-overlay {
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
  opacity: 0.03;
  pointer-events: none;
}

/* ============================================
   Theme Toggle
   ============================================ */
.theme-toggle {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 100;
  width: 48px;
  height: 48px;
  border-radius: 14px;
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
}

.theme-toggle:hover {
  border-color: var(--border-glow);
  transform: scale(1.05);
  box-shadow: 0 0 30px rgba(168, 85, 247, 0.2);
}

.toggle-track {
  position: relative;
  width: 24px;
  height: 24px;
}

.sun-icon, .moon-icon {
  position: absolute;
  width: 20px;
  height: 20px;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.sun-icon {
  color: #fbbf24;
  opacity: 0;
  transform: rotate(-90deg) scale(0.5);
}

.moon-icon {
  color: #a855f7;
  opacity: 1;
  transform: rotate(0) scale(1);
}

[data-theme="light"] .sun-icon {
  opacity: 1;
  transform: rotate(0) scale(1);
}

[data-theme="light"] .moon-icon {
  opacity: 0;
  transform: rotate(90deg) scale(0.5);
}

/* ============================================
   App Container
   ============================================ */
.app-container {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100vh;
  height: calc(var(--vh, 1vh) * 100);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ============================================
   Home Section - Split Layout
   ============================================ */
.home-section {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 60px;
  width: 100%;
  max-width: 1400px;
  padding: 40px 60px;
  align-items: center;
}

/* Hero Side */
.hero-side {
  display: flex;
  flex-direction: column;
  gap: 30px;
}

.hero-content {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Badge */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 50px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  width: fit-content;
  backdrop-filter: blur(10px);
}

.badge-dot {
  width: 8px;
  height: 8px;
  background: var(--success);
  border-radius: 50%;
  animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(1.2); }
}

/* Hero Title */
.hero-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: clamp(48px, 6vw, 80px);
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.03em;
}

.title-gradient {
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.title-white {
  display: block;
  color: var(--text-primary);
  -webkit-text-fill-color: var(--text-primary);
}

.hero-description {
  font-size: 18px;
  color: var(--text-secondary);
  max-width: 480px;
  line-height: 1.7;
}

/* Feature Pills */
.feature-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 10px;
}

.pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 50px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  backdrop-filter: blur(10px);
  transition: all 0.3s ease;
}

.pill:hover {
  border-color: var(--accent-primary);
  color: var(--text-primary);
  transform: translateY(-2px);
}

.pill svg {
  width: 16px;
  height: 16px;
  color: var(--accent-primary);
}

/* Floating Stats */
.floating-stats {
  display: flex;
  gap: 20px;
  margin-top: 20px;
}

.stat-card {
  padding: 20px 28px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  backdrop-filter: blur(20px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 4px;
  min-width: 100px;
  transition: all 0.3s ease;
}

.stat-card:hover {
  transform: translateY(-5px);
  border-color: var(--border-glow);
  box-shadow: 0 20px 40px var(--shadow-color);
}

.stat-value {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 32px;
  font-weight: 700;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  line-height: 1;
}

.stat-label {
  font-size: 13px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ============================================
   Form Side
   ============================================ */
.form-side {
  display: flex;
  justify-content: center;
}

.form-card {
  position: relative;
  width: 100%;
  max-width: 420px;
  border-radius: 28px;
  overflow: hidden;
}

.form-glow {
  position: absolute;
  inset: -2px;
  background: var(--gradient-primary);
  border-radius: 30px;
  opacity: 0.5;
  filter: blur(20px);
  z-index: -1;
  transition: opacity 0.3s ease;
}

.form-card:hover .form-glow {
  opacity: 0.7;
}

.form-inner {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 28px;
  backdrop-filter: blur(40px);
  padding: 40px;
}

.form-header {
  text-align: center;
  margin-bottom: 32px;
}

.form-icon {
  width: 60px;
  height: 60px;
  margin: 0 auto 16px;
  background: var(--gradient-primary);
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.form-icon svg {
  width: 28px;
  height: 28px;
  color: white;
}

.form-header h2 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 28px;
  font-weight: 600;
  margin-bottom: 6px;
}

.form-header p {
  font-size: 15px;
  color: var(--text-secondary);
}

/* Input Groups */
.form-body {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.input-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.input-group label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
}

.input-group label svg {
  width: 18px;
  height: 18px;
  color: var(--accent-primary);
}

.input-wrapper {
  position: relative;
}

.input-wrapper input {
  width: 100%;
  height: 56px;
  padding: 0 20px;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 20px;
  font-weight: 600;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  color: var(--text-primary);
  transition: all 0.3s ease;
}

.input-wrapper input:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 4px rgba(168, 85, 247, 0.15);
}

.input-hint {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 12px;
  color: var(--text-muted);
}

/* Error Message */
.error-message {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: 12px;
  color: var(--error);
  font-size: 14px;
  animation: shake 0.5s ease;
}

.error-message svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.hidden {
  display: none !important;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-8px); }
  40%, 80% { transform: translateX(8px); }
}

/* Submit Button */
.submit-btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  height: 58px;
  background: var(--gradient-primary);
  border: none;
  border-radius: 16px;
  cursor: pointer;
  overflow: hidden;
  transition: all 0.3s ease;
  margin-top: 8px;
}

.submit-btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 20px 40px rgba(168, 85, 247, 0.4);
}

.submit-btn:active {
  transform: translateY(-1px);
}

.btn-text {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 17px;
  font-weight: 600;
  color: white;
  z-index: 1;
}

.btn-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
  transition: transform 0.3s ease;
}

.btn-icon svg {
  width: 20px;
  height: 20px;
  color: white;
}

.submit-btn:hover .btn-icon {
  transform: translateX(4px);
}

.btn-glow {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.2) 0%, transparent 50%);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.submit-btn:hover .btn-glow {
  opacity: 1;
}

/* ============================================
   Calculator Section
   ============================================ */
.calculator-section {
  width: 100%;
  height: 100vh;
  height: calc(var(--vh, 1vh) * 100);
  padding: 60px 40px 40px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  display: flex;
  align-items: flex-start;
  justify-content: center;
}

.calc-container {
  width: 100%;
  max-width: 1400px;
  padding-top: 20px;
}

.calc-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
  margin-bottom: 40px;
  position: relative;
}

.back-btn {
  position: absolute;
  left: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
}

.back-btn:hover {
  border-color: var(--accent-primary);
  color: var(--text-primary);
}

.back-btn svg {
  width: 18px;
  height: 18px;
}

.calc-title-group {
  text-align: center;
}

.calc-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: clamp(30px, 4vw, 44px);
  font-weight: 700;
  letter-spacing: -0.02em;
}

/* Calculator Content */
.calc-content {
  display: flex;
  flex-direction: column;
  gap: 30px;
  align-items: center;
}

.calc-form {
  display: flex;
  flex-direction: column;
  gap: 32px;
  align-items: center;
}

.courses-section,
.prev-section {
  width: 100%;
}

.courses-section {
  max-width: 900px;
}

.prev-section {
  max-width: 900px;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 20px;
}

.section-header svg {
  width: 18px;
  height: 18px;
  color: var(--accent-primary);
}

/* Courses Grid */
.courses-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
}

.course-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 16px;
  backdrop-filter: blur(10px);
  transition: all 0.3s ease;
}

.course-card:hover {
  border-color: var(--border-glow);
  transform: translateY(-2px);
}

.course-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.course-num {
  width: 24px;
  height: 24px;
  background: var(--gradient-primary);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: white;
}

.course-title {
  font-size: 13px;
  font-weight: 600;
}

.course-inputs {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.mini-input-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.mini-input-group label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.mini-select,
.mini-input {
  width: 100%;
  height: 38px;
  padding: 0 12px;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 13px;
  font-weight: 500;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.2s ease;
}

.mini-select:focus,
.mini-input:focus {
  outline: none;
  border-color: var(--accent-primary);
}

/* Previous Semesters */
.prev-section {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 24px 28px;
  backdrop-filter: blur(10px);
}

.semesters-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 14px;
}

.semester-input {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.semester-input label {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
}

.semester-input .mini-input {
  height: 36px;
  font-size: 13px;
}

.calc-submit {
  max-width: 300px;
  margin: 16px auto 0;
}

/* ============================================
   Results Panel
   ============================================ */
.results-panel {
  width: 100%;
  max-width: 900px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 28px;
  backdrop-filter: blur(20px);
}

.results-header {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-color);
}

.results-header svg {
  width: 22px;
  height: 22px;
  color: #fbbf24;
}

/* Result Cards */
.results-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 24px;
}

.result-card {
  position: relative;
  padding: 20px;
  border-radius: 16px;
  overflow: hidden;
}

.gpa-card {
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.15) 0%, rgba(99, 102, 241, 0.15) 100%);
  border: 1px solid rgba(168, 85, 247, 0.2);
}

.cgpa-card {
  background: linear-gradient(135deg, rgba(6, 182, 212, 0.15) 0%, rgba(99, 102, 241, 0.15) 100%);
  border: 1px solid rgba(6, 182, 212, 0.2);
}

.result-label {
  font-size: 13px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
}

.result-value {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 40px;
  font-weight: 700;
  margin-bottom: 4px;
}

.gpa-card .result-value {
  background: linear-gradient(135deg, #a855f7, #6366f1);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.cgpa-card .result-value {
  background: linear-gradient(135deg, #06b6d4, #6366f1);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.result-grade {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
}

/* Result Ring */
.result-ring {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 56px;
  height: 56px;
}

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

.ring-bg {
  fill: none;
  stroke: var(--border-color);
  stroke-width: 3;
}

.ring-progress {
  fill: none;
  stroke-width: 3;
  stroke-linecap: round;
  transition: stroke-dasharray 1s ease;
}

.gpa-ring {
  stroke: url(#gpaGradient);
  stroke: #a855f7;
}

.cgpa-ring {
  stroke: url(#cgpaGradient);
  stroke: #06b6d4;
}

/* Performance Bar */
.performance-bar {
  margin-bottom: 20px;
}

.perf-label {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.perf-track {
  width: 100%;
  height: 8px;
  background: var(--bg-secondary);
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 10px;
}

.perf-fill {
  height: 100%;
  border-radius: 10px;
  transition: all 1s ease;
  width: 0%;
}

.perf-fill.excellent { background: linear-gradient(90deg, #22c55e, #10b981); }
.perf-fill.good { background: linear-gradient(90deg, #3b82f6, #6366f1); }
.perf-fill.average { background: linear-gradient(90deg, #f59e0b, #eab308); }
.perf-fill.needs-work { background: linear-gradient(90deg, #ef4444, #f87171); }

.perf-text {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* Reset Button */
.reset-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  height: 48px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
}

.reset-btn:hover {
  border-color: var(--accent-primary);
  color: var(--text-primary);
}

.reset-btn svg {
  width: 18px;
  height: 18px;
}

/* ============================================
   Animations
   ============================================ */
.animate-in {
  opacity: 0;
  transform: translateY(20px);
  animation: animateIn 0.6s ease forwards;
  animation-delay: var(--delay, 0s);
}

@keyframes animateIn {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ============================================
   Confetti Canvas
   ============================================ */
#confettiCanvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1000;
}

/* ============================================
   Responsive Design - Mobile First
   ============================================ */

/* Extra Large Screens */
@media (max-width: 1400px) {
  .home-section {
    gap: 40px;
    padding: 30px 40px;
  }
  
  .courses-grid {
    grid-template-columns: repeat(4, 1fr);
  }
  
  .semesters-grid {
    grid-template-columns: repeat(7, 1fr);
  }
}

/* Large Screens */
@media (max-width: 1200px) {
  .home-section {
    gap: 30px;
    padding: 25px 30px;
  }
  
  .hero-title {
    font-size: clamp(40px, 5vw, 60px);
  }
  
  .hero-description {
    font-size: 16px;
  }
  
  .results-panel {
    max-width: 100%;
  }
  
  .calculator-section {
    padding: 40px 30px 30px;
  }
}

/* Medium-Large Screens */
@media (max-width: 1024px) {
  .home-section {
    grid-template-columns: 1fr;
    gap: 35px;
    padding: 20px 25px;
    height: auto;
    min-height: 100vh;
    overflow-y: auto;
    align-content: center;
  }
  
  .hero-side {
    text-align: center;
    align-items: center;
  }
  
  .hero-content {
    align-items: center;
  }
  
  .hero-description {
    max-width: 500px;
  }
  
  .feature-pills {
    justify-content: center;
  }
  
  .floating-stats {
    justify-content: center;
  }
  
  .form-side {
    width: 100%;
    max-width: 450px;
    margin: 0 auto;
  }
  
  .form-card {
    max-width: 100%;
  }
  
  .courses-grid {
    grid-template-columns: repeat(4, 1fr);
  }
  
  .courses-section,
  .prev-section {
    max-width: 100%;
  }
  
  .calc-container {
    padding-top: 10px;
  }
}

/* Tablets */
@media (max-width: 900px) {
  .home-section {
    gap: 30px;
    padding: 20px;
  }
  
  .hero-title {
    font-size: clamp(36px, 8vw, 50px);
  }
  
  .stat-card {
    padding: 16px 22px;
    min-width: 85px;
  }
  
  .stat-value {
    font-size: 26px;
  }
  
  .stat-label {
    font-size: 11px;
  }
  
  .form-inner {
    padding: 30px;
  }
  
  .courses-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
  }
  
  .semesters-grid {
    grid-template-columns: repeat(7, 1fr);
    gap: 10px;
  }
  
  .calculator-section {
    padding: 30px 20px 20px;
  }
  
  .calc-header {
    margin-bottom: 30px;
  }
  
  .calc-title {
    font-size: clamp(24px, 5vw, 36px);
  }
}

/* Small Tablets / Large Phones */
@media (max-width: 768px) {
  .theme-toggle {
    top: 16px;
    right: 16px;
    width: 42px;
    height: 42px;
  }
  
  .hero-title {
    font-size: clamp(32px, 9vw, 44px);
  }
  
  .hero-description {
    font-size: 15px;
  }
  
  .pill {
    padding: 8px 14px;
    font-size: 13px;
  }
  
  .pill svg {
    width: 14px;
    height: 14px;
  }
  
  .floating-stats {
    gap: 14px;
  }
  
  .form-inner {
    padding: 24px;
  }
  
  .form-header h2 {
    font-size: 24px;
  }
  
  .input-wrapper input {
    height: 50px;
    font-size: 18px;
  }
  
  .submit-btn {
    height: 52px;
  }
  
  .courses-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }
  
  .semesters-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
  }
  
  .prev-section {
    padding: 20px;
  }
  
  .results-cards {
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }
  
  .result-card {
    padding: 16px;
  }
  
  .result-value {
    font-size: 32px;
  }
  
  .result-ring {
    width: 48px;
    height: 48px;
    top: 12px;
    right: 12px;
  }
  
  .calc-header {
    flex-direction: column;
    gap: 16px;
  }
  
  .back-btn {
    position: static;
  }
}

/* Phones */
@media (max-width: 600px) {
  .home-section {
    padding: 16px;
    gap: 25px;
  }
  
  .badge {
    padding: 6px 12px;
    font-size: 12px;
  }
  
  .hero-title {
    font-size: clamp(28px, 10vw, 38px);
  }
  
  .hero-description {
    font-size: 14px;
    line-height: 1.6;
  }
  
  .feature-pills {
    gap: 8px;
  }
  
  .pill {
    padding: 7px 12px;
    font-size: 12px;
  }
  
  .floating-stats {
    gap: 12px;
  }
  
  .stat-card {
    padding: 14px 18px;
    min-width: 75px;
  }
  
  .stat-value {
    font-size: 22px;
  }
  
  .stat-label {
    font-size: 10px;
  }
  
  .form-inner {
    padding: 20px;
  }
  
  .form-icon {
    width: 50px;
    height: 50px;
  }
  
  .form-icon svg {
    width: 24px;
    height: 24px;
  }
  
  .form-header h2 {
    font-size: 22px;
  }
  
  .form-header p {
    font-size: 14px;
  }
  
  .input-group label {
    font-size: 13px;
  }
  
  .input-wrapper input {
    height: 48px;
    font-size: 16px;
    padding: 0 16px;
  }
  
  .input-hint {
    font-size: 11px;
  }
  
  .submit-btn {
    height: 50px;
  }
  
  .btn-text {
    font-size: 15px;
  }
  
  .calculator-section {
    padding: 20px 16px 16px;
  }
  
  .calc-container {
    padding-top: 5px;
  }
  
  .calc-header {
    margin-bottom: 24px;
  }
  
  .calc-title {
    font-size: clamp(22px, 6vw, 28px);
  }
  
  .back-btn {
    padding: 10px 16px;
    font-size: 13px;
  }
  
  .section-header {
    font-size: 14px;
    margin-bottom: 14px;
  }
  
  .courses-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }
  
  .course-card {
    padding: 12px;
    border-radius: 12px;
  }
  
  .course-header {
    margin-bottom: 10px;
  }
  
  .course-num {
    width: 22px;
    height: 22px;
    font-size: 11px;
  }
  
  .course-title {
    font-size: 12px;
  }
  
  .mini-input-group label {
    font-size: 10px;
  }
  
  .mini-select,
  .mini-input {
    height: 36px;
    font-size: 12px;
    padding: 0 10px;
  }
  
  .semesters-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
  }
  
  .prev-section {
    padding: 16px;
  }
  
  .semester-input label {
    font-size: 10px;
  }
  
  .semester-input .mini-input {
    height: 34px;
    font-size: 12px;
  }
  
  .calc-submit {
    max-width: 100%;
  }
  
  .calc-form {
    gap: 24px;
  }
  
  .results-panel {
    padding: 20px;
    border-radius: 16px;
  }
  
  .results-header {
    font-size: 16px;
    margin-bottom: 18px;
    padding-bottom: 14px;
  }
  
  .results-cards {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  
  .result-card {
    padding: 18px;
  }
  
  .result-label {
    font-size: 11px;
  }
  
  .result-value {
    font-size: 36px;
  }
  
  .result-grade {
    font-size: 13px;
  }
  
  .perf-label {
    font-size: 12px;
  }
  
  .perf-text {
    font-size: 12px;
  }
  
  .reset-btn {
    height: 44px;
    font-size: 13px;
  }
}

/* Extra Small Phones */
@media (max-width: 400px) {
  .home-section {
    padding: 12px;
  }
  
  .hero-title {
    font-size: 26px;
  }
  
  .feature-pills {
    flex-direction: column;
    align-items: center;
  }
  
  .pill {
    width: 100%;
    max-width: 200px;
    justify-content: center;
  }
  
  .floating-stats {
    width: 100%;
  }
  
  .stat-card {
    flex: 1;
  }
  
  .form-inner {
    padding: 16px;
  }
  
  .courses-grid {
    grid-template-columns: 1fr;
  }
  
  .semesters-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Landscape Phones */
@media (max-height: 500px) and (orientation: landscape) {
  .home-section {
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    padding: 15px 20px;
    height: auto;
    min-height: 100vh;
    overflow-y: auto;
  }
  
  .hero-side {
    text-align: left;
    align-items: flex-start;
  }
  
  .hero-content {
    align-items: flex-start;
  }
  
  .feature-pills {
    justify-content: flex-start;
  }
  
  .floating-stats {
    justify-content: flex-start;
  }
  
  .hero-title {
    font-size: 28px;
  }
  
  .hero-description {
    font-size: 13px;
  }
  
  .form-inner {
    padding: 16px;
  }
  
  .form-header {
    margin-bottom: 16px;
  }
  
  .form-icon {
    width: 40px;
    height: 40px;
  }
  
  .form-header h2 {
    font-size: 20px;
  }
  
  .input-wrapper input {
    height: 40px;
  }
  
  .submit-btn {
    height: 44px;
  }
}

/* ============================================
   Scrollbar Styling
   ============================================ */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* ============================================
   Reduced Motion
   ============================================ */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  
  .gradient-orb {
    animation: none;
  }
}

/* ============================================
   Print Styles
   ============================================ */
@media print {
  .bg-container,
  .theme-toggle,
  #confettiCanvas {
    display: none !important;
  }
  
  body {
    background: white;
    color: black;
  }
}
