:root {
  --bg: #f5f8ff;
  --surface: #ffffff;
  --surface-muted: #eef4ff;
  --text: #111827;
  --muted: #6b7280;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --danger: #dc2626;
  --border: rgba(37, 99, 235, 0.15);
  --shadow: 0 20px 60px rgba(15, 23, 42, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: radial-gradient(circle at top left, rgba(37, 99, 235, 0.12), transparent 30%),
              radial-gradient(circle at bottom right, rgba(59, 130, 246, 0.14), transparent 25%),
              var(--bg);
  color: var(--text);
}

.page-shell {
  max-width: 960px;
  margin: 2rem auto;
  padding: 0 1rem 2rem;
}

.card {
  background: linear-gradient(180deg, #ffffff 0%, #f9fbff 100%);
  border: 1px solid rgba(37, 99, 235, 0.12);
  border-radius: 28px;
  box-shadow: var(--shadow);
  padding: 2rem;
}

.hero {
  display: grid;
  gap: 1rem;
  align-items: center;
  grid-template-columns: 1fr auto;
  margin-bottom: 1.75rem;
}

.hero h1 {
  margin: 0;
  font-size: clamp(1.85rem, 2.5vw, 2.4rem);
  line-height: 1.05;
  color: #1d4ed8;
}

.hero p {
  margin: 0.75rem 0 0;
  color: var(--muted);
  max-width: 52rem;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1rem;
  background: rgba(59, 130, 246, 0.14);
  color: #1d4ed8;
  border-radius: 999px;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.field-group,
.subject-row {
  margin-bottom: 1.25rem;
}

.subject-option {
  margin-bottom: 1.25rem;
  padding: 1rem 1rem 0.75rem;
  background: rgba(37, 99, 235, 0.06);
  border-radius: 18px;
  border: 1px solid rgba(37, 99, 235, 0.12);
}

label {
  display: block;
  margin-bottom: 0.55rem;
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 600;
}

select {
  width: 100%;
  min-height: 3.15rem;
  padding: 0.85rem 1rem;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 1rem;
  transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.12);
  transform: translateY(-1px);
}

input {
  width: 100%;
  min-height: 3.15rem;
  padding: 0.85rem 1rem;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 1rem;
  transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.12);
  transform: translateY(-1px);
}

.subject-card {
  padding: 1.35rem 1.25rem;
  background: linear-gradient(180deg, rgba(59,130,246,0.08), rgba(255,255,255,0.9));
  border-radius: 24px;
  border: 1px solid rgba(37, 99, 235, 0.12);
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.subject-card:hover {
  transform: translateY(-2px);
  border-color: rgba(37, 99, 235, 0.3);
  box-shadow: 0 18px 36px rgba(37, 99, 235, 0.08);
}

.subject-title {
  margin: 0 0 1rem;
  font-size: 1rem;
  font-weight: 700;
}

.subject-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.option-row {
  display: grid;
  gap: 0.75rem;
}

.primary-btn {
  width: 100%;
  border: none;
  border-radius: 18px;
  padding: 1rem 1.25rem;
  font-size: 1rem;
  font-weight: 700;
  color: white;
  background: linear-gradient(135deg,#2563eb,#1d4ed8);
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
  margin-top: 0.5rem;
}

.primary-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 18px 40px rgba(37, 99, 235, 0.2);
}

.result-card {
  margin-top: 1.5rem;
  padding: 1.5rem;
  border-radius: 24px;
  background: linear-gradient(180deg, rgba(59,130,246,.12), rgba(255,255,255,.96));
  border: 1px solid rgba(37, 99, 235, 0.18);
}

.result-label {
  margin: 0 0 0.5rem;
  color: var(--muted);
  font-size: 0.95rem;
}

.result-value {
  margin: 0;
  font-size: 2.75rem;
  font-weight: 800;
  letter-spacing: -0.05em;
}

.warning {
  margin-top: 1rem;
  color: var(--danger);
  font-weight: 700;
}

.hidden {
  display: none;
}

.hidden-element {
  opacity: 0;
  max-height: 0;
  overflow: hidden;
  transition: opacity 0.4s ease, max-height 0.4s ease, margin 0.4s ease;
  pointer-events: none;
}

.hidden-element.reveal {
  opacity: 1;
  max-height: 2000px;
  pointer-events: auto;
}

.hidden-element#nameField.reveal {
  margin-bottom: 1.25rem;
}

.hidden-element#subjectsContainer.reveal {
  margin-bottom: 1.25rem;
}

.hidden-element#calculateBtn.reveal {
  margin-top: 0.5rem;
}

@media (max-width: 768px) {
  .hero {
    grid-template-columns: 1fr;
  }

  .subject-card {
    padding: 1.25rem 1rem;
  }

  .subject-title {
    font-size: 0.98rem;
  }

  .subject-grid {
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
  }

  .option-row {
    width: 100%;
  }

  .modal-content {
    width: 95%;
    max-width: 500px;
    margin: 0 auto;
    padding: 1rem;
  }

  .marksheet {
    padding: 1.5rem 1rem;
  }

  .neb-title {
    font-size: 1.2rem;
  }

  .gpa-badge {
    font-size: 1.6rem !important;
  }

  .result-grid {
    grid-template-columns: 1fr 1fr;
  }

  .modal-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .modal-actions button {
    width: 100%;
  }

  .modal-actions button + button {
    margin-top: 0.75rem;
  }
}

@media (max-width: 640px) {
  .hero {
    grid-template-columns: 1fr;
  }
}

/* Created By Section */
.created-by {
  margin-top: 2rem;
  display: flex;
  justify-content: center;
  padding: 0 1rem;
}

