/* ============================================================
   Civil Registration System — shared styles for all certificate pages
   (extracted so every page stays visually identical & easy to restyle)
   NOTE: url() paths here are relative to THIS file (assets/),
         so bg-logo.png is referenced without the "assets/" prefix.
   ============================================================ */

/* ------------------------------------------------------------
   Theme tokens — light is default, [data-theme="dark"] overrides
   ------------------------------------------------------------ */
:root {
  --page-bg: #ffffff;
  --text: #212529;
  --muted: #495057;
  --surface: #ffffff;          /* header + strip background */
  --card-bg: #ffffff;
  --card-border: rgba(0, 0, 0, .125);
  --card-shadow: 4px -5px 13px -1px rgb(128, 128, 128);
  --row-border: #dee2e6;
  --row-stripe: rgba(0, 0, 0, .022);
  --watermark-opacity: 1;
  --control-border: #ced4da;
  --control-text: #234A7D;
  /* base font size, driven by the A- / A / A+ controls */
  --base-fs: 14px;
}
html[data-theme="dark"] {
  --page-bg: #15181c;
  --text: #e9ecef;
  --muted: #adb5bd;
  --surface: #1d2126;
  --card-bg: #23282e;
  --card-border: rgba(255, 255, 255, .12);
  --card-shadow: 0 2px 16px rgba(0, 0, 0, .5);
  --row-border: #343a40;
  --row-stripe: rgba(255, 255, 255, .03);
  --watermark-opacity: .14;
  --control-border: #495057;
  --control-text: #9ec5ff;
}

* { box-sizing: border-box; }
html { font-size: 16px; }
body {
  margin: 0;
  font-family: "Roboto", "Helvetica Neue", Arial, sans-serif;
  font-size: var(--base-fs);
  color: var(--text);
  background: var(--page-bg);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ------------------------------------------------------------
   HEADER
   ------------------------------------------------------------ */
.site-header {
  position: relative;
  background: var(--surface);
  box-shadow: 0 1px 4px rgba(0, 0, 0, .12);
  overflow: hidden;        /* clip the swoosh ribbons that extend past the edges */
  z-index: 10;
}

/* Tricolor swoosh + emblem, centered BEHIND the header row (matches the original).
   Two identical, NON-mirrored swooshes flank the centered emblem; the flag.svg is
   already semi-transparent so the logos/controls read cleanly on top of it. */
.tricolor-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}
.tricolor-overlay .flag-bg {
  width: 664px;            /* fixed width, same aspect as source → no distortion */
  height: 64px;
  flex: 0 0 auto;
  object-fit: cover;
  object-position: center;
}
/* Mirror the LEFT swoosh so the two flags fan out symmetrically around the
   emblem — exactly what the live site does (its .flag-bg-left uses scaleX(-1)). */
.tricolor-overlay .flag-bg:first-child { transform: scaleX(-1); }
.tricolor-overlay .emblem {
  height: 58px;
  width: auto;
  margin: 0 40px;          /* ~120px gap between the swooshes, emblem dead-centre */
  flex: 0 0 auto;
}

/* Header row: logos left, controls right — sits ON TOP of the swoosh */
.header-row {
  position: relative;
  z-index: 2;
  max-width: 1180px;
  margin: 0 auto;
  min-height: 64px;
  padding: 8px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.header-logos {
  display: flex;
  align-items: center;
  gap: 14px;
}
.header-logos .crs-logo { height: 46px; width: auto; }
.header-logos .azadi-logo { height: 52px; width: auto; }
/* Whiten the dark-text CRS logo so it stays legible in dark mode */
html[data-theme="dark"] .header-logos .crs-logo { filter: brightness(0) invert(1); }

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

/* A- / A / A+ font-size group */
.font-group {
  display: inline-flex;
  border: 1px solid var(--control-border);
  border-radius: 4px;
  overflow: hidden;
}
.font-group button {
  border: 0;
  border-right: 1px solid var(--control-border);
  background: transparent;
  color: var(--control-text);
  font-family: inherit;
  padding: 5px 9px;
  cursor: pointer;
  line-height: 1;
  font-weight: 500;
}
.font-group button:last-child { border-right: 0; }
.font-group button:hover { background: rgba(35, 74, 125, .08); }
.font-group button sup { font-size: .7em; }

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--control-border);
  border-radius: 4px;
  background: transparent;
  color: var(--control-text);
  cursor: pointer;
}
.icon-btn:hover { background: rgba(35, 74, 125, .08); }
.icon-btn svg { width: 20px; height: 20px; }

