/* ================================================================
   GSTVerify — Design System v2
   Mobile-first, refined, production-grade
   ================================================================ */

/* -- Reset & box model ------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

/* -- Design tokens ---------------------------------------------- */
:root {
  /* Dark (default) */
  --bg:       #0a0d12;
  --surface:  #111620;
  --surface2: #181e2b;
  --border:   #252d3d;
  --border2:  #1c2333;
  --ink:      #e2e8f4;
  --ink2:     #7d8fa8;
  --ink3:     #3e4d63;
  --accent:   #f0883e;
  --accent2:  #ffa057;
  --green:    #3ecf72;
  --red:      #f75a5a;
  --blue:     #5badff;
  --amber:    #f5c842;

  --radius:    10px;
  --radius-lg: 16px;
  --shadow:    0 4px 24px rgba(0,0,0,.45);
  --shadow-sm: 0 1px 6px rgba(0,0,0,.3);

  --mono:  'DM Mono', 'Fira Mono', monospace;
  --serif: 'DM Serif Display', Georgia, serif;
  --sans:  'Plus Jakarta Sans', 'DM Sans', system-ui, sans-serif;

  --header-h: 56px;
  --page-max: 980px;
  --transition: 0.22s ease;
}

:root[data-theme="light"] {
  --bg:       #f0f4fa;
  --surface:  #ffffff;
  --surface2: #f7f9fc;
  --border:   #dce3ee;
  --border2:  #e8edf6;
  --ink:      #1a202e;
  --ink2:     #4a5568;
  --ink3:     #9aa5b4;
  --shadow:   0 4px 20px rgba(0,0,0,.08);
  --shadow-sm:0 1px 4px rgba(0,0,0,.06);
}

/* Logo Visibility Logic */
.logo-img.dark-only { display: none; }
.logo-img.light-only { display: block; }

/* Switch when data-theme is dark */
[data-theme="dark"] .logo-img.dark-only { display: block; }
[data-theme="dark"] .logo-img.light-only { display: none; }

/* Handle cases where no theme is set yet (system dark mode) */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .logo-img.dark-only { display: block; }
    :root:not([data-theme="light"]) .logo-img.light-only { display: none; }
}
/* -- Base typography -------------------------------------------- */
body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  line-height: 1.6;
  transition: background var(--transition), color var(--transition);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { line-height: 1.2; }

/* -- Header ----------------------------------------------------- */
header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-h);
  border-bottom: 1px solid var(--border2);
  background: var(--bg);
  /* frosted glass on supporting browsers */
  backdrop-filter: blur(16px) saturate(160%);
  -webkit-backdrop-filter: blur(16px) saturate(160%);
  background-color: color-mix(in srgb, var(--bg) 85%, transparent);
  padding: 0 1.25rem;
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.logo {
  font-family: var(--serif);
  font-size: 1.2rem;
  color: var(--ink);
  text-decoration: none;
  letter-spacing: -.02em;
  white-space: nowrap;
  flex-shrink: 0;
}
.logo span { color: var(--accent); }

/* -- Nav -------------------------------------------------------- */
nav {
  display: flex;
  gap: 0.25rem;
  margin-left: auto;
  align-items: center;
}

nav a {
  font-size: .75rem;
  color: var(--ink2);
  text-decoration: none;
  text-transform: uppercase;
  letter-spacing: .06em;
  font-weight: 600;
  padding: .35rem .65rem;
  border-radius: 6px;
  transition: color var(--transition), background var(--transition);
  white-space: nowrap;
}
nav a:hover { color: var(--ink); background: var(--border2); }
nav a.active { color: var(--accent); background: rgba(240,136,62,.1); }

.theme-toggle {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  width: 34px; height: 34px;
  cursor: pointer;
  color: var(--ink2);
  font-size: .95rem;
  display: flex; align-items: center; justify-content: center;
  transition: border-color var(--transition), color var(--transition);
  flex-shrink: 0;
  margin-left: .25rem;
}
.theme-toggle:hover { border-color: var(--accent); color: var(--accent); }

