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

body {
  font-family: 'Ubuntu', 'Roboto', sans-serif;
  background: #f0f4f8;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  color: #1a3a50;
}

/* ── Notice bar ── */
.notice-bar {
  display: none;
  padding: 10px 20px;
  background: #c0392b;
  color: #fff;
  font-size: 0.85rem;
  text-align: center;
}
.notice-bar.is-visible { display: block; }

/* ── Header ── */
.site-header {
  background: linear-gradient(135deg, #005577, #003d55);
  color: #fff;
}
.header-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.header-brand { display: flex; align-items: center; gap: 12px; }
.header-title h1 { font-size: 1.2rem; font-weight: 700; }
.header-title span { font-size: 0.77rem; opacity: 0.75; }
.header-right { display: flex; align-items: center; gap: 16px; }
.header-date { font-size: 0.82rem; opacity: 0.8; text-align: right; line-height: 1.5; }
.header-date strong { display: block; font-size: 0.9rem; }

.gold-bar { height: 4px; background: linear-gradient(90deg, #c8973f, #e8b84b, #c8973f); }

/* ── Main ── */
#main-content {
  flex: 1;
  max-width: 1100px;
  width: 100%;
  margin: 0 auto;
  padding: 28px 20px 48px;
}

/* ── Loading / empty states ── */
.loading-state, .empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  text-align: center;
  color: #5a7080;
  gap: 12px;
}
.empty-state h3 { color: #1a3a50; font-size: 1.1rem; }
.empty-state p { font-size: 0.88rem; }

/* ── Spinner ── */
.spinner {
  width: 32px; height: 32px;
  border: 3px solid #c8daea;
  border-top-color: #005577;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Class section ── */
.class-section { margin-bottom: 36px; }
.class-section-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 2px solid #d0e4f0;
}
.class-section-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: #1a3a50;
}
.class-section-count {
  font-size: 0.78rem;
  color: #5a7080;
  background: #e8f0f7;
  padding: 2px 8px;
  border-radius: 12px;
}

/* ── Exam cards grid ── */
.exams-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 16px;
}

/* ── Exam card ── */
.exam-card {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 2px 10px rgba(0,85,119,0.08);
  overflow: hidden;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  display: flex;
  flex-direction: column;
}
.exam-card:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(0,85,119,0.14); }
.exam-card.is-unavailable { opacity: 0.65; }

.exam-card-header {
  background: linear-gradient(135deg, #005577, #00708a);
  padding: 14px 16px 12px;
  color: #fff;
}
.exam-card-subject { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.6px; opacity: 0.8; margin-bottom: 4px; }
.exam-card-name { font-size: 1rem; font-weight: 700; line-height: 1.3; }

.exam-card-body { padding: 14px 16px; flex: 1; display: flex; flex-direction: column; gap: 8px; }
.exam-card-meta { display: flex; flex-wrap: wrap; gap: 6px; }
.meta-tag {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 0.78rem;
  color: #5a7080;
  background: #f0f6fa;
  padding: 3px 8px;
  border-radius: 20px;
}
.meta-tag svg { opacity: 0.6; }

.exam-card-footer { padding: 0 16px 14px; margin-top: auto; }

.btn-start {
  width: 100%;
  padding: 9px 16px;
  background: #005577;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s ease;
}
.btn-start:hover { background: #004466; }
.btn-start:disabled { background: #8aa8c0; cursor: not-allowed; }

.unavailable-msg {
  text-align: center;
  font-size: 0.78rem;
  color: #8aa8c0;
  padding: 8px 0 4px;
}

/* ── Modal ── */
.modal-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,40,60,0.55);
  z-index: 900;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-overlay.is-open { display: flex; }

.modal {
  background: #fff;
  border-radius: 16px;
  width: 100%;
  max-width: 440px;
  box-shadow: 0 12px 48px rgba(0,40,60,0.25);
  overflow: hidden;
}
.modal-header {
  background: linear-gradient(135deg, #005577, #003d55);
  color: #fff;
  padding: 22px 24px 18px;
  position: relative;
}
.modal-header h2 { font-size: 1.1rem; font-weight: 700; margin-bottom: 4px; }
.modal-header p { font-size: 0.85rem; opacity: 0.8; }
.modal-close {
  position: absolute; top: 14px; right: 14px;
  background: rgba(255,255,255,0.15); border: none; color: #fff;
  width: 28px; height: 28px; border-radius: 50%;
  font-size: 0.9rem; cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.modal-close:hover { background: rgba(255,255,255,0.25); }

.modal-body { padding: 22px 24px; }

.modal-exam-info { margin-bottom: 16px; padding-bottom: 16px; border-bottom: 1px solid #e8f0f7; }
.modal-exam-name { font-size: 1rem; font-weight: 700; color: #1a3a50; }
.modal-exam-details { font-size: 0.82rem; color: #5a7080; margin-top: 4px; }

.pincode-label { display: block; font-size: 0.82rem; font-weight: 600; color: #1a3a50; margin-bottom: 6px; }
.pincode-wrapper {
  display: flex; align-items: center;
  border: 2px solid #c8daea; border-radius: 8px; overflow: hidden;
  margin-bottom: 10px; transition: border-color 0.15s;
}
.pincode-wrapper:focus-within { border-color: #005577; }
.pincode-input {
  flex: 1; padding: 10px 12px;
  font-family: 'Roboto Mono', monospace; font-size: 1.1rem; letter-spacing: 0.2em;
  border: none; outline: none;
  background: transparent; color: #1a3a50;
}
.pincode-toggle {
  padding: 0 12px;
  background: none; border: none; cursor: pointer;
  color: #8aa8c0; display: flex; align-items: center;
}
.pincode-toggle:hover { color: #005577; }

.error-message {
  font-size: 0.82rem; color: #c0392b; min-height: 20px;
  margin-bottom: 8px;
}

.btn-primary {
  width: 100%; padding: 11px;
  background: #005577; color: #fff;
  border: none; border-radius: 8px;
  font-family: inherit; font-size: 0.95rem; font-weight: 600;
  cursor: pointer; transition: background 0.15s;
}
.btn-primary:hover { background: #004466; }
.btn-primary:disabled { background: #8aa8c0; cursor: not-allowed; }

.redirect-status {
  display: flex; flex-direction: column; align-items: center;
  gap: 10px; padding: 12px 0 0;
  font-size: 0.85rem; color: #5a7080;
}

/* ── Footer ── */
.site-footer {
  text-align: center;
  padding: 16px;
  font-size: 0.78rem;
  color: #8aa8c0;
}
.site-footer a { color: #5a7080; text-decoration: none; }
.site-footer a:hover { color: #005577; }

/* ── Responsive ── */
@media (max-width: 600px) {
  .header-inner { flex-direction: column; align-items: flex-start; gap: 8px; }
  .exams-grid { grid-template-columns: 1fr; }
}
