/* ==========================================================================
   SKNAU Income Tax Calculator — shared shell (header, menu, drawer, footer)
   plus site-wide polish and phone fixes. Loaded after each page's own <style>.
   Selectors are element+class so the pages' old `header {}` / `footer {}` rules can't leak in.
   ========================================================================== */
:root {
  --ix-navy-900: #0b2545;
  --ix-navy-800: #13315c;
  --ix-navy-700: #004080;
  --ix-blue-50: #eaf2fb;
  --ix-gold: #d9a600;
  --ix-line: #e3e8ef;
  --ix-bg: #f2f5f9;
  --ix-muted: #5b6675;
  --ix-radius: 14px;
  --ix-shadow: 0 10px 30px rgba(11, 37, 69, .08);
  --ix-ease: cubic-bezier(.22, 1, .36, 1);
}

html { -webkit-text-size-adjust: 100%; }
body:not(.ix-admin) { background-color: var(--ix-bg) !important; }
body { overflow-x: hidden; }
body.ix-drawer-open { overflow: hidden; }
img, video, canvas, iframe { max-width: 100%; }

.ix-wrap { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 16px; box-sizing: border-box; }
.ix-skip { position: absolute; left: -9999px; top: 0; z-index: 100; background: #fff; padding: 8px 12px; }
.ix-skip:focus { left: 8px; top: 8px; }

/* ---------- header ---------- */
/* Emblem height = height of the three text lines' letters (57 / 66 / 73px), measured in Chrome */
header.ix-header {
  position: sticky; top: 0; z-index: 40;
  background: #fff; color: var(--ix-navy-900);
  padding: 0; margin: 0; text-align: left; font-size: 16px; font-weight: 400; letter-spacing: normal;
  border: 0; border-bottom: 1px solid var(--ix-line); border-radius: 0;
  box-shadow: 0 2px 14px rgba(11, 37, 69, .06);
  font-family: 'Poppins', system-ui, sans-serif; line-height: 1.3;
}
header.ix-header *, .ix-drawer *, footer.ix-footer * { box-sizing: border-box; }
.ix-header-in { display: flex; align-items: center; gap: 10px; min-height: 64px; padding-top: 8px; padding-bottom: 8px; }
.ix-brand { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1 1 auto; text-decoration: none !important; color: var(--ix-navy-900); }
.ix-brand img { display: block; height: 57px; width: auto; flex-shrink: 0; margin: 0; }
.ix-brand-text { display: flex; flex-direction: column; min-width: 0; }
.ix-brand-hi { font-family: 'Noto Sans Devanagari', 'Poppins', sans-serif; font-weight: 700; font-size: 15px; color: var(--ix-navy-900); line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ix-brand-en { font-family: 'Oswald', 'Arial Narrow', sans-serif; font-weight: 500; font-size: 13px; color: var(--ix-navy-800); letter-spacing: .02em; line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ix-brand-sub { font-weight: 700; font-size: 14px; color: #b45309; line-height: 1.25; margin-top: 2px; white-space: nowrap; }
.ix-brand-sub [lang="hi"] { font-family: 'Noto Sans Devanagari', 'Poppins', sans-serif; font-size: 13px; }
.b-full { display: none; }
.b-short { display: inline; }

.ix-user { display: none; align-items: center; gap: 10px; flex-shrink: 0; }
.ix-user-name { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; font-size: 14px; color: var(--ix-navy-800); }
.ix-user-name i { color: var(--ix-navy-700); }
.ix-btn-logout, .ix-btn-login {
  display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 14px; border-radius: 10px;
  font-weight: 600; font-size: 14px; text-decoration: none !important; white-space: nowrap; transition: background-color .2s, color .2s;
}
.ix-btn-logout { background: #fdecec; color: #b42318 !important; }
.ix-btn-logout:hover { background: #b42318; color: #fff !important; }
.ix-btn-login { background: var(--ix-navy-700); color: #fff !important; }
.ix-btn-login:hover { background: var(--ix-navy-900); }

.ix-burger {
  display: grid; place-items: center; width: 44px; height: 44px; flex-shrink: 0; margin: 0; padding: 0;
  border: 1px solid var(--ix-line); border-radius: 12px; background: #fff; color: var(--ix-navy-900); font-size: 20px; cursor: pointer;
}

/* ---------- menu bar (tablet/desktop) ---------- */
nav.ix-nav { display: none; background: var(--ix-navy-700); margin: 0; padding: 0; border: 0; box-shadow: none; }
.ix-nav-in { display: flex; align-items: stretch; gap: 2px; overflow-x: auto; scrollbar-width: none; }
.ix-nav-in::-webkit-scrollbar { display: none; }
.ix-nav-link {
  display: inline-flex; align-items: center; gap: 8px; min-height: 48px; padding: 0 16px; margin: 0;
  color: rgba(255, 255, 255, .86) !important; font-weight: 500; font-size: 15px; text-decoration: none !important; white-space: nowrap;
  border-bottom: 3px solid transparent; transition: background-color .2s, color .2s, border-color .2s;
}
.ix-nav-link i { font-size: 14px; opacity: .9; }
.ix-nav-link:hover { background: rgba(255, 255, 255, .1); color: #fff !important; }
.ix-nav-link.is-active { color: #fff !important; font-weight: 600; border-bottom-color: var(--ix-gold); background: rgba(255, 255, 255, .08); }

/* ---------- drawer (phones) ---------- */
.ix-scrim { position: fixed; inset: 0; z-index: 55; background: rgba(7, 31, 61, .5); opacity: 0; transition: opacity .3s var(--ix-ease); }
.ix-drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 60; width: min(86vw, 340px);
  background: #fff; display: flex; flex-direction: column; box-shadow: -10px 0 40px rgba(0, 0, 0, .2);
  transform: translateX(104%); transition: transform .35s var(--ix-ease);
  font-family: 'Poppins', system-ui, sans-serif; padding-bottom: env(safe-area-inset-bottom);
}
body.ix-drawer-open .ix-drawer { transform: none; }
body.ix-drawer-open .ix-scrim { opacity: 1; }
.ix-drawer-head { display: flex; justify-content: space-between; align-items: center; min-height: 64px; padding: 8px 12px 8px 20px; border-bottom: 1px solid var(--ix-line); }
.ix-drawer-head strong { font-size: 17px; color: var(--ix-navy-900); }
.ix-drawer-close { width: 44px; height: 44px; display: grid; place-items: center; border: 0; background: var(--ix-bg); border-radius: 12px; color: var(--ix-navy-900); font-size: 20px; cursor: pointer; }
.ix-drawer-user { margin: 12px 12px 4px; padding: 10px 12px; border-radius: 12px; background: var(--ix-blue-50); color: var(--ix-navy-800); font-weight: 600; font-size: 14px; overflow-wrap: anywhere; }
.ix-drawer-body { overflow-y: auto; padding: 8px 12px 24px; overscroll-behavior: contain; display: flex; flex-direction: column; gap: 2px; }
.ix-drawer-link { display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 8px 12px; border-radius: 12px; color: #1b2533 !important; font-weight: 600; font-size: 15px; text-decoration: none !important; }
.ix-drawer-link i { width: 20px; text-align: center; color: var(--ix-navy-700); }
.ix-drawer-link:hover, .ix-drawer-link.is-active { background: var(--ix-blue-50); color: var(--ix-navy-700) !important; }
.ix-drawer-logout { margin-top: 10px; border-top: 1px solid var(--ix-line); border-radius: 0 0 12px 12px; color: #b42318 !important; }
.ix-drawer-logout i { color: #b42318; }

/* ---------- footer ---------- */
footer.ix-footer {
  margin: 32px 0 0; margin-top: auto; padding: 22px 0 calc(22px + env(safe-area-inset-bottom));
  background: var(--ix-navy-900); color: rgba(255, 255, 255, .85);
  text-align: left; font-size: 13px; line-height: 1.55; border-radius: 0; box-shadow: none;
  font-family: 'Poppins', system-ui, sans-serif;
}
.ix-footer-in { display: flex; flex-direction: column; gap: 10px; }
.ix-foot-hi { font-family: 'Noto Sans Devanagari', 'Poppins', sans-serif; font-weight: 700; font-size: 15px; color: #fff; }
.ix-foot-en { font-family: 'Oswald', 'Arial Narrow', sans-serif; font-size: 13.5px; color: #ffd966; letter-spacing: .02em; }
.ix-foot-credit span { color: rgba(255, 255, 255, .6); font-size: 12px; }

/* The old per-page welcome/logout bars are now in the header */
.user-info-header, #userInfoContainer, #userInfoHeader { display: none !important; }

/* ---------- page polish ---------- */
body:not(.ix-admin) > main:not([class]) { width: calc(100% - 32px); box-sizing: border-box; border-radius: var(--ix-radius) !important; box-shadow: var(--ix-shadow) !important; border: 1px solid var(--ix-line); }
main h2, main .page-title { color: var(--ix-navy-700); }
main input:not([type=radio]):not([type=checkbox]):not([type=file]), main select, main textarea { max-width: 100%; }
main input:focus, main select:focus, main textarea:focus { outline: none; border-color: var(--ix-navy-700) !important; box-shadow: 0 0 0 3px rgba(0, 64, 128, .18) !important; }
main button, main .btn, main input[type=submit] { border-radius: 10px; }

/* ---------- phones ---------- */
@media (max-width: 700px) {
  body:not(.ix-admin) > main:not([class]) { margin: 14px auto !important; padding: 20px 16px !important; width: calc(100% - 24px) !important; max-width: none !important; }
  main h2 { font-size: 1.35rem !important; }
  main h3 { font-size: 1.1rem !important; }
  /* wide tables scroll sideways instead of stretching the page */
  body:not(.ix-admin) main table { display: block; max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  body:not(.ix-admin) main table td, body:not(.ix-admin) main table th { white-space: nowrap; }
  main .slabs-container { flex-direction: column !important; gap: 16px !important; }
  main .slab-card { min-width: 0 !important; max-width: none !important; width: 100%; }
  main table.slab-table { display: table; }
  main table.slab-table td { white-space: normal; }
  /* side-by-side form rows stack */
  main .form-row, main .form-grid, main .row, main .grid-2, main .two-col { display: block !important; }
  main input:not([type=radio]):not([type=checkbox]), main select, main textarea { font-size: 16px; } /* no iOS zoom */
  main input[type=file] { width: 100% !important; max-width: 100% !important; box-sizing: border-box; }
}

/* ---------- tablets and up ---------- */
@media (min-width: 701px) {
  .b-full { display: inline; }
  .b-short { display: none; }
  .ix-header-in { min-height: 76px; }
  .ix-brand img { height: 66px; }
  .ix-brand-hi { font-size: 18px; }
  .ix-brand-en { font-size: 15.5px; }
  .ix-brand-sub { font-size: 15.5px; margin-top: 3px; }
  .ix-brand-sub [lang="hi"] { font-size: 14.5px; }
  .ix-user { display: flex; }
  .ix-user-name { display: none; }
  .ix-burger { display: none; }
  nav.ix-nav { display: block; }
  .ix-footer-in { flex-direction: row; justify-content: space-between; align-items: center; }
  .ix-foot-credit { text-align: right; }
}
@media (min-width: 701px) and (max-width: 1023px) {
  .ix-nav-in { flex-wrap: wrap; justify-content: center; overflow: visible; }
  .ix-nav-link { padding: 0 11px; font-size: 14px; min-height: 44px; }
}
@media (min-width: 1024px) {
  .ix-header-in { min-height: 84px; }
  .ix-brand img { height: 73px; }
  .ix-brand-hi { font-size: 20px; }
  .ix-brand-en { font-size: 17px; }
  .ix-brand-sub { font-size: 16.5px; margin-top: 4px; }
  .ix-brand-sub [lang="hi"] { font-size: 15.5px; }
  .ix-user-name { display: inline; }
  .ix-nav-in { justify-content: center; }
}

@media print {
  header.ix-header, nav.ix-nav, .ix-drawer, .ix-scrim, footer.ix-footer, .ix-skip { display: none !important; }
  body { background: #fff !important; }
}
@media (prefers-reduced-motion: reduce) {
  .ix-drawer, .ix-scrim { transition: none; }
}

/* ---------- calculation summary (calculate.php) ---------- */
body > .container { width: calc(100% - 32px); box-sizing: border-box; }
@media (max-width: 700px) {
  body > .container { margin: 12px auto !important; padding: 16px 14px !important; width: calc(100% - 24px); }
  body > .container header h1 { font-size: 1.15rem !important; }
  body > .container header h2 { font-size: 1rem !important; }
  .button-container { display: flex; flex-direction: column; gap: 10px; }
  .button-container > *, .button-container form, .button-container button, .button-container a { width: 100%; margin: 0 !important; box-sizing: border-box; }
}

/* ---------- admin (Comptroller) pages: body.ix-admin ---------- */
.ix-theme {
  display: grid; place-items: center; width: 40px; height: 40px; padding: 0; margin: 0;
  border: 1px solid var(--ix-line); border-radius: 10px; background: #fff; color: var(--ix-navy-900); cursor: pointer;
}
.ix-theme svg { display: block; }
[data-theme="dark"] header.ix-header { background: #0f1724; border-bottom-color: #1f2a3a; box-shadow: 0 2px 14px rgba(0, 0, 0, .4); }
[data-theme="dark"] .ix-brand-hi { color: #e6edf7; }
[data-theme="dark"] .ix-brand-en, [data-theme="dark"] .ix-user-name { color: #b9c6dc; }
[data-theme="dark"] .ix-brand-sub { color: #f4b860; }
[data-theme="dark"] .ix-brand img { background: #fff; border-radius: 50%; }
[data-theme="dark"] .ix-theme, [data-theme="dark"] .ix-burger { background: #161f2e; border-color: #2a3648; color: #e6edf7; }
[data-theme="dark"] nav.ix-nav { background: #0a2a52; }
[data-theme="dark"] .ix-drawer { background: #0f1724; }
[data-theme="dark"] .ix-drawer-head { border-color: #1f2a3a; }
[data-theme="dark"] .ix-drawer-head strong, [data-theme="dark"] .ix-drawer-link { color: #e6edf7 !important; }
[data-theme="dark"] .ix-drawer-link:hover, [data-theme="dark"] .ix-drawer-link.is-active { background: #1c2a45; }
[data-theme="dark"] .ix-drawer-user { background: #1c2a45; color: #dde2ee; }
[data-theme="dark"] .ix-drawer-close { background: #161f2e; color: #e6edf7; }
/* admin panel has no menu: show the logout button on phones too */
body.ix-admin .ix-user { display: flex; }
@media (max-width: 700px) { body.ix-admin .ix-btn-logout span, body.ix-admin .ix-btn-login span { display: none; } }