.creator-card {
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(37, 99, 235, 0.15);
  border-radius: 24px;
  box-shadow: 0 20px 60px rgba(15, 23, 42, 0.1);
  padding: 2rem;
  max-width: 400px;
  width: 100%;
  text-align: center;
  font-family: 'Poppins', sans-serif;
}

.creator-card h2 {
  margin: 0 0 0.5rem;
  font-size: 1.2rem;
  color: var(--muted);
  font-weight: 600;
}

.creator-card .name {
  margin: 0 0 1.5rem;
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--primary-dark);
}

.contact-info {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.contact-item {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  color: var(--text);
  font-size: 0.95rem;
}

.contact-item i {
  color: var(--primary);
  width: 20px;
  text-align: center;
}

.contact-item a {
  color: var(--text);
  text-decoration: none;
  transition: color 0.3s ease;
}

.contact-item a:hover {
  color: var(--primary);
}

.social-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: transform 0.3s ease, color 0.3s ease;
}

.social-link:hover {
  transform: scale(1.05);
}

.social-link:hover .fab {
  color: var(--primary);
}

.social-link .fab {
  transition: color 0.3s ease;
}

.fa-facebook:hover {
  color: #1877f2 !important;
}

.fa-instagram:hover {
  color: #e4405f !important;
}

/* Modal Styles */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(5px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  overflow-y: auto;
}

.modal.show {
  display: flex;
}

.modal-content {
  background: #ffffff;
  border-radius: 28px;
  box-shadow: 0 25px 80px rgba(15, 23, 42, 0.15);
  width: 100%;
  max-width: 500px;
  transform: scale(0.8);
  opacity: 0;
  transition: transform 0.3s ease, opacity 0.3s ease;
  font-family: 'Inter', sans-serif;
  max-height: 90vh;
  overflow-y: auto;
}

.modal.show .modal-content {
  transform: scale(1);
  opacity: 1;
}

.marksheet {
  padding: 2.5rem 2rem;
}

#marksheet-capture-area {
  background-color: white;
}

.marksheet-header {
  text-align: center;
  margin-bottom: 1.5rem;
}

.header-logo {
  font-size: 3rem;
  color: var(--primary);
  margin-bottom: 0.5rem;
}

.neb-title {
  margin: 0.5rem 0 0.25rem;
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--text);
  letter-spacing: 0.02em;
}

.neb-subtitle {
  margin: 0;
  font-size: 0.9rem;
  color: var(--muted);
  font-weight: 600;
}

.marksheet-divider {
  border: none;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(37, 99, 235, 0.2), transparent);
  margin: 1.5rem 0;
}

.student-details {
  background: rgba(37, 99, 235, 0.05);
  border-radius: 16px;
  padding: 1.2rem;
  margin-bottom: 1.5rem;
}

.detail-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
  font-size: 0.95rem;
}

.detail-row:last-child {
  margin-bottom: 0;
}

.detail-label {
  font-weight: 600;
  color: var(--muted);
}

.detail-value {
  font-weight: 700;
  color: var(--text);
}

.results-section {
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.08), rgba(59, 130, 246, 0.08));
  border: 2px solid rgba(37, 99, 235, 0.2);
  border-radius: 20px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.result-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  text-align: center;
}

.result-item {
  padding: 1rem;
  background: rgba(255, 255, 255, 0.7);
  border-radius: 14px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.result-item.highlight {
  background: linear-gradient(135deg, var(--primary), #3b82f6);
  box-shadow: 0 8px 20px rgba(37, 99, 235, 0.2);
}

.result-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin-bottom: 0.5rem;
}

.result-item.highlight .result-label {
  color: rgba(255, 255, 255, 0.85);
}

.result-value {
  display: block;
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--text);
}

.result-item.highlight .result-value {
  color: white;
}

.gpa-badge {
  font-size: 2rem !important;
  letter-spacing: -0.05em;
}

.grade-badge {
  display: inline-block;
  padding: 0.5rem 1rem;
  background: rgba(37, 99, 235, 0.15);
  border-radius: 8px;
  color: var(--primary-dark);
  font-weight: 800;
  font-size: 1.3rem;
}

.ng-warning {
  background: rgba(220, 38, 38, 0.1);
  border: 2px solid rgba(220, 38, 38, 0.3);
  border-radius: 14px;
  padding: 1rem;
  margin-bottom: 1.5rem;
  text-align: center;
  font-weight: 700;
  color: var(--danger);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.ng-warning i {
  font-size: 1.2rem;
}

.modal-actions {
  display: flex;
  gap: 1rem;
}

.primary-btn {
  flex: 1;
  border: none;
  border-radius: 14px;
  padding: 0.85rem 1rem;
  font-size: 0.95rem;
  font-weight: 700;
  color: white;
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.primary-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 24px rgba(37, 99, 235, 0.25);
}

.secondary-btn {
  flex: 1;
  border: 2px solid var(--border);
  border-radius: 14px;
  padding: 0.85rem 1rem;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
  background: transparent;
  cursor: pointer;
  transition: all 0.2s ease;
}

.secondary-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: rgba(37, 99, 235, 0.05);
}

.marksheet-disclaimer {
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(37, 99, 235, 0.1);
  text-align: center;
}

.marksheet-disclaimer p {
  margin: 0;
  font-size: 0.75rem;
  color: #8b8b8b;
  line-height: 1.4;
  font-weight: 500;
}

.ng-status {
  color: var(--danger) !important;
  font-weight: 900 !important;
}

.no-print {
  display: none;
}

@media print {
  .no-print {
    display: none !important;
  }
}
