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

:root {
  --bg-dark: #0a0e1a;
  --bg-card: rgba(15, 20, 40, 0.75);
  --bg-card-border: rgba(100, 140, 255, 0.15);
  --bg-input: rgba(20, 28, 58, 0.8);
  --accent-primary: #6c5ce7;
  --accent-secondary: #00cec9;
  --accent-warm: #fd79a8;
  --accent-gold: #fdcb6e;
  --text-primary: #e8eaf6;
  --text-secondary: #9aa0b8;
  --text-muted: #5c6380;
  --gradient-primary: linear-gradient(135deg, #6c5ce7 0%, #a29bfe 100%);
  --gradient-secondary: linear-gradient(135deg, #00cec9 0%, #55efc4 100%);
  --gradient-warm: linear-gradient(135deg, #fd79a8 0%, #e17055 100%);
  --gradient-gold: linear-gradient(135deg, #fdcb6e 0%, #f39c12 100%);
  --shadow-glow: 0 0 40px rgba(108, 92, 231, 0.2);
  --shadow-card: 0 20px 60px rgba(0, 0, 0, 0.4), 0 0 1px rgba(100, 140, 255, 0.3);
  --radius-lg: 24px;
  --radius-md: 16px;
  --radius-sm: 12px;
  --radius-xs: 8px;
  --font-main: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-display: 'Space Grotesk', sans-serif;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-main);
  background: var(--bg-dark);
  color: var(--text-primary);
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  padding-top: var(--safe-top);
  padding-bottom: var(--safe-bottom);
  padding-left: var(--safe-left);
  padding-right: var(--safe-right);
}

/* ===== Animated Background ===== */
.bg-scene {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

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

.orb-1 {
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, #6c5ce7 0%, transparent 70%);
  top: -10%;
  left: -5%;
  animation-delay: 0s;
  animation-duration: 25s;
}

.orb-2 {
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, #00cec9 0%, transparent 70%);
  top: 40%;
  right: -10%;
  animation-delay: -5s;
  animation-duration: 22s;
}

.orb-3 {
  width: 350px;
  height: 350px;
  background: radial-gradient(circle, #fd79a8 0%, transparent 70%);
  bottom: -5%;
  left: 30%;
  animation-delay: -10s;
  animation-duration: 28s;
}

.orb-4 {
  width: 300px;
  height: 300px;
  background: radial-gradient(circle, #fdcb6e 0%, transparent 70%);
  top: 20%;
  left: 50%;
  animation-delay: -15s;
  animation-duration: 30s;
  opacity: 0.2;
}

@keyframes floatOrb {
  0%, 100% { transform: translate(0, 0) scale(1); }
  25% { transform: translate(60px, -40px) scale(1.1); }
  50% { transform: translate(-30px, 60px) scale(0.9); }
  75% { transform: translate(40px, 20px) scale(1.05); }
}

.grid-floor {
  position: absolute;
  bottom: 0;
  left: -50%;
  width: 200%;
  height: 50%;
  background: 
    linear-gradient(90deg, rgba(108, 92, 231, 0.05) 1px, transparent 1px),
    linear-gradient(0deg, rgba(108, 92, 231, 0.05) 1px, transparent 1px);
  background-size: 60px 60px;
  transform: perspective(500px) rotateX(60deg);
  transform-origin: bottom center;
  opacity: 0.5;
  mask-image: linear-gradient(to top, rgba(0,0,0,0.5), transparent 60%);
  -webkit-mask-image: linear-gradient(to top, rgba(0,0,0,0.5), transparent 60%);
}

/* ===== User Bar ===== */
.user-bar {
  position: relative;
  z-index: 20;
  padding: 12px 20px;
}

.user-bar-inner {
  max-width: 680px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--gradient-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.85rem;
  color: white;
  box-shadow: 0 2px 10px rgba(108, 92, 231, 0.3);
}

.user-name {
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.btn-logout {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(253, 121, 168, 0.08);
  border: 1px solid rgba(253, 121, 168, 0.15);
  color: var(--accent-warm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s;
}

.btn-logout:hover {
  background: rgba(253, 121, 168, 0.2);
  border-color: var(--accent-warm);
  transform: scale(1.08);
}

/* ===== Header ===== */
.header {
  position: relative;
  z-index: 10;
  text-align: center;
  padding: 20px 20px 32px;
}

.header-inner {
  max-width: 700px;
  margin: 0 auto;
}

.logo-3d {
  font-family: var(--font-display);
  font-size: clamp(2.4rem, 6vw, 4rem);
  font-weight: 900;
  letter-spacing: -1px;
  line-height: 1.1;
  text-shadow: 
    0 0 30px rgba(108, 92, 231, 0.5),
    0 4px 8px rgba(0, 0, 0, 0.3);
  animation: logoEntrance 1s ease-out;
  transform-style: preserve-3d;
  perspective: 800px;
}

.logo-whats {
  color: var(--text-primary);
}

.logo-my {
  background: var(--gradient-secondary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

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

@keyframes logoEntrance {
  from {
    opacity: 0;
    transform: translateY(-30px) rotateX(20deg);
  }
  to {
    opacity: 1;
    transform: translateY(0) rotateX(0);
  }
}

.header-subtitle {
  margin-top: 12px;
  font-size: 0.95rem;
  color: var(--text-secondary);
  font-weight: 400;
  letter-spacing: 0.5px;
  animation: fadeInUp 1s ease-out 0.2s both;
}

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

/* ===== Main Container ===== */
.main-container {
  position: relative;
  z-index: 10;
  max-width: 680px;
  margin: 0 auto;
  padding: 0 20px 60px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

/* ===== 3D Card ===== */
.card-3d {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--bg-card-border);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: var(--shadow-card);
  transition: transform 0.4s cubic-bezier(0.23, 1, 0.32, 1), box-shadow 0.4s ease;
  transform-style: preserve-3d;
  perspective: 1000px;
  animation: cardEntrance 0.7s ease-out both;
}

.card-3d:nth-child(1) { animation-delay: 0.1s; z-index: 4; }
.card-3d:nth-child(2) { animation-delay: 0.2s; z-index: 3; }
.card-3d:nth-child(3) { animation-delay: 0.3s; z-index: 2; }
.card-3d:nth-child(4) { animation-delay: 0.4s; z-index: 1; }

@keyframes cardEntrance {
  from {
    opacity: 0;
    transform: translateY(40px) rotateX(5deg);
  }
  to {
    opacity: 1;
    transform: translateY(0) rotateX(0);
  }
}

.card-3d::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(108, 92, 231, 0.4), rgba(0, 206, 201, 0.3), transparent);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.card-3d:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-card), 0 0 60px rgba(108, 92, 231, 0.15);
}

.card-inner {
  padding: 32px;
  position: relative;
}

/* Step 1 needs overflow visible for dropdown */
#step1 {
  overflow: visible;
  z-index: 30;
}
#step1 .card-inner {
  overflow: visible;
}
#step2 {
  z-index: 20;
}
#step3 {
  z-index: 10;
}
#resultsCard {
  z-index: 5;
}


/* ===== Step Badge ===== */
.step-badge {
  width: 40px;
  height: 40px;
  background: var(--gradient-primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.1rem;
  color: white;
  margin-bottom: 16px;
  box-shadow: 0 4px 20px rgba(108, 92, 231, 0.4);
  position: relative;
}

.step-badge::after {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  background: var(--gradient-primary);
  opacity: 0.2;
  animation: pulseBadge 3s ease-in-out infinite;
}

@keyframes pulseBadge {
  0%, 100% { transform: scale(1); opacity: 0.2; }
  50% { transform: scale(1.15); opacity: 0.1; }
}

.step-title {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 600;
  margin-bottom: 20px;
  color: var(--text-primary);
}

/* ===== University Search / Select ===== */
.select-wrapper {
  position: relative;
  z-index: 100;
}

.search-input {
  width: 100%;
  padding: 14px 18px;
  background: var(--bg-input);
  border: 1px solid rgba(108, 92, 231, 0.2);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-main);
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.3s, box-shadow 0.3s;
  -webkit-appearance: none;
}

.search-input::placeholder {
  color: var(--text-muted);
}

.search-input:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(108, 92, 231, 0.15);
}

.dropdown-list {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  max-height: 280px;
  overflow-y: auto;
  background: rgba(15, 20, 45, 0.98);
  border: 1px solid var(--bg-card-border);
  border-radius: var(--radius-sm);
  z-index: 9999;
  display: none;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
}

.dropdown-list.open {
  display: block;
  animation: dropdownOpen 0.25s ease-out;
}

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

.dropdown-item {
  padding: 12px 18px;
  cursor: pointer;
  transition: background 0.2s;
  border-bottom: 1px solid rgba(100, 140, 255, 0.06);
}

.dropdown-item:hover {
  background: rgba(108, 92, 231, 0.15);
}

.dropdown-item .uni-name {
  font-weight: 500;
  font-size: 0.93rem;
  color: var(--text-primary);
}

.dropdown-item .uni-location {
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

.dropdown-list::-webkit-scrollbar {
  width: 6px;
}
.dropdown-list::-webkit-scrollbar-track {
  background: transparent;
}
.dropdown-list::-webkit-scrollbar-thumb {
  background: rgba(108, 92, 231, 0.3);
  border-radius: 3px;
}

/* ===== Grade Type Options ===== */
.grade-type-options {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.grade-type-option {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  background: var(--bg-input);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.3s ease;
}

.grade-type-option:hover {
  border-color: rgba(108, 92, 231, 0.3);
  transform: translateX(4px);
}

.grade-type-option.active {
  border-color: var(--accent-primary);
  background: rgba(108, 92, 231, 0.1);
  box-shadow: 0 0 20px rgba(108, 92, 231, 0.15);
}

.radio-custom {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid var(--text-muted);
  position: relative;
  flex-shrink: 0;
  transition: border-color 0.3s;
}

.grade-type-option.active .radio-custom {
  border-color: var(--accent-primary);
}

.grade-type-option.active .radio-custom::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 10px;
  height: 10px;
  background: var(--gradient-primary);
  border-radius: 50%;
  animation: radioIn 0.3s ease;
}

@keyframes radioIn {
  from { transform: scale(0); }
  to { transform: scale(1); }
}

.grade-type-label {
  font-size: 0.95rem;
  font-weight: 500;
}

.grade-type-example {
  margin-left: auto;
  font-size: 0.82rem;
  color: var(--text-muted);
  font-style: italic;
}

/* ===== Semester Tabs ===== */
.semester-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  flex-wrap: wrap;
  align-items: center;
}

.semester-tab {
  padding: 8px 14px;
  background: var(--bg-input);
  border: 1px solid transparent;
  border-radius: var(--radius-xs);
  color: var(--text-secondary);
  font-family: var(--font-main);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.semester-tab:hover {
  color: var(--text-primary);
  border-color: rgba(108, 92, 231, 0.2);
}

.semester-tab.active {
  background: rgba(108, 92, 231, 0.15);
  border-color: var(--accent-primary);
  color: var(--text-primary);
}

.semester-delete {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  font-size: 0.85rem;
  line-height: 1;
  color: var(--text-muted);
  opacity: 0;
  transition: all 0.2s;
  flex-shrink: 0;
}

.semester-tab:hover .semester-delete {
  opacity: 0.6;
}

.semester-delete:hover {
  opacity: 1 !important;
  background: rgba(253, 121, 168, 0.2);
  color: var(--accent-warm);
}

.add-semester-btn {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-xs);
  background: rgba(0, 206, 201, 0.1);
  border: 1px dashed rgba(0, 206, 201, 0.3);
  color: var(--accent-secondary);
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s;
}

.add-semester-btn:hover {
  background: rgba(0, 206, 201, 0.2);
  border-color: var(--accent-secondary);
  transform: scale(1.05);
}

/* ===== Grade Table ===== */
.grade-table {
  margin-bottom: 24px;
}

.grade-table-header {
  display: grid;
  grid-template-columns: 1fr 1fr 40px;
  gap: 12px;
  padding: 0 4px 10px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.grade-rows {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.grade-row {
  display: grid;
  grid-template-columns: 1fr 1fr 40px;
  gap: 12px;
  align-items: center;
  animation: rowSlideIn 0.3s ease-out;
}

@keyframes rowSlideIn {
  from { opacity: 0; transform: translateX(-10px); }
  to { opacity: 1; transform: translateX(0); }
}

.grade-input, .credit-input {
  width: 100%;
  padding: 12px 14px;
  background: var(--bg-input);
  border: 1px solid rgba(108, 92, 231, 0.12);
  border-radius: var(--radius-xs);
  color: var(--text-primary);
  font-family: var(--font-main);
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.3s, box-shadow 0.3s, background 0.3s;
  -webkit-appearance: none;
}

.grade-input:focus, .credit-input:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(108, 92, 231, 0.1);
  background: rgba(25, 35, 70, 0.9);
}

.grade-input.valid {
  border-color: rgba(0, 206, 201, 0.4);
}

.grade-input.invalid {
  border-color: rgba(253, 121, 168, 0.4);
}

.remove-row-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(253, 121, 168, 0.08);
  border: 1px solid rgba(253, 121, 168, 0.15);
  color: var(--accent-warm);
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s;
  opacity: 0.5;
}

.remove-row-btn:hover {
  opacity: 1;
  background: rgba(253, 121, 168, 0.15);
  border-color: var(--accent-warm);
  transform: scale(1.1);
}

/* ===== Buttons ===== */
.action-buttons {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 22px;
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font-main);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.23, 1, 0.32, 1);
  position: relative;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}