/* -- Nav Tools dropdown ----------------------------------------- */
.nav-dropdown { position: relative; }
.nav-dropdown-trigger { cursor: pointer; }
.nav-dropdown-panel {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: var(--radius-lg);
  box-shadow: 0 10px 32px rgba(0,0,0,.2);
  padding: .5rem;
  width: 700px;
  max-width: calc(100vw - 2rem);
  z-index: 500;
}
.nav-dropdown-panel.open {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1fr;
  gap: 0;
}
.nav-dropdown-panel .dd-hd {
  grid-column: 1 / -1;
  font-size: .59rem;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--ink3);
  font-weight: 700;
  padding: .55rem .55rem .2rem;
  margin-top: .15rem;
  border-top: 1px solid var(--border2);
}
.nav-dropdown-panel .dd-hd:first-child { border-top: none; margin-top: 0; }
.nav-dropdown-panel a {
  display: flex;
  align-items: center;
  gap: .3rem;
  padding: .34rem .5rem;
  font-size: .77rem;
  color: var(--ink2);
  text-decoration: none;
  border-radius: 5px;
  transition: background .12s, color .12s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.nav-dropdown-panel a:hover { background: var(--surface2); color: var(--accent); }

/* -- Mobile nav hamburger --------------------------------------- */
.nav-toggle {
  display: none;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  width: 34px; height: 34px;
  cursor: pointer;
  color: var(--ink);
  font-size: 1.1rem;
  align-items: center; justify-content: center;
  margin-left: auto;
  flex-shrink: 0;
}

/* -- Page layout ------------------------------------------------ */
.page {
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 2rem 1.25rem;
  width: 100%;
  flex: 1;
}

.page-header { margin-bottom: 2rem; }
.page-header h1 {
  font-family: var(--serif);
  font-size: clamp(1.6rem, 4vw, 2.2rem);
  margin-bottom: .35rem;
}
.page-header p { color: var(--ink2); font-size: .9rem; }

/* -- Cards ------------------------------------------------------ */
.card {
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 1rem;
}

/* -- Buttons ---------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  background: var(--accent);
  color: #0a0d12;
  border: none;
  border-radius: var(--radius);
  font-size: .82rem;
  font-weight: 700;
  padding: .6rem 1.25rem;
  cursor: pointer;
  transition: background var(--transition), transform .12s;
  white-space: nowrap;
  font-family: var(--sans);
  letter-spacing: .01em;
}
.btn:hover:not(:disabled) { background: var(--accent2); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }

.btn-ghost {
  background: transparent;
  color: var(--ink2);
  border: 1px solid var(--border);
}
.btn-ghost:hover:not(:disabled) { background: var(--border2); color: var(--ink); border-color: var(--border); transform: none; }

/* -- Search input ----------------------------------------------- */
.search-wrap {
  display: flex;
  gap: .5rem;
  margin-bottom: 1.5rem;
}
.search-input {
  flex: 1;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--ink);
  padding: .75rem 1rem;
  font-family: var(--mono);
  text-transform: uppercase;
  outline: none;
  font-size: .95rem;
  transition: border-color var(--transition), box-shadow var(--transition);
  min-width: 0;
}
.search-input::placeholder { text-transform: none; color: var(--ink3); }
.search-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(240,136,62,.15);
}

/* -- Status pills ----------------------------------------------- */
.pill {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .3rem .85rem;
  border-radius: 100px;
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  white-space: nowrap;
}
.pill::before { content: ''; width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.pill-active  { background: rgba(62,207,114,.12); color: var(--green); border: 1px solid rgba(62,207,114,.25); }
.pill-active::before  { background: var(--green); box-shadow: 0 0 6px var(--green); }
.pill-inactive { background: rgba(247,90,90,.12); color: var(--red);  border: 1px solid rgba(247,90,90,.25); }
.pill-inactive::before { background: var(--red); }

/* -- Info grid (result card) ------------------------------------ */
.info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  background: var(--border2);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 1.25rem;
}
.info-cell { background: var(--surface); padding: .9rem 1rem; }
.info-cell.full { grid-column: 1 / -1; }
.info-lbl {
  font-size: .68rem;
  text-transform: uppercase;
  letter-spacing: .09em;
  color: var(--ink3);
  margin-bottom: .3rem;
  font-weight: 700;
}
.info-val { font-size: .92rem; color: var(--ink); line-height: 1.45; }

.nba-tag {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: .2rem .6rem;
  color: var(--ink2);
  font-size: .72rem;
  display: inline-block;
  margin: 0 .2rem .2rem 0;
}

.gstin-badge {
  font-family: var(--mono);
  color: var(--accent);
  font-size: 1rem;
  letter-spacing: 2px;
  padding: .3rem .8rem;
  background: rgba(240,136,62,.08);
  border: 1px solid rgba(240,136,62,.2);
  border-radius: 7px;
  display: inline-block;
}

/* -- Tables ----------------------------------------------------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: var(--radius-lg); border: 1px solid var(--border2); }
table { width: 100%; border-collapse: collapse; font-size: .82rem; }
th {
  text-align: left;
  padding: .65rem .9rem;
  color: var(--ink3);
  font-weight: 700;
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .07em;
  border-bottom: 1px solid var(--border);
  background: var(--surface2);
  white-space: nowrap;
}
td {
  padding: .65rem .9rem;
  color: var(--ink2);
  border-bottom: 1px solid var(--border2);
  vertical-align: middle;
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--surface2); }

/* -- Progress bar ----------------------------------------------- */
.progress-wrap { height: 5px; background: var(--border); border-radius: 3px; overflow: hidden; }
.progress-bar  { height: 100%; background: var(--accent); border-radius: 3px; transition: width .35s ease; }

