:root {
  --bg: #f4f7fb;
  --surface: #fff;
  --accent: #1677ff;
  --accent-2: #0b5ed7;
  --accent-soft: #eaf3ff;
  --text: #142033;
  --muted: #68758a;
  --faint: #98a4b5;
  --border: #e4eaf2;
  --shadow: 0 10px 30px rgba(25, 48, 80, 0.08);
  --shadow-lg: 0 20px 50px rgba(25, 48, 80, 0.12);
  --radius: 18px;
}
html {
  scroll-behavior: smooth;
}
body {
  background: linear-gradient(
    180deg,
    #f8fbff 0,
    #f4f7fb 42%,
    #f1f4f8 100%
  ) !important;
  color: var(--text) !important;
}
.wrapper {
  max-width: 1380px !important;
  margin: 0 auto !important;
  padding: 18px 24px 40px !important;
}
.top-menu {
  position: sticky !important;
  top: 12px;
  z-index: 1000 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 5px !important;
  width: max-content;
  max-width: 100%;
  margin: 0 auto 28px !important;
  padding: 7px !important;
  background: rgba(255, 255, 255, 0.88) !important;
  border: 1px solid rgba(228, 234, 242, 0.95) !important;
  border-radius: 18px !important;
  box-shadow: 0 10px 35px rgba(25, 48, 80, 0.09) !important;
  backdrop-filter: blur(18px) !important;
}
.top-menu a {
  position: relative !important;
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
  padding: 10px 15px !important;
  border-radius: 13px !important;
  color: #657287 !important;
  font-weight: 600 !important;
  font-size: 13px !important;
  text-decoration: none !important;
  transition: 0.22s ease !important;
}
.top-menu a i {
  width: 17px;
  text-align: center;
}
.top-menu a:hover {
  background: var(--accent-soft) !important;
  color: var(--accent) !important;
  transform: translateY(-1px);
}
.top-menu a.active {
  background: linear-gradient(
    135deg,
    var(--accent),
    var(--accent-2)
  ) !important;
  color: #fff !important;
  box-shadow: 0 7px 18px rgba(22, 119, 255, 0.24) !important;
}
header {
  padding: 8px 2px 18px !important;
  margin-bottom: 10px !important;
}
.brand {
  font-weight: 800 !important;
  letter-spacing: 0.08em !important;
  color: #25334a !important;
}
.live-day,
.badge {
  border: 1px solid #d9e8ff !important;
  background: var(--accent-soft) !important;
  color: var(--accent) !important;
  font-weight: 700 !important;
}
.card,
.panel,
.hero,
.layout,
.announcement-card,
.faq-item,
.table-container {
  box-shadow: var(--shadow) !important;
  border-color: var(--border) !important;
  border-radius: var(--radius) !important;
}
.page-title h1,
.title {
  letter-spacing: -0.035em !important;
  color: #122038 !important;
}
.page-title p,
.sub {
  color: var(--muted) !important;
}
button,
input,
select,
textarea {
  font-family: inherit !important;
}
.btn,
.copy-day-btn,
.filter-tag,
.day-btn {
  transition: 0.2s ease !important;
}
.btn:hover,
.copy-day-btn:hover,
.filter-tag:hover,
.day-btn:hover {
  transform: translateY(-1px);
}
/* exam centers */
.layout {
  min-height: 650px !important;
  overflow: hidden !important;
  background: #fff !important;
}
.side {
  background: rgba(255, 255, 255, 0.96) !important;
}
.side-head {
  padding: 18px !important;
  background: linear-gradient(180deg, #fff, #fbfdff) !important;
}
.search {
  height: 46px !important;
  border: 1px solid #dfe6ef !important;
  border-radius: 13px !important;
  background: #f8fafc !important;
}
.item {
  padding: 16px 18px !important;
  border-bottom: 1px solid #edf1f5 !important;
}
.item:hover,
.item.active {
  background: #eef6ff !important;
}
.map {
  background: #edf2f7;
}
.tools .status,
.tools .zoom {
  border: 1px solid #dfe6ef !important;
  box-shadow: 0 8px 25px rgba(25, 48, 80, 0.14) !important;
}
.popup h3 {
  color: #142033;
}
.popup a {
  border: 0 !important;
  background: var(--accent-soft) !important;
  color: var(--accent) !important;
  font-weight: 600;
}
.leaflet-container {
  font-family: "DM Sans", sans-serif !important;
}
/* detail */
.hero {
  box-shadow: var(--shadow-lg) !important;
}
.cover {
  background: linear-gradient(135deg, #dcecff, #f8fbff) !important;
}
.hero-body,
.card {
  background: rgba(255, 255, 255, 0.96) !important;
}
.info-item {
  background: #f8fafc !important;
  border-color: #e8edf4 !important;
}
.map {
  border-radius: 14px !important;
}
.schedule th {
  background: #f7f9fc !important;
}
.schedule tr:hover td {
  background: #f8fbff;
}
/* shared section polish */
main,
.content,
.announcement-list {
  animation: pageIn 0.45s ease both;
}
.section-title {
  color: #142033 !important;
}
@keyframes pageIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@media (max-width: 800px) {
  .wrapper {
    padding: 10px 12px 86px !important;
  }
  .top-menu {
    position: fixed !important;
    top: auto;
    bottom: 10px;
    left: 10px;
    right: 10px;
    width: auto;
    justify-content: space-around !important;
    margin: 0 !important;
    padding: 7px !important;
    border-radius: 18px !important;
  }
  .top-menu a {
    flex: 1;
    justify-content: center;
    flex-direction: column;
    gap: 3px;
    padding: 8px 5px !important;
    font-size: 10px !important;
  }
  .top-menu a i {
    font-size: 15px;
  }
  .top-menu a span {
    display: block !important;
    white-space: nowrap;
  }
  .top-menu a {
    min-width: 0;
  }
  /* keep the floating chat button clear of the fixed bottom nav */
  .whatsapp-float {
    bottom: 88px !important;
  }
  .brand {
    font-size: 14px;
  }
  .layout {
    min-height: 0 !important;
  }
  .page-title h1 {
    font-size: 26px !important;
  }
  .hero .cover {
    height: 205px !important;
  }
  .card {
    padding: 16px !important;
  }
  .info {
    grid-template-columns: 1fr !important;
  }
  .actions {
    gap: 7px;
  }
  .btn {
    padding: 9px 12px;
  }
  .schedule {
    min-width: 650px;
  }
  .table-wrap {
    margin: 0 -4px;
  }
  .map {
    min-height: 340px;
  }
  .side {
    height: 420px !important;
  }
  .map {
    order: 1;
  }
  .side {
    order: 2;
  }
}
@media (min-width: 801px) {
  .top-menu a span {
    display: inline;
  }
  .top-menu a:first-child:before {
    
    font-size: 10px;
    letter-spacing: 0.08em;
    color: #9aa6b6;
    margin-right: 7px;
    padding-right: 10px;
    border-right: 1px solid #e4eaf2;
  }
  .top-menu a:first-child {
    margin-right: 3px;
  }
}

/* Student registration navigation */
.top-menu a[href="student-register.php"]{font-weight:700!important}

/* Timetable (index): the day wrapper is not a card */
#panels .panel,
#weekView {
  box-shadow: none !important;
  border-radius: 0 !important;
  border: 0 !important;
  background: transparent !important;
}
.nav-row > * { min-width: 0; }
.nav-row { max-width: 100%; }
.view-toggle { max-width: 100%; }

/* Utility classes used by markup but never defined (Bootstrap leftovers) */
.me-2 { margin-right: .5rem; }
.btn-light {
  background: #eef2f8;
  color: #25334a;
  border: 1px solid var(--border);
  font-weight: 700;
  font-size: 13px;
  text-decoration: none;
}
.btn-light:hover { background: var(--accent-soft); color: var(--accent); }
.btn-register.btn { border: 0; }
.day-nav { max-width: 100%; }
@media (max-width: 380px) {
  .nav-row { flex-wrap: nowrap !important; }
  .day-nav { width: 100%; justify-content: flex-start !important; }
}

/* =====================================================================
   MOBILE RESPONSIVENESS PASS
   ===================================================================== */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
.top-menu a .lbl-short { display: none !important; }

/* Exam schedule rows (index) */
.exam-item > a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 14px;
  border-radius: 20px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}
