/* Alumni Association Portal — bilingual (English / ಕನ್ನಡ) PWA styles */

:root {
  --ink: #1E2A47;
  --ink-2: #44506F;
  --muted: #5E6880;
  --silver: #C9CFD9;
  --silver-soft: #E7EAF0;
  --paper: #F5F6F8;
  --white: #FFFFFF;
  --marigold: #E3A21A;
  --marigold-deep: #A8740A;
  --leaf: #2F7A57;
  --leaf-soft: #E3F1EA;
  --brick: #B3392C;
  --brick-soft: #F8E5E2;
  --amber-soft: #FCF1D9;

  --font-display: "Anek Kannada", system-ui, sans-serif;
  /* Google Sans has no Kannada letters, so Kannada text falls through to Anek Kannada */
  --font-body: "Google Sans", "Anek Kannada", system-ui, -apple-system, "Segoe UI", sans-serif;

  --step--1: 0.875rem;
  --step-0: 1rem;
  --step-1: 1.125rem;
  --step-2: 1.375rem;
  --step-3: 1.75rem;
  --step-4: 2.375rem;
  --step-5: 3.25rem;

  --topbar-h: 60px;
  --tabbar-h: 64px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --radius-panel: 12px;
  --radius-control: 8px;
}

*, *::before, *::after { box-sizing: border-box; }

[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--step-0);
  line-height: 1.6;
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: auto 1fr auto;
  grid-template-areas: "top" "main" "foot";
}

/* Kannada reads better with a little more leading */
body.lang-kn { line-height: 1.75; }

h1, h2, h3 { font-family: var(--font-display); line-height: 1.2; margin: 0 0 .5rem; font-weight: 600; }
h1 { font-size: var(--step-4); letter-spacing: -0.01em; }
h2 { font-size: var(--step-2); }
p { margin: 0 0 1rem; max-width: 72ch; }
a { color: var(--ink); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--marigold-deep); }
img { max-width: 100%; }

:focus-visible { outline: 3px solid var(--marigold); outline-offset: 2px; border-radius: 4px; }

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}
.skip { position: absolute; left: -999px; top: 0; background: var(--ink); color: var(--white); padding: .5rem 1rem; z-index: 100; }
.skip:focus { left: 1rem; top: calc(var(--safe-top) + .5rem); }
.muted { color: var(--muted); }
.hint { color: var(--muted); font-size: var(--step--1); }