.btn::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  opacity: 0;
  transition: opacity 0.3s;
}

.btn:hover::before {
  opacity: 1;
}

.btn:active {
  transform: scale(0.97);
}

.btn-clear {
  background: rgba(253, 121, 168, 0.1);
  color: var(--accent-warm);
  border: 1px solid rgba(253, 121, 168, 0.2);
}

.btn-clear:hover {
  background: rgba(253, 121, 168, 0.2);
  border-color: var(--accent-warm);
  box-shadow: 0 0 20px rgba(253, 121, 168, 0.15);
}

.btn-add {
  background: rgba(0, 206, 201, 0.1);
  color: var(--accent-secondary);
  border: 1px solid rgba(0, 206, 201, 0.2);
}

.btn-add:hover {
  background: rgba(0, 206, 201, 0.2);
  border-color: var(--accent-secondary);
  box-shadow: 0 0 20px rgba(0, 206, 201, 0.15);
}

.btn-calculate {
  background: var(--gradient-primary);
  color: white;
  border: none;
  box-shadow: 0 4px 20px rgba(108, 92, 231, 0.3);
  margin-left: auto;
}

.btn-calculate:hover {
  box-shadow: 0 6px 30px rgba(108, 92, 231, 0.5);
  transform: translateY(-2px);
}

