/* ==========================================================================
   SIMULASI CAT CPNS 2027 — BASE & LAYOUT STYLES
   File: css/base.css
   ========================================================================== */

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  overflow-y: scroll;
  scrollbar-gutter: stable;
  scroll-behavior: smooth;
}

html,
body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

body {
  font-family: var(--font-sans);
  background: var(--bg-page);
  color: var(--text-primary);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color 0.2s, color 0.2s;
}

.main-container {
  flex: 1 0 auto;
  max-width: 1400px;
  margin: 20px auto;
  padding: 0 20px 48px;
  width: 100%;
}

body:not(.in-exam) .main-container {
  max-width: 100%;
  margin: 0;
  padding: 0 0 40px;
}

.home-content-wrap {
  max-width: 1320px;
  margin: 22px auto 0;
  padding: 0 20px;
  width: 100%;
}

.result-outer-wrap {
  max-width: 1320px;
  margin: 24px auto 0;
  padding: 0 20px;
  width: 100%;
}

.site-footer {
  flex-shrink: 0;
}

/* ==========================================================================
   HEADER (SSCASN DUAL-STATE NAVBAR & CAT EXAM HEADER)
   ========================================================================== */
.site-header {
  background: linear-gradient(90deg, #0b5d99 0%, #157bb7 55%, #1e7caf 100%);
  color: #ffffff;
  border-bottom: 1px solid rgba(255, 255, 255, 0.14);
  position: sticky;
  top: 0;
  z-index: 100;
  transition: background-color 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

body.in-exam .site-header {
  background: var(--bkn-navy);
  border-bottom: 3px solid var(--cat-yellow);
}

body:not(.in-exam):not(.is-logged-in) .site-header.is-scrolled {
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  color: var(--text-primary);
  border-bottom: 1px solid var(--border-color);
  box-shadow: 0 6px 24px rgba(15, 41, 66, 0.08);
}

[data-theme="dark"] body:not(.in-exam):not(.is-logged-in) .site-header.is-scrolled {
  background: rgba(17, 24, 39, 0.94);
  border-bottom-color: var(--border-color);
}

.header-inner {
  max-width: 1360px;
  margin: 0 auto;
  padding: 10px 20px;
  min-height: 66px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand-group {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  user-select: none;
  text-decoration: none;
  flex-shrink: 0;
}

.brand-logo-pill {
  background: #ffffff;
  color: var(--sscasn-blue-deep);
  border-radius: 10px;
  padding: 6px 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(11, 93, 153, 0.14);
  border: 1px solid rgba(20, 129, 198, 0.14);
}

.brand-logo-main {
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: 0.6px;
  line-height: 1;
  color: var(--sscasn-blue-deep);
}

.brand-logo-sub {
  font-size: 0.48rem;
  font-weight: 700;
  letter-spacing: 0.35px;
  color: #475569;
  margin-top: 2px;
  text-transform: uppercase;
  white-space: nowrap;
}

.portal-brand-wrap {
  display: none;
  align-items: center;
  gap: 12px;
}

body.is-logged-in:not(.in-exam) .brand-logo-pill {
  display: none;
}

body.is-logged-in:not(.in-exam) .portal-brand-wrap {
  display: flex;
}

body.in-exam .portal-brand-wrap {
  display: none;
}

body.in-exam .brand-logo-pill {
  display: flex;
}

.portal-emblem-box {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.28);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  flex-shrink: 0;
}

.brand-text-wrap {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
}

.brand-title {
  font-size: 1rem;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: 0.15px;
  margin: 0;
  line-height: 1.2;
}

.brand-pill {
  font-family: var(--font-sans);
  font-size: 0.72rem;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.84);
  line-height: 1.1;
}

.top-nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

body.is-logged-in .top-nav-links,
body.in-exam .top-nav-links {
  display: none;
}

.top-nav-link {
  border: none;
  background: transparent;
  color: rgba(255, 255, 255, 0.9);
  font-family: inherit;
  font-size: 0.87rem;
  font-weight: 600;
  padding: 7px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast);
  white-space: nowrap;
}