/* -- Textarea --------------------------------------------------- */
textarea {
  width: 100%;
  background: var(--surface2);
  color: var(--ink);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  font-family: var(--mono);
  font-size: .82rem;
  outline: none;
  resize: vertical;
  transition: border-color var(--transition);
  line-height: 1.6;
}
textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(240,136,62,.12); }

/* -- Pagination ------------------------------------------------- */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: .5rem;
  margin-top: 1.5rem;
  flex-wrap: wrap;
}
.page-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--ink);
  border-radius: 7px;
  padding: .4rem .85rem;
  cursor: pointer;
  font-size: .82rem;
  font-weight: 500;
  font-family: var(--sans);
  transition: border-color var(--transition), color var(--transition);
}
.page-btn:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.page-btn:disabled { opacity: .3; cursor: not-allowed; }
.page-info { font-size: .82rem; color: var(--ink3); padding: 0 .5rem; }

/* -- Stat number boxes ------------------------------------------ */
.stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; margin-bottom: 1.5rem; }
.stat-box { background: var(--surface); border: 1px solid var(--border2); border-radius: var(--radius-lg); padding: 1.25rem 1.5rem; }
.stat-box .stat-label { font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: var(--ink3); font-weight: 700; margin-bottom: .4rem; }
.stat-box .stat-val   { font-size: 1.9rem; font-weight: 700; color: var(--ink); font-family: var(--mono); line-height: 1; }
.stat-box .stat-sub   { font-size: .75rem; color: var(--ink3); margin-top: .3rem; }

/* -- Alert / error boxes --------------------------------------- */
.alert {
  padding: .85rem 1rem;
  border-radius: var(--radius);
  font-size: .88rem;
  line-height: 1.5;
}
.alert-error   { background: rgba(247,90,90,.08);  color: var(--red);   border: 1px solid rgba(247,90,90,.2); }
.alert-success { background: rgba(62,207,114,.08); color: var(--green); border: 1px solid rgba(62,207,114,.2); }
.alert-info    { background: rgba(91,173,255,.08); color: var(--blue);  border: 1px solid rgba(91,173,255,.2); }

/* -- Cache badge ------------------------------------------------ */
.cache-badge {
  display: inline-flex; align-items: center; gap: .3rem;
  font-size: .72rem; font-weight: 600;
  color: var(--blue);
  background: rgba(91,173,255,.1);
  border: 1px solid rgba(91,173,255,.2);
  border-radius: 100px;
  padding: .2rem .6rem;
}

/* -- Footer ----------------------------------------------------- */
.site-footer {
  background: var(--surface2);
  border-top: 1px solid var(--border2);
  padding: 3rem 0 0;
  margin-top: 3rem;
  width: 100%;
}

.footer-container {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap; /* Allows wrapping for 5 columns on smaller screens */
  gap: 2rem;
  padding: 0 1.5rem 2rem;
  justify-content: space-between;
  align-items: flex-start;
}

.footer-col {
  flex: 1;
  min-width: 160px; /* Adjusted to fit 5 columns on one row (~980px-1100px) */
  text-align: left;
}

.footer-title {
  color: var(--ink);
  font-size: .82rem;
  font-weight: 700;
  margin: 0 0 1.1rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  min-height: 1.2rem; /* Keeps alignment if title is empty/nbsp */
}

.footer-text {
  color: var(--ink3);
  font-size: .82rem;
  line-height: 1.65;
  margin: 0;
}

.footer-links {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: .6rem;
}

.footer-links a {
  color: var(--ink2);
  text-decoration: none;
  font-size: .84rem;
  transition: color .15s;
  white-space: nowrap; /* Keeps tool names on one line */
}

.footer-links a:hover { 
  color: var(--accent); 
}

/* Disclaimer block above copyright */
.footer-disclaimer {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.25rem 1.5rem;
  border-top: 1px solid var(--border2);
  color: var(--ink3);
  font-size: .72rem;
  line-height: 1.65;
}

.footer-disclaimer a { 
  color: var(--ink3); 
  text-decoration: underline; 
}

.footer-disclaimer a:hover { 
  color: var(--accent); 
}

/* Copyright bar — high-contrast strip at the very bottom */
.footer-copyright {
  background: #0b0f1a;
  border-top: 2px solid var(--accent);
  padding: 1rem 1.5rem;
  text-align: center;
  font-size: .74rem;
  color: #5a6478;
  letter-spacing: .01em;
  width: 100%;
  box-sizing: border-box;
}

.footer-copyright a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}

.footer-copyright a:hover { 
  text-decoration: underline; 
}