.btn-chart {
  background: rgba(253, 203, 110, 0.1);
  color: var(--accent-gold);
  border: 1px solid rgba(253, 203, 110, 0.2);
  margin: 20px auto 0;
}

.btn-chart:hover {
  background: rgba(253, 203, 110, 0.2);
  border-color: var(--accent-gold);
  box-shadow: 0 0 20px rgba(253, 203, 110, 0.15);
}

/* ===== Results ===== */
.results-card {
  animation: resultsPop 0.6s cubic-bezier(0.23, 1, 0.32, 1) both !important;
}

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

.results-title {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 700;
  text-align: center;
  margin-bottom: 24px;
  background: var(--gradient-secondary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
}

.result-item {
  background: rgba(20, 28, 58, 0.6);
  border: 1px solid rgba(100, 140, 255, 0.1);
  border-radius: var(--radius-md);
  padding: 24px 20px;
  text-align: center;
  transition: all 0.3s;
  position: relative;
  overflow: hidden;
}

.result-item::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  border-radius: var(--radius-md) var(--radius-md) 0 0;
}

.result-item:nth-child(1)::before { background: var(--gradient-primary); }
.result-item:nth-child(2)::before { background: var(--gradient-secondary); }
.result-item:nth-child(3)::before { background: var(--gradient-warm); }
.result-item:nth-child(4)::before { background: var(--gradient-gold); }
.result-item:nth-child(5)::before { background: linear-gradient(135deg, #74b9ff 0%, #0984e3 100%); }

.result-item:hover {
  transform: translateY(-4px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  border-color: rgba(108, 92, 231, 0.3);
}

.result-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 10px;
}

.result-value {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1;
}

.result-max {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 6px;
}

/* ===== Modal ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
}

.modal-overlay.open {
  display: flex;
  animation: modalOverlayIn 0.3s ease;
}

@keyframes modalOverlayIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-3d {
  background: rgba(15, 20, 45, 0.97);
  border: 1px solid var(--bg-card-border);
  border-radius: var(--radius-lg);
  max-width: 700px;
  width: 100%;
  max-height: 80vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
  animation: modalIn 0.4s cubic-bezier(0.23, 1, 0.32, 1);
}

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

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 28px 16px;
  border-bottom: 1px solid rgba(100, 140, 255, 0.1);
}

.modal-title {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 600;
}

.modal-close {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(253, 121, 168, 0.1);
  border: 1px solid rgba(253, 121, 168, 0.2);
  color: var(--accent-warm);
  font-size: 1.3rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s;
}

.modal-close:hover {
  background: rgba(253, 121, 168, 0.2);
  transform: rotate(90deg);
}

.modal-body {
  padding: 20px 28px;
  overflow-y: auto;
  flex: 1;
  -webkit-overflow-scrolling: touch;
}

.modal-body::-webkit-scrollbar {
  width: 6px;
}
.modal-body::-webkit-scrollbar-track {
  background: transparent;
}
.modal-body::-webkit-scrollbar-thumb {
  background: rgba(108, 92, 231, 0.3);
  border-radius: 3px;
}

.conversion-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 16px;
}

.conversion-table th {
  background: rgba(108, 92, 231, 0.1);
  padding: 10px 14px;
  text-align: left;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid rgba(100, 140, 255, 0.1);
  white-space: nowrap;
}

.conversion-table td {
  padding: 10px 14px;
  font-size: 0.9rem;
  border-bottom: 1px solid rgba(100, 140, 255, 0.05);
  color: var(--text-primary);
  white-space: nowrap;
}

.conversion-table tr:hover td {
  background: rgba(108, 92, 231, 0.05);
}

.modal-footer {
  padding: 14px 28px;
  border-top: 1px solid rgba(100, 140, 255, 0.1);
  font-size: 0.78rem;
  color: var(--text-muted);
}

.modal-footer a {
  color: var(--accent-secondary);
  text-decoration: none;
}

/* ===== Auth Pages ===== */
.auth-page {
  position: relative;
  z-index: 10;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
}

.auth-logo {
  font-family: var(--font-display);
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 900;
  letter-spacing: -1px;
  margin-bottom: 32px;
  text-shadow: 
    0 0 30px rgba(108, 92, 231, 0.5),
    0 4px 8px rgba(0, 0, 0, 0.3);
  animation: logoEntrance 1s ease-out;
}

.auth-card {
  max-width: 440px;
  width: 100%;
}

.auth-title {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 700;
  margin-bottom: 8px;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.auth-subtitle {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 28px;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.form-input {
  width: 100%;
  padding: 14px 18px;
  background: var(--bg-input);
  border: 1px solid rgba(108, 92, 231, 0.15);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-main);
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.3s, box-shadow 0.3s;
  -webkit-appearance: none;
}

.form-input::placeholder {
  color: var(--text-muted);
}

.form-input:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(108, 92, 231, 0.15);
}

.btn-auth {
  width: 100%;
  padding: 16px;
  background: var(--gradient-primary);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font-main);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s;
  box-shadow: 0 4px 20px rgba(108, 92, 231, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 8px;
  -webkit-tap-highlight-color: transparent;
}

.btn-auth:hover {
  box-shadow: 0 6px 30px rgba(108, 92, 231, 0.5);
  transform: translateY(-2px);
}

.btn-auth:active {
  transform: scale(0.98);
}

.btn-auth:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.auth-error {
  padding: 12px 16px;
  background: rgba(253, 121, 168, 0.1);
  border: 1px solid rgba(253, 121, 168, 0.25);
  border-radius: var(--radius-xs);
  color: var(--accent-warm);
  font-size: 0.88rem;
  font-weight: 500;
  margin-bottom: 8px;
  animation: fadeInUp 0.3s ease-out;
}

.auth-switch {
  text-align: center;
  margin-top: 24px;
  font-size: 0.88rem;
  color: var(--text-muted);
}

.auth-switch a {
  color: var(--accent-secondary);
  text-decoration: none;
  font-weight: 600;
  transition: color 0.2s;
}

.auth-switch a:hover {
  color: #55efc4;
}

/* ===== No Selection Message ===== */
.no-selection-msg {
  text-align: center;
  padding: 20px;
  color: var(--text-muted);
  font-size: 0.9rem;
  font-style: italic;
}

/* ===== Animations for dynamic elements ===== */
.fade-in {
  animation: fadeInUp 0.4s ease-out both;
}

/* ===== Responsive — Tablet & Small Desktop ===== */
@media (max-width: 768px) {
  .header { padding: 16px 16px 24px; }
  .main-container { padding: 0 16px 50px; gap: 22px; }
  .card-inner { padding: 24px 20px; }
  .step-title { font-size: 1.15rem; }
  .results-grid { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
  .user-bar { padding: 10px 16px; }
}

/* ===== Responsive — Mobile ===== */
@media (max-width: 600px) {
  .card-inner { padding: 22px 16px; }
  .step-title { font-size: 1.05rem; margin-bottom: 16px; }
  .grade-table-header { grid-template-columns: 1fr 1fr 34px; gap: 8px; }
  .grade-row { grid-template-columns: 1fr 1fr 34px; gap: 8px; }
  .grade-input, .credit-input { padding: 10px 12px; font-size: 0.88rem; }
  .action-buttons { flex-direction: column; }
  .btn-calculate { margin-left: 0; }
  .btn { padding: 12px 18px; font-size: 0.88rem; justify-content: center; }
  .results-grid { grid-template-columns: 1fr 1fr; }
  .header { padding: 12px 16px 20px; }
  .grade-type-example { display: none; }
  .grade-type-option { padding: 12px 14px; gap: 12px; }
  .modal-3d { max-height: 90vh; border-radius: var(--radius-md); }
  .modal-header, .modal-body, .modal-footer { padding-left: 16px; padding-right: 16px; }
  .step-badge { width: 36px; height: 36px; font-size: 1rem; }
  .semester-tab { padding: 7px 14px; font-size: 0.82rem; }
  .add-semester-btn { width: 30px; height: 30px; font-size: 1rem; }
  .result-value { font-size: 1.6rem; }
  .result-item { padding: 18px 14px; }
  .user-name { display: none; }
}

/* ===== Responsive — Small Mobile ===== */
@media (max-width: 400px) {
  .main-container { padding: 0 12px 40px; gap: 18px; }
  .card-inner { padding: 18px 14px; }
  .results-grid { grid-template-columns: 1fr; }
  .header-subtitle { font-size: 0.82rem; }
  .logo-3d { font-size: 2rem; }
  .grade-table-header { grid-template-columns: 1fr 1fr 30px; gap: 6px; }
  .grade-row { grid-template-columns: 1fr 1fr 30px; gap: 6px; }
  .remove-row-btn { width: 28px; height: 28px; font-size: 0.9rem; }
  .grade-input, .credit-input { padding: 10px; border-radius: 6px; }
  .auth-card .card-inner { padding: 24px 18px; }
  .modal-3d { margin: 10px; }
}

/* ===== Responsive — Very Small (320px) ===== */
@media (max-width: 340px) {
  .logo-3d { font-size: 1.8rem; }
  .card-inner { padding: 16px 12px; }
  .step-title { font-size: 0.95rem; }
  .btn { padding: 10px 14px; font-size: 0.82rem; }
}