.top-nav-link:hover,
.top-nav-link.active {
  background: rgba(255, 255, 255, 0.16);
  color: #ffffff;
}

.site-header.is-scrolled .top-nav-link {
  color: var(--text-secondary);
}

.site-header.is-scrolled .top-nav-link:hover,
.site-header.is-scrolled .top-nav-link.active {
  background: var(--sscasn-sky-soft);
  color: var(--sscasn-blue);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.hdr-register-btn {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.38);
  border-radius: 9px;
  font-weight: 600;
  padding: 7px 14px;
}

.hdr-register-btn:hover {
  background: rgba(255, 255, 255, 0.22);
}

.site-header.is-scrolled .hdr-register-btn {
  background: var(--bg-surface);
  color: var(--text-primary);
  border-color: var(--border-color);
}

.site-header.is-scrolled .hdr-register-btn:hover {
  background: var(--bg-subtle);
}

body.is-logged-in .hdr-register-btn,
body.in-exam .hdr-register-btn {
  display: none;
}

.hdr-login-btn {
  background: #ffffff;
  color: var(--sscasn-blue-deep);
  border: 1px solid #ffffff;
  border-radius: 9px;
  font-weight: 700;
  padding: 7px 16px;
}

.hdr-login-btn:hover {
  background: #eff6fc;
}

.site-header.is-scrolled .hdr-login-btn {
  background: var(--sscasn-blue);
  color: #ffffff;
  border-color: var(--sscasn-blue);
}

.site-header.is-scrolled .hdr-login-btn:hover {
  background: var(--sscasn-blue-deep);
}

.hdr-user-menu-wrap {
  position: relative;
}

.hdr-user-btn {
  gap: 8px;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.15);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.34);
  border-radius: 999px;
  padding: 5px 14px 5px 8px;
}

.hdr-user-btn:hover {
  background: rgba(255, 255, 255, 0.24);
}

.hdr-user-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #ffffff;
  color: var(--sscasn-blue-deep);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.76rem;
  font-weight: 800;
}

.hdr-user-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 248px;
  background: var(--bg-surface);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  padding: 6px;
  z-index: 500;
}

.hdr-dropdown-head {
  padding: 8px 10px 10px;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 4px;
}

.hdr-dropdown-name {
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hdr-dropdown-sub {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.hdr-dropdown-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: none;
  background: transparent;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  text-align: left;
  transition: background var(--transition-fast);
}

.hdr-dropdown-item:hover {
  background: var(--sscasn-sky-soft);
  color: var(--sscasn-blue);
}

.hdr-dropdown-item.danger {
  color: var(--cat-red);
}

.hdr-dropdown-item.danger:hover {
  background: var(--color-empty-light);
}

/* ==========================================================================
   PANEL CARD
   ========================================================================== */
.panel-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  box-shadow: var(--shadow-sm);
  padding: 22px;
}

/* ==========================================================================
   FOOTER (BKN SSCASN 4-COLUMN + BOTTOM CERULEAN BAR)
   ========================================================================== */
.site-footer {
  margin-top: 54px;
  background: var(--bg-surface);
  border-top: 1px solid var(--border-color);
  padding: 0;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.footer-main-grid {
  max-width: 1320px;
  margin: 0 auto;
  padding: 36px 20px 32px;
  display: grid;
  grid-template-columns: 1.15fr 1.35fr 1fr 1.25fr;
  gap: 28px;
  align-items: start;
}

.footer-brand-col {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
}

.footer-emblem-lockup {
  display: flex;
  align-items: center;
  gap: 12px;
}

.footer-emblem-text {
  font-size: 1.25rem;
  font-weight: 900;
  letter-spacing: 0.8px;
  color: var(--text-primary);
  line-height: 1.1;
}

.footer-col-heading {
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.7px;
  text-transform: uppercase;
  color: var(--sscasn-blue);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.footer-col-heading::before {
  content: "";
  display: inline-block;
  width: 14px;
  height: 2px;
  background: var(--sscasn-blue);
}

.footer-contact-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 0.83rem;
}

.footer-contact-item {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  color: var(--text-secondary);
}

.footer-contact-item svg {
  flex-shrink: 0;
  color: var(--sscasn-blue);
  margin-top: 2px;
}

.footer-links-cols {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 16px;
}

.footer-nav-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: none;
  padding: 3px 0;
  font-family: inherit;
  font-size: 0.84rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  text-align: left;
  text-decoration: none;
}