/* Sun/moon swap by theme */
html[data-theme="light"] .icon-sun { display: none; }
html[data-theme="dark"]  .icon-moon { display: none; }

.login-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: linear-gradient(90deg, #7391BA, #234A7D);
  color: #fff;
  border: 0;
  border-radius: 4px;
  padding: 8px 16px;
  font-family: inherit;
  font-size: 1em;
  font-weight: 500;
  cursor: pointer;
}
.login-btn:hover { filter: brightness(1.05); }
.login-btn svg { width: 18px; height: 18px; }

/* ------------------------------------------------------------
   NAVIGATION MENU BAR (injected by app.js; the hamburger toggles it).
   Visible by default on desktop; hidden behind the hamburger on phones.
   ------------------------------------------------------------ */
.nav-menu {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  background: #234A7D;
  position: relative;
  z-index: 5;
}
.nav-menu .nav-link {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  height: 36px;
  padding: 0 16px;
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
}
.nav-menu .nav-link:hover { background: rgba(255, 255, 255, .12); }
.nav-menu[data-open="true"]  { display: flex; }
.nav-menu[data-open="false"] { display: none; }

/* Dropdown items (RBD Act / Forms / FAQs) — open on hover (desktop) */
.nav-menu .nav-item { position: relative; display: inline-flex; align-items: center; }
.nav-menu .nav-trigger { background: none; border: 0; font: inherit; cursor: pointer; }
.nav-menu .nav-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 230px;
  background: #fff;
  box-shadow: 0 6px 16px rgba(0, 0, 0, .2);
  border-radius: 0 0 4px 4px;
  padding: 4px 0;
  display: none;
  z-index: 20;
}
.nav-menu .nav-item:hover .nav-dropdown,
.nav-menu .nav-item:focus-within .nav-dropdown { display: block; }
.nav-menu .nav-sublink {
  display: block;
  padding: 9px 18px;
  color: #234A7D;
  font-size: 13px;
  text-decoration: none;
  white-space: nowrap;
}
.nav-menu .nav-sublink:hover { background: #eef2f7; }

@media (max-width: 640px) {
  /* White menu on phones (the live site flips the bar to white here) */
  .nav-menu { display: none; flex-direction: column; align-items: stretch; background: #fff; }
  .nav-menu > .nav-link, .nav-menu > .nav-item { border-bottom: 1px solid #e6e9ee; }
  .nav-menu .nav-link { height: 44px; color: #234A7D; }
  .nav-menu .nav-link:hover { background: #eef2f7; }
  .nav-menu .nav-item { display: block; }
  .nav-menu .nav-item .nav-trigger { width: 100%; }
  /* dropdowns expand inline on phones (tap the item) */
  .nav-menu .nav-dropdown {
    position: static;
    display: none;
    min-width: 0;
    padding: 0;
    background: #f4f6f9;
    box-shadow: none;
    border-radius: 0;
  }
  .nav-menu .nav-item:hover .nav-dropdown,
  .nav-menu .nav-item:focus-within .nav-dropdown { display: none; }
  .nav-menu .nav-item.open .nav-dropdown { display: block; }
  .nav-menu .nav-sublink { color: #234A7D; padding-left: 36px; }
}

/* ------------------------------------------------------------
   MAIN CONTENT — certificate card on a tiled watermark
   ------------------------------------------------------------ */
.content {
  position: relative;
  flex: 1 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 56px 16px;
}
/* Faint repeating emblem watermark behind the card */
.content::before {
  content: "";
  position: absolute;
  inset: 0;
  background: url("bg-logo.png") repeat center;
  opacity: var(--watermark-opacity);
  pointer-events: none;
  z-index: 0;
}
.cert-card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 558px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 4px;
  box-shadow: var(--card-shadow);
  padding: 25px;
}
.cert-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}
/* Full bordered grid like the live site (its table carries the "table-border"
   class); no row striping; narrow 113px label column so long labels wrap. */
.cert-table td {
  border: 1px solid var(--row-border);
  padding: 8px;
  font-size: 1em;
  font-weight: 400;
  color: var(--text);
  vertical-align: top;
  line-height: 1.45;
}
.cert-table td.label { width: 113px; }

/* ------------------------------------------------------------
   FOOTER
   ------------------------------------------------------------ */
.site-footer {
  flex-shrink: 0;
  background: #212529 radial-gradient(circle, #138F78 0%, #234A7D 100%);
  color: #fff;
  padding: 40px 16px 0;
  text-align: center;
}
.footer-inner { max-width: 1100px; margin: 0 auto; }

.footer-logos {
  list-style: none;
  margin: 0 auto 24px;
  padding: 0;
  max-width: 1010px;        /* 6 plates per row → IYC wraps to a centered 2nd row, like the original */
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 16px 20px;
}
.footer-logos li { display: flex; flex: 0 0 auto; }
/* Each logo carries its own plate (white, or dark for PM INDIA);
   data.gov.in is white-on-transparent and sits straight on the gradient. */
.footer-logos img { height: 46px; width: auto; display: block; border-radius: 4px; }

.footer-links {
  list-style: none;
  margin: 0 0 14px;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px 0;
  font-size: 14px;
}
.footer-links li {
  padding: 0 14px;
  border-right: 1px solid rgba(255, 255, 255, .35);
  line-height: 1;
}
.footer-links li:last-child { border-right: 0; }
.footer-links a, .footer-links li { color: #fff; text-decoration: none; }
.footer-links a:hover { text-decoration: underline; }

.footer-meta {
  margin: 4px 0;
  font-size: 13px;
  color: rgba(255, 255, 255, .9);
}
.footer-meta:first-of-type { margin-top: 18px; }

.footer-copy {
  margin: 0;
  padding: 12px 16px;
  font-size: 13px;
  color: #fff;
}

/* ------------------------------------------------------------
   MOBILE-ONLY ELEMENTS (hidden on desktop, revealed in the media query)
   ------------------------------------------------------------ */
.header-logos .crs-logo-square { display: none; height: 44px; width: auto; }
.login-btn-mobile {
  display: none;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  background: linear-gradient(135deg, #7391BA, #234A7D);
  color: #fff;
  cursor: pointer;
}
.login-btn-mobile svg { width: 18px; height: 18px; }

/* ------------------------------------------------------------
   RESPONSIVE — compact header that mirrors the live site on phones:
   square logo only, A-/A/A+ and text Login hidden, icon login shown
   ------------------------------------------------------------ */
@media (max-width: 640px) {
  .header-row { min-height: 56px; padding: 6px 12px; gap: 8px; flex-wrap: nowrap; justify-content: space-between; }
  .header-logos { gap: 8px; }
  .header-logos .crs-logo { display: none; }          /* hide the wide text logo */
  .header-logos .crs-logo-square { display: block; }  /* show the square emblem logo */
  .header-logos .azadi-logo { height: 40px; }
  .tricolor-overlay .flag-bg { width: 560px; height: 56px; }
  .tricolor-overlay .emblem { height: 44px; margin: 0 28px; }
  .header-controls { gap: 6px; }
  .font-group { display: none; }                      /* A-/A/A+ hidden on mobile */
  .login-btn { display: none; }                       /* text login hidden */
  .login-btn-mobile { display: inline-flex; }         /* circular icon login shown */

  .footer-links li { padding: 0 10px; }
  .content { padding: 48px 12px; }              /* 12px sides → card width matches the live site */
  .cert-table td.label { width: 99px; }         /* narrower label column on phones, like the original */
}