.exam-subject { overflow-wrap: anywhere; }

/* Exam center detail: schedule table */
.wt-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.wt-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.wt-table th,
.wt-table td {
  text-align: left;
  padding: 11px 12px;
  border-bottom: 1px solid var(--border, #eee);
  vertical-align: top;
}
.wt-table th { font-weight: 600; color: var(--muted, #68758a); white-space: nowrap; }

/* Hover lift is meaningless (and "sticky") on touch screens */
@media (hover: none) {
  .card:hover,
  .announcement-card:hover,
  .faq-item:hover,
  .blog-card:hover,
  .guide-card:hover,
  .week-card:hover,
  .btn:hover,
  .day-btn:hover,
  .filter-tag:hover,
  .copy-day-btn:hover { transform: none !important; }
}

@media (max-width: 800px) {
  /* iOS Safari zooms the whole page when a field with <16px text is focused */
  input, select, textarea { font-size: 16px !important; }

  /* exam-center.php had its own body padding on top of .wrapper padding */
  body { padding: 0 !important; }

  /* bottom nav: six items must fit on 320-360px screens */
  .top-menu { gap: 2px !important; padding: 6px 4px !important; }
  .top-menu a { font-size: 10px !important; line-height: 1.15; border-radius: 12px !important; }
  .top-menu a span { overflow: hidden; text-overflow: ellipsis; max-width: 100%; }

  /* toast must clear the fixed bottom nav */
  .toast { bottom: 92px !important; max-width: calc(100vw - 32px); text-align: center; }

  /* index: action buttons are absolutely positioned, keep text clear of them */
  .sessions > .card > div:first-child { padding-right: 88px; min-width: 0; }
  .subject, .teacher { overflow-wrap: anywhere; }
  .copy-btn, .join-btn { z-index: 1; }
  .copy-day-btn { padding: 10px 14px; }
  .filter-tag, .day-btn, .toggle-btn, .schedule-mode-btn, .exam-day-btn { min-height: 40px; }
  .schedule-mode { gap: 6px; }
  .schedule-mode-btn { flex: 1 1 0; text-align: center; padding: 9px 10px; }

  /* exam centers: map controls */
  .map-fullscreen-btn { top: auto !important; bottom: 34px; right: 10px !important; }
  .links a { font-size: 12px !important; padding: 9px 12px !important; }
  .item { padding: 14px 15px !important; }
  .location-actions button { padding: 11px 10px !important; font-size: 12px !important; }
  .location-hide-btn, .location-show-btn { min-height: 38px; font-size: 12px !important; }
  .zoom button { width: 42px !important; height: 42px !important; }
  .popup a { padding: 9px 11px !important; font-size: 12px !important; }

  /* exam center detail */
  .hero-body { padding: 16px !important; }
  .actions .btn { padding: 11px 14px; font-size: 13px; }
  .contact a { padding: 10px 12px; font-size: 12px; }
  .feedback-card { padding: 16px !important; }
  .feedback-intro { gap: 10px; }
  .nearest-head { flex-wrap: wrap; }
  .nearest-wrap, #weekly-timetable { padding: 16px !important; }
  .student-feedback-dialog {
    width: calc(100% - 20px) !important;
    margin: 10px auto !important;
    max-height: calc(100vh - 20px) !important;
  }
  .student-feedback-head { padding: 16px !important; }
  .student-feedback-dialog .feedback-form { padding: 16px !important; }
  .feedback-input { padding: 13px 12px !important; }

  /* announcements / faq / info text safety */
  .announcement-title, .announcement-content, .faq-answer p, .contact-value { overflow-wrap: anywhere; }
  .question-copy small { font-size: 9px !important; }
  .faq-answer p { font-size: 13px !important; }
  .guide-card { min-height: 64px; }
  .quick-link { min-height: 46px; }
}

@supports (height: 100dvh) {
  @media (max-width: 800px) {
    .student-feedback-dialog { max-height: calc(100dvh - 20px) !important; }
    .layout.map-fullscreen,
    .layout.map-fullscreen .map,
    .layout.map-fullscreen .side { height: 100dvh !important; min-height: 100dvh !important; }
  }
}

@media (max-width: 768px) {
  /* exam center detail: stack the 3-up / 2-up grids */
  .nearest-list { grid-template-columns: 1fr !important; }
}

@media (max-width: 640px) {
  /* exam schedule table -> stacked cards */
  .wt-table, .wt-table tbody, .wt-table tr, .wt-table td { display: block; width: 100%; }
  .wt-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .wt-table tr {
    margin-bottom: 10px;
    padding: 6px 12px;
    border: 1px solid var(--border, #e4eaf2);
    border-radius: 12px;
    background: #fbfdff;
  }
  .wt-table td {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    padding: 8px 0;
    border-bottom: 1px dashed var(--border, #e4eaf2);
    text-align: right;
    overflow-wrap: anywhere;
  }
  .wt-table td:last-child { border-bottom: 0; }
  .wt-table td::before {
    content: attr(data-label);
    flex: 0 0 74px;
    text-align: left;
    color: var(--faint, #98a4b5);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    padding-top: 2px;
  }
}

@media (max-width: 600px) {
  /* index: week view becomes a swipeable row of day columns */
  .week-grid {
    display: flex !important;
    gap: 12px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    margin: 0 -12px;
    padding: 0 12px 10px;
    scrollbar-width: none;
  }
  .week-grid::-webkit-scrollbar { display: none; }
  .week-col { flex: 0 0 82%; scroll-snap-align: start; min-width: 0; }
  .week-card { padding: 12px !important; }
  .week-card .w-subject { font-size: 14px !important; }
  .week-card .w-teacher { font-size: 12px !important; }
  .week-card .w-hall { font-size: 11px !important; }
  .week-card .w-stream { font-size: 10px !important; }
  .week-card .w-time { font-size: 11px !important; }
  .week-card .w-copy-btn, .week-card .w-join-btn { font-size: 12px !important; padding: 9px 12px !important; }
  .week-day-header { font-size: 13px; }

  /* index: exam rows */
  .exam-item { grid-template-columns: 52px minmax(0, 1fr) !important; }
  .exam-item > a { grid-column: 2; justify-self: start; }

  /* exam center detail */
  .feedback-choice-actions { grid-template-columns: 1fr !important; }
  .info { grid-template-columns: 1fr !important; }

  /* register */
  .success-actions a { flex: 1 1 100%; }
}

@media (max-width: 480px) {
  .sessions > .card { padding-top: 16px !important; }
  .copy-btn, .join-btn { top: 12px !important; }
  .top-menu a .lbl-full { display: none !important; }
  .top-menu a .lbl-short { display: block !important; }
  .top-menu a { padding: 8px 2px !important; }
  .top-menu a i { font-size: 16px !important; }
}

@media (max-width: 380px) {
  /* keep action buttons in the card corner instead of a broken 2-col grid */
  .card { grid-template-columns: 1fr !important; }
  .sessions > .card .copy-btn,
  .sessions > .card .join-btn { position: absolute !important; }
  .sessions > .card .copy-btn { right: 10px; }
  .sessions > .card .join-btn { right: 48px; }
  .sessions > .card > div:first-child { padding-right: 84px; }
  .week-col { flex-basis: 88%; }
}

/* landscape phones: don't let the fixed nav eat the screen */
@media (max-width: 900px) and (max-height: 480px) and (orientation: landscape) {
  .top-menu a { flex-direction: row !important; padding: 6px 4px !important; }
  .top-menu a .lbl-full, .top-menu a .lbl-short { display: none !important; }
  .wrapper { padding-bottom: 70px !important; }
  .whatsapp-float { bottom: 72px !important; }
}