.footer-nav-link::before {
  content: "";
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--sscasn-blue);
  opacity: 0.7;
}

.footer-nav-link:hover {
  color: var(--sscasn-blue);
}

.footer-socials-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.social-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 12px;
  border-radius: 10px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.82rem;
  font-weight: 600;
  transition: all 0.15s ease;
}

.social-link:hover {
  color: var(--sscasn-blue);
  border-color: var(--sscasn-blue);
  background: var(--sscasn-sky-soft);
  transform: translateY(-1px);
}

.social-link svg {
  width: 15px;
  height: 15px;
  fill: currentColor;
  flex-shrink: 0;
}

.footer-bottom-bar {
  background: var(--sscasn-blue);
  color: #ffffff;
  text-align: center;
  padding: 13px 20px;
  font-size: 0.84rem;
  font-weight: 600;
}

/* ==========================================================================
   FLOATING ACCESSIBILITY PILL & BACK TO TOP
   ========================================================================== */
.a11y-floating-wrap {
  position: fixed;
  left: 18px;
  bottom: 18px;
  z-index: 900;
}

body.in-exam .a11y-floating-wrap,
body.in-exam .btn-back-top {
  display: none !important;
}

.a11y-pill-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 16px;
  border-radius: 999px;
  border: none;
  background: var(--sscasn-blue);
  color: #ffffff;
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(20, 129, 198, 0.34);
  transition: transform 0.15s ease, background 0.15s ease;
}

.a11y-pill-btn:hover {
  background: var(--sscasn-blue-deep);
  transform: translateY(-1px);
}

.a11y-popover-card {
  position: absolute;
  bottom: calc(100% + 10px);
  left: 0;
  width: 245px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 14px;
  box-shadow: var(--shadow-lg);
}

.a11y-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 7px 0;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-primary);
}

.btn-back-top {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 900;
  width: 40px;
  height: 40px;
  border-radius: 9px;
  border: none;
  background: var(--sscasn-blue);
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(15, 41, 66, 0.22);
  transition: transform 0.15s ease, opacity 0.2s ease, background 0.15s ease;
}

.btn-back-top.is-hidden {
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
}

.btn-back-top:hover {
  background: var(--sscasn-blue-deep);
}

/* ==========================================================================
   UTILITY CLASSES
   ========================================================================== */
.hidden {
  display: none !important;
}

.math-inline {
  font-family: var(--font-sans);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--text-primary);
  padding: 1px 3px;
}

/* ==========================================================================
   RESPONSIVE BREAKPOINTS (BASE)
   ========================================================================== */
@media (max-width: 1080px) {
  .footer-main-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 980px) {
  .header-inner {
    padding: 10px 14px;
    gap: 10px;
    flex-wrap: wrap;
  }

  .top-nav-links {
    order: 3;
    width: 100%;
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-top: 4px;
  }
}

@media (max-width: 640px) {
  .main-container {
    padding: 0 12px 32px;
    margin-top: 14px;
  }

  .home-content-wrap,
  .result-outer-wrap {
    padding: 0 12px;
  }

  .footer-main-grid {
    grid-template-columns: 1fr;
    gap: 22px;
    padding: 28px 16px;
  }

  .brand-title {
    font-size: 0.88rem;
  }

  .brand-pill {
    display: none;
  }
}