/* Keep copyright dark even in light theme — intentional brand contrast */
[data-theme="light"] .footer-copyright {
  background: #111827;
  color: #6b7280;
}

/* Responsive adjustments for 5 columns */
@media (max-width: 1024px) {
  .footer-col { min-width: calc(33.33% - 1.5rem); } /* 3 columns on small laptops */
}

@media (max-width: 768px) {
  .footer-col { min-width: calc(50% - 1rem); } /* 2 columns on tablets */
}

@media (max-width: 480px) {
  .footer-col { min-width: 100%; } /* 1 column on mobile */
  .footer-container { gap: 1.5rem; }
}
/* ================================================================
   MOBILE STYLES — max-width: 640px
   ================================================================ */
@media (max-width: 640px) {
  header { padding: 0 1rem; gap: .75rem; }

  .page { padding: 1.25rem 1rem; }

  /* Stack search button below input on very small screens */
  .search-wrap { flex-wrap: wrap; }
  .search-wrap .btn { width: 100%; justify-content: center; }

  /* Single column info grid on mobile */
  .info-grid { grid-template-columns: 1fr; }
  .info-cell.full { grid-column: 1; }

  /* Single column stats */
  .stat-row { grid-template-columns: 1fr 1fr; }

  /* Result header stacks */
  .result-header { flex-direction: column; align-items: flex-start !important; gap: .75rem; }

  /* Shrink table font on mobile */
  td, th { padding: .5rem .6rem; }
  table  { font-size: .78rem; }

  /* Page header */
  .page-header h1 { font-size: 1.5rem; }

  /* Cards */
  .card { padding: 1.1rem; }
}

@media (max-width: 420px) {
  .stat-row { grid-template-columns: 1fr; }
  nav a span.nav-label { display: none; }
}

/* -- Loading skeleton ------------------------------------------ */
@keyframes shimmer {
  from { background-position: -600px 0; }
  to   { background-position:  600px 0; }
}
.skeleton {
  background: linear-gradient(90deg, var(--surface2) 25%, var(--border2) 50%, var(--surface2) 75%);
  background-size: 600px 100%;
  animation: shimmer 1.4s infinite linear;
  border-radius: 6px;
}

/* -- Fade-in animation ----------------------------------------- */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
.fade-up { animation: fadeUp .35s ease both; }

/* -- Scrollbar -------------------------------------------------- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--ink3); }

/* ── Mobile hamburger nav ───────────────────────────────────────── */
@media (max-width: 640px) {
  /* Show hamburger, hide nothing in nav (nav is now a drawer) */
  .nav-toggle { display: flex !important; }

  /* Nav becomes a slide-down drawer */
  #mainNav {
    position: fixed;
    top: 56px; left: 0; right: 0;
    background: var(--surface);
    border-bottom: 1px solid var(--border2);
    flex-direction: column;
    padding: .5rem 0;
    gap: 0;
    transform: translateY(-110%);
    transition: transform .22s ease;
    z-index: 999;
    box-shadow: 0 8px 24px rgba(0,0,0,.15);
  }
  #mainNav.nav-open { transform: translateY(0); }

  #mainNav a {
    padding: .75rem 1.25rem !important;
    font-size: .9rem !important;
    border-bottom: 1px solid var(--border2);
    width: 100%;
    box-sizing: border-box;
    gap: .6rem;
  }
  #mainNav a:last-of-type { border-bottom: none; }

  /* Always show labels inside the open drawer */
  .nav-label { display: inline !important; }

  #mainNav .theme-toggle {
    display: none; /* toggle is now outside nav */
  }
  /* Theme toggle stays in header row on mobile */
  header .theme-toggle {
    display: flex !important;
    flex-shrink: 0;
  }
  /* Dropdown becomes inline in mobile drawer */
  .nav-dropdown { width: 100%; }
  /* Header z-index fix — logo always visible */
  header { z-index: 200; overflow: visible; }
  .logo { z-index: 201; position: relative; flex-shrink: 0; min-width: 0; }
  .logo img { max-height: 36px; width: auto; }

  .nav-dropdown-panel {
    position: static;
    transform: none;
    box-shadow: none;
    border: none;
    border-top: 1px solid var(--border2);
    border-radius: 0;
    width: 100%;
    max-width: 100%;
    padding: 0;
    background: var(--surface2);
  }
  .nav-dropdown-panel.open {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
  .nav-dropdown-panel .dd-hd {
    grid-column: 1 / -1;
    font-size: .6rem;
    padding: .5rem 1.25rem .2rem;
  }
  .nav-dropdown-panel a {
    padding: .6rem 1.25rem;
    font-size: .86rem;
    border-bottom: 1px solid var(--border2);
    border-radius: 0;
  }
}

@media (max-width: 380px) {
  .nav-dropdown-panel.open { grid-template-columns: 1fr; }
}