/* ---------- Top bar ---------- */
.topbar {
  grid-area: top;
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: .75rem;
  padding: calc(var(--safe-top) + .5rem) max(1rem, env(safe-area-inset-right)) .5rem max(1rem, env(safe-area-inset-left));
  min-height: calc(var(--topbar-h) + var(--safe-top));
  background: var(--ink);
  color: var(--white);
}
.brand { display: flex; align-items: center; gap: .6rem; min-width: 0; color: var(--white); text-decoration: none; }
.brand img { flex: none; border-radius: 9px; height: 36px; width: auto; max-width: 180px; object-fit: contain; }
.brand-name { font-family: var(--font-display); font-weight: 700; font-size: var(--step-1); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.lang-switch { display: flex; flex: none; margin-left: auto; border: 1px solid rgba(255,255,255,.28); border-radius: 999px; padding: 2px; }
.lang-switch a {
  color: var(--silver); text-decoration: none; padding: .2rem .75rem; border-radius: 999px;
  font-size: var(--step--1); line-height: 1.8;
}
.lang-switch a[aria-current="true"] { background: var(--white); color: var(--ink); font-weight: 600; }
.lang-switch a:hover { color: var(--white); }
.lang-switch a[aria-current="true"]:hover { color: var(--ink); }

.topbar-actions { display: flex; align-items: center; gap: .5rem; }
.topbar .link-btn { color: var(--silver); }
.topbar .link-btn:hover { color: var(--white); }
.btn-install {
  background: var(--marigold); color: var(--ink); border: 0; border-radius: 999px;
  padding: .35rem .9rem; font: 600 var(--step--1)/1.5 var(--font-body); cursor: pointer;
}

/* Bell */
.bell { position: relative; }
.bell-btn {
  position: relative; display: grid; place-items: center; width: 42px; height: 42px;
  background: transparent; color: var(--white); border: 0; border-radius: 50%; cursor: pointer;
}
.bell-btn:hover { background: rgba(255,255,255,.1); }
.bell-count, .tab-count {
  position: absolute; top: 4px; right: 2px; min-width: 19px; height: 19px; padding: 0 5px;
  background: var(--marigold); color: var(--ink); border-radius: 999px;
  font: 700 11px/19px var(--font-body); text-align: center;
}
.bell-count.pop { animation: pop .35s ease-out; }
@keyframes pop { 0% { transform: scale(.6); } 70% { transform: scale(1.2); } 100% { transform: scale(1); } }

.bell-panel {
  position: absolute; right: 0; top: calc(100% + 8px); width: min(360px, calc(100vw - 2rem));
  background: var(--white); color: var(--ink); border-radius: var(--radius-panel);
  box-shadow: 0 12px 32px rgba(30, 42, 71, .22); overflow: hidden;
}
.bell-head { display: flex; justify-content: space-between; align-items: center; padding: .75rem 1rem; border-bottom: 1px solid var(--silver-soft); }
.bell-list { list-style: none; margin: 0; padding: 0; max-height: 60vh; overflow-y: auto; }
.bell-list li a { display: block; padding: .7rem 1rem; text-decoration: none; border-bottom: 1px solid var(--silver-soft); }
.bell-list li a:hover { background: var(--paper); color: var(--ink); }
.bell-list li.unread a { box-shadow: inset 3px 0 0 var(--marigold); background: #FFFBF1; }
.bell-list strong { display: block; font-weight: 600; }
.bell-list span { display: block; color: var(--muted); font-size: var(--step--1); }
.bell-list time { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
.bell-empty { padding: 1.25rem 1rem; color: var(--muted); }
.bell-foot { display: block; text-align: center; padding: .7rem; font-weight: 600; text-decoration: none; }

/* ---------- Layout ---------- */
.main { grid-area: main; width: 100%; max-width: 1080px; margin: 0 auto; padding: 1.5rem max(1rem, env(safe-area-inset-left)) 2rem; }
.footer {
  grid-area: foot; padding: 2.5rem max(1.5rem, env(safe-area-inset-left)) 1.5rem;
  background: var(--ink); color: var(--white); border-top: 3px solid var(--marigold);
}
.footer-inner, .footer-bottom { max-width: 1080px; margin: 0 auto; }
.footer-inner { display: grid; gap: 1.75rem; }
.footer-brand strong { font-family: var(--font-display); font-size: var(--step-1); font-weight: 700; }
.footer-brand p { margin: .6rem 0 0; color: var(--silver); max-width: 34ch; }
.footer-links { display: grid; grid-template-columns: 1fr 1fr; gap: 1.75rem; }
.footer-links ul { list-style: none; margin: 0; padding: 0; display: grid; gap: .55rem; align-content: start; }
.footer a { color: var(--white); text-decoration: none; }
.footer a:hover { color: var(--marigold); }
.footer-bottom {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  margin-top: 2rem; padding-top: 1.25rem; border-top: 1px solid rgba(255,255,255,.15);
  font-size: var(--step--1); color: var(--silver);
}
.footer-bottom p { margin: 0; max-width: none; }
.footer-bottom p a { color: var(--marigold); font-weight: 600; }
.footer-bottom p a:hover { text-decoration: underline; }
.footer .to-top {
  flex: none; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%;
  background: var(--white); color: var(--ink);
}
.footer .to-top:hover { background: var(--marigold); color: var(--ink); }
@media (min-width: 720px) {
  .footer-inner { grid-template-columns: 2fr 2fr; }
}

.sidenav { display: none; }
.tabbar { display: none; }

body.is-member .tabbar {
  display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  height: calc(var(--tabbar-h) + var(--safe-bottom)); padding-bottom: var(--safe-bottom);
  background: var(--white); border-top: 1px solid var(--silver);
}
body.is-member .main { padding-bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 2rem); }
body.is-member .footer { padding-bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 1rem); }
.tabbar a {
  position: relative; flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  color: var(--muted); text-decoration: none; font-size: 12px; font-weight: 500;
}
.tabbar svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tabbar a[aria-current="page"] { color: var(--ink); font-weight: 700; }
.tabbar a[aria-current="page"] svg { stroke: var(--ink); fill: var(--silver-soft); }
.tab-count { top: 6px; right: calc(50% - 22px); }

@media (min-width: 960px) {
  body.is-member {
    grid-template-columns: 220px 1fr;
    grid-template-areas: "top top" "side main" "side foot";
  }
  body.is-member .tabbar { display: none; }
  body.is-member .main { padding-bottom: 2rem; }
  body.is-member .footer { padding-bottom: 1.5rem; }
  .sidenav {
    grid-area: side; display: flex; flex-direction: column; gap: 2px;
    position: sticky; top: calc(var(--topbar-h) + var(--safe-top)); align-self: start;
    padding: 1.5rem .75rem; height: calc(100vh - var(--topbar-h));
    border-right: 1px solid var(--silver-soft);
  }
  .sidenav a { padding: .55rem .9rem; border-radius: var(--radius-control); text-decoration: none; color: var(--ink-2); }
  .sidenav a:hover { background: var(--silver-soft); color: var(--ink); }
  .sidenav a[aria-current="page"] { background: var(--ink); color: var(--white); font-weight: 600; }
}

/* ---------- Notes ---------- */
.note { padding: .8rem 1rem; border-radius: var(--radius-control); margin-bottom: 1.25rem; border-left: 4px solid; }
.note-ok { background: var(--leaf-soft); border-color: var(--leaf); }
.note-err { background: var(--brick-soft); border-color: var(--brick); }
.note-warn { background: var(--amber-soft); border-color: var(--marigold); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  padding: .65rem 1.2rem; border-radius: var(--radius-control); border: 1px solid transparent;
  font: 600 var(--step-0)/1.4 var(--font-body); text-decoration: none; cursor: pointer;
}
.btn-primary { background: var(--ink); color: var(--white); }
.btn-primary:hover { background: #2B3A61; color: var(--white); }
.btn-ghost { background: var(--white); color: var(--ink); border-color: var(--silver); }
.btn-ghost:hover { border-color: var(--ink); color: var(--ink); }
.btn-danger { background: var(--white); color: var(--brick); border-color: #E2B4AD; }
.btn-danger:hover { background: var(--brick); color: var(--white); }
.btn-small { padding: .35rem .75rem; font-size: var(--step--1); }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.link-btn { background: none; border: 0; padding: 0; font: inherit; color: var(--ink); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.actions { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; }
.actions form { margin: 0; }

/* ---------- Home ---------- */
.hero { display: grid; gap: 2rem; align-items: center; padding: 1.5rem 0 2.5rem; }
.hero-title { font-size: clamp(2.25rem, 7vw, var(--step-5)); font-weight: 700; margin-bottom: .25rem; max-width: 16ch; }
.hero-alt { font-family: var(--font-display); font-size: var(--step-2); color: var(--ink-2); margin-bottom: 1.25rem; }
.lead { font-size: var(--step-1); color: var(--ink-2); }
.home-points { display: grid; gap: 1.5rem; padding: 2rem 0; border-top: 1px solid var(--silver); }
.home-points h2 { font-size: var(--step-1); }
.home-points p { color: var(--ink-2); }
.home-stats { color: var(--muted); }
@media (min-width: 760px) {
  .hero { grid-template-columns: 1.6fr 1fr; }
  .home-points { grid-template-columns: repeat(3, 1fr); }
}

/* Ribbon card: the one bold element — a medal ribbon for the batch / silver jubilee */
.ribbon-card {
  position: relative; display: flex; flex-direction: column; gap: .25rem;
  padding: 1.5rem 1.5rem 2.75rem; color: var(--white); background: var(--ink);
  clip-path: polygon(0 0, 100% 0, 100% 100%, 50% calc(100% - 22px), 0 100%);
  min-height: 210px; justify-content: center;
}
.ribbon-card::before {
  content: ""; position: absolute; inset: 0 auto 0 0; width: 10px; background: var(--marigold);
}
.ribbon-card::after {
  content: ""; position: absolute; inset: 0 0 0 auto; width: 10px; background: var(--silver);
}
.ribbon-label { color: var(--silver); font-size: var(--step--1); }
.ribbon-batch { font-family: var(--font-display); font-size: var(--step-3); font-weight: 700; line-height: 1.15; }
.ribbon-year { font-family: var(--font-display); font-size: var(--step-5); font-weight: 700; color: var(--marigold); line-height: 1; }
.ribbon-note { color: var(--silver-soft); }
.ribbon-card-dash { min-height: 170px; }

/* ---------- Dashboard & panels ---------- */
.page-head { margin-bottom: 1.25rem; }
.page-head-row { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 1rem; }
.page-head-row h1 { margin: 0; }
.dash-grid { display: grid; gap: 1rem; }
@media (min-width: 760px) {
  .dash-grid { grid-template-columns: repeat(2, 1fr); }
  .panel-wide { grid-column: 1 / -1; }
}
.panel { background: var(--white); border: 1px solid var(--silver-soft); border-radius: var(--radius-panel); padding: 1.25rem; }
.panel h2 { font-size: var(--step-1); }
.panel-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; }
.section-title { margin-top: 2rem; font-size: var(--step-2); }

progress.meter {
  -webkit-appearance: none; appearance: none; width: 100%; height: 10px; border: 0; border-radius: 999px;
  background: var(--silver-soft); overflow: hidden; margin: .25rem 0 .5rem;
}
progress.meter::-webkit-progress-bar { background: var(--silver-soft); border-radius: 999px; }
progress.meter::-webkit-progress-value { background: var(--leaf); border-radius: 999px; }
progress.meter::-moz-progress-bar { background: var(--leaf); border-radius: 999px; }

/* ---------- Feed ---------- */
.feed { list-style: none; margin: 0; padding: 0; }
.feed li { position: relative; border-top: 1px solid var(--silver-soft); }
.feed li:first-child { border-top: 0; }
.feed li a { display: grid; gap: 2px; padding: .8rem .5rem .8rem .9rem; text-decoration: none; }
.feed li a:hover { background: var(--paper); color: var(--ink); }
.feed li.unread a { box-shadow: inset 3px 0 0 var(--marigold); }
.feed li.unread strong { font-weight: 700; }
.feed strong { font-weight: 500; }
.feed span { color: var(--ink-2); }
.feed time { color: var(--muted); font-size: var(--step--1); }
.feed-type { font-size: 12px; color: var(--muted); }
.feed-full { background: var(--white); border: 1px solid var(--silver-soft); border-radius: var(--radius-panel); overflow: hidden; }
.feed-full li a { padding-right: 6.5rem; }
.feed-remove { position: absolute; right: 1rem; top: .9rem; margin: 0; }
.feed-remove .link-btn { color: var(--muted); font-size: var(--step--1); }
.fallback { font-size: 12px; color: var(--marigold-deep); font-style: normal; }
.empty { color: var(--muted); padding: 1.5rem 0; }
.empty-state { text-align: center; padding: 3rem 1rem; }
.empty-state p { margin: 0 auto 1.25rem; }

.tabs { display: flex; gap: .25rem; margin-bottom: 1rem; border-bottom: 1px solid var(--silver); }
.tabs a { padding: .5rem 1rem; text-decoration: none; color: var(--muted); border-bottom: 3px solid transparent; margin-bottom: -1px; }
.tabs a[aria-current="page"] { color: var(--ink); border-color: var(--ink); font-weight: 600; }
.pager { display: flex; gap: .3rem; margin-top: 1rem; }
.pager a { min-width: 2.25rem; text-align: center; padding: .3rem .5rem; border: 1px solid var(--silver); border-radius: 6px; text-decoration: none; }
.pager a[aria-current="page"] { background: var(--ink); color: var(--white); border-color: var(--ink); }

/* ---------- Forms ---------- */
.auth { max-width: 440px; margin: 1rem auto 0; }
.auth-wide { max-width: 720px; }
.auth-switch { margin-top: 1.25rem; text-align: center; }
.form { display: grid; gap: 1rem; }
.form-narrow { max-width: 720px; }
.field { display: grid; gap: .3rem; }
.field > span { font-weight: 600; font-size: var(--step--1); color: var(--ink-2); }
.field input, .field select, .field textarea {
  width: 100%; padding: .7rem .8rem; border: 1px solid var(--silver); border-radius: var(--radius-control);
  background: var(--white); color: var(--ink); font: inherit; line-height: 1.5;
}
.field textarea { resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { outline: 2px solid var(--marigold); outline-offset: 0; border-color: var(--ink); }
.combo { position: relative; }
.combo-list {
  position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 30;
  margin: 0; padding: .25rem 0; list-style: none; max-height: 16rem; overflow-y: auto;
  background: var(--white); border: 1px solid var(--silver); border-radius: var(--radius-control);
  box-shadow: 0 10px 24px rgba(30,42,71,.18); font-weight: 400;
}
.combo-list li { padding: .5rem .8rem; }
.combo-list [role="option"] { cursor: pointer; }
.combo-list [role="option"]:hover, .combo-list .active { background: var(--amber-soft); }
.combo-list [aria-selected="true"] { font-weight: 600; }
.combo-list .combo-group { padding-top: .7rem; font-size: var(--step--1); font-weight: 600; color: var(--muted); }
.combo-list .combo-empty { color: var(--muted); }
.check { display: flex; gap: .6rem; align-items: flex-start; }
.check input { width: 1.15rem; height: 1.15rem; margin-top: .25rem; accent-color: var(--ink); flex: none; }
fieldset { border: 1px solid var(--silver-soft); border-radius: var(--radius-panel); padding: 1rem; margin: 0; background: var(--white); }
legend { font-family: var(--font-display); font-weight: 600; padding: 0 .4rem; }
.grid-2, .grid-3 { display: grid; gap: 1rem; }
@media (min-width: 640px) {
  .grid-2 { grid-template-columns: 1fr 1fr; }
  .grid-3 { grid-template-columns: repeat(3, 1fr); }
  .field-span { grid-column: 1 / -1; }
}
.bilingual { display: grid; gap: 1rem; }
@media (min-width: 760px) { .bilingual { grid-template-columns: 1fr 1fr; } }
.channels { display: flex; flex-wrap: wrap; gap: .5rem 1.5rem; }
.channels legend { width: 100%; }
.filters { display: grid; gap: .75rem; margin-bottom: 1.25rem; align-items: end; }
@media (min-width: 760px) { .filters { grid-template-columns: 2fr 1fr 1fr auto; } }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; background: var(--white); border: 1px solid var(--silver-soft); border-radius: var(--radius-panel); }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: .7rem .9rem; border-bottom: 1px solid var(--silver-soft); vertical-align: top; }
thead th { font-size: var(--step--1); color: var(--muted); font-weight: 600; background: var(--paper); white-space: nowrap; }
tbody tr:last-child td, tbody tr:last-child th { border-bottom: 0; }
.row-actions { display: flex; flex-wrap: wrap; gap: .4rem; justify-content: flex-end; }
.row-actions form { margin: 0; }
.data-raw th, .data-raw td { white-space: nowrap; max-width: 24rem; overflow: hidden; text-overflow: ellipsis; }
.data-raw .row-actions { flex-wrap: nowrap; justify-content: flex-start; }
.data-raw .row-deleted td { color: var(--muted); background: var(--paper); }
.field small { font-weight: 400; }
@media (min-width: 760px) { .filters-db { grid-template-columns: 2fr 1fr auto; } }
.prefs td { text-align: center; }
.prefs td input { width: 1.2rem; height: 1.2rem; accent-color: var(--ink); }
.prefs tbody th { font-weight: 500; }

.pill { display: inline-block; padding: .1rem .6rem; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; background: var(--silver-soft); }
.pill-pending { background: var(--amber-soft); color: var(--marigold-deep); }
.pill-auto_verified, .pill-manual_verified, .pill-admin_created { background: var(--leaf-soft); color: var(--leaf); }
.pill-rejected { background: var(--brick-soft); color: var(--brick); }

/* ---------- PWA bits ---------- */
.ios-hint {
  position: fixed; left: 1rem; right: 1rem; bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 1rem); z-index: 50;
  background: var(--ink); color: var(--white); padding: .9rem 1rem; border-radius: var(--radius-panel);
  box-shadow: 0 10px 24px rgba(30,42,71,.3);
}
.ios-hint .link-btn { color: var(--marigold); margin-left: .5rem; }
.toast {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 1rem); z-index: 60;
  background: var(--ink); color: var(--white); padding: .7rem 1rem; border-radius: var(--radius-control);
  display: flex; gap: .75rem; align-items: center; max-width: calc(100vw - 2rem);
}
.toast .link-btn { color: var(--marigold); }
@media (min-width: 960px) { .toast, .ios-hint { bottom: 1.5rem; } }

body.offline-page { display: grid; place-items: center; grid-template-areas: none; padding: 1.5rem; }
.offline-box { max-width: 460px; text-align: center; background: var(--white); padding: 2rem 1.5rem; border-radius: var(--radius-panel); border: 1px solid var(--silver-soft); }
.offline-box h1 { font-size: var(--step-3); }
.offline-box h2 { font-size: var(--step-2); margin-top: 1rem; }
.offline-box p { margin-left: auto; margin-right: auto; }

@media (display-mode: standalone) {
  .btn-install { display: none !important; }
}
@media (max-width: 520px) {
  .brand-name { display: none; }
  .topbar .logout { display: none; }
  h1 { font-size: var(--step-3); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
.settings-account { margin-top: 2rem; }
.topbar .bell-panel .link-btn { color: var(--ink); font-size: var(--step--1); }
.topbar .bell-panel .link-btn:hover { color: var(--marigold-deep); }

.settings-current { margin: .5rem 0 0; }
.settings-current img { height: 36px; width: auto; max-width: 180px; background: var(--ink); border-radius: 9px; padding: 4px; }
