/* =====================================================================
   உதவும் உள்ளங்கள் — Design tokens
   Palette: ivory ground, temple-bronze teal primary, turmeric accent,
            deep maroon for emphasis. Signature: kolam dot-divider.
   ===================================================================== */
:root {
  --ink: #2B2420;
  --ivory: #FAF6EC;
  --ivory-2: #F1EADB;
  --teal: #1F5C4E;
  --teal-dark: #143F35;
  --marigold: #E8A33D;
  --marigold-dark: #C67F1E;
  --maroon: #7A2E2E;
  --line: #E1D6BE;
  --white: #FFFFFF;
  --radius: 14px;
  --shadow: 0 6px 24px rgba(43, 36, 32, 0.08);
  --font-display: 'Baloo Thambi 2', 'Catamaran', sans-serif;
  --font-body: 'Inter', 'Noto Sans Tamil', sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--ivory);
  color: var(--ink);
  font-family: var(--font-body);
  line-height: 1.6;
}

h1, h2, h3, .brand {
  font-family: var(--font-display);
  color: var(--teal-dark);
  line-height: 1.15;
  margin: 0 0 .5rem;
}

a { color: var(--teal); text-decoration: none; }
a:hover { color: var(--marigold-dark); }

img { max-width: 100%; display: block; }

.container {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ---------------- Kolam dot divider (signature element) ---------------- */
.kolam-divider {
  height: 14px;
  background-image: radial-gradient(circle, var(--marigold) 2px, transparent 2.4px);
  background-size: 22px 14px;
  background-position: center;
  opacity: .55;
  margin: 0;
}

/* ---------------- Header ---------------- */
.site-header {
  background: var(--white);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 10;
}
.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 14px;
  padding-bottom: 14px;
}
.brand {
  font-size: 1.5rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
}
.brand .mark {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: conic-gradient(var(--marigold), var(--teal), var(--maroon), var(--marigold));
  flex-shrink: 0;
}
.brand small { display: block; font-family: var(--font-body); font-size: .68rem; color: var(--ink); font-weight: 400; opacity: .7; }
.nav-links { display: flex; gap: 22px; font-weight: 600; font-size: .95rem; }

/* ---------------- Hero ---------------- */
.hero {
  background: linear-gradient(180deg, var(--ivory-2), var(--ivory));
  padding: 32px 0 24px;
  text-align: center;
}
.hero h1 { font-size: 2.4rem; margin-bottom: .3rem; }
.hero p.tagline { font-size: 1.05rem; color: var(--maroon); font-weight: 600; margin-bottom: 4px; }
.hero p.sub { max-width: 620px; margin: 8px auto 18px; color: #574C40; }
.trust-notice {
  display: inline-block;
  background: var(--ivory-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 16px;
  font-size: .78rem;
  color: #7A6E5F;
  font-weight: 600;
  margin: 4px 0 6px;
}

.stats-bar {
  display: flex;
  justify-content: center;
  gap: 48px;
  flex-wrap: wrap;
  margin-top: 6px;
}
.stat { text-align: center; }
.stat .num { font-family: var(--font-display); font-size: 2rem; color: var(--teal); font-weight: 700; }
.stat .label { font-size: .82rem; text-transform: uppercase; letter-spacing: .04em; color: #7A6E5F; }

/* ---------------- Buttons ---------------- */
.btn {
  display: inline-block;
  padding: 11px 22px;
  border-radius: 999px;
  font-weight: 700;
  font-size: .95rem;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform .12s ease, box-shadow .12s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: var(--teal); color: var(--white); }
.btn-primary:hover { background: var(--teal-dark); color: var(--white); }
.btn-whatsapp { background: #25D366; color: var(--white); }
.btn-whatsapp:hover { background: #1DA851; color: var(--white); }
.btn-outline { background: transparent; border-color: var(--teal); color: var(--teal); }
.btn-outline:hover { background: var(--teal); color: var(--white); }
.btn-danger { background: var(--maroon); color: var(--white); }
.btn-small { padding: 6px 14px; font-size: .82rem; }
.btn:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible {
  outline: 3px solid var(--marigold);
  outline-offset: 2px;
}

/* ---------------- Cards grid ---------------- */
.section { padding: 30px 0; }
.section-title { text-align: center; margin-bottom: 20px; }
.section-title .eyebrow { color: var(--marigold-dark); font-weight: 700; letter-spacing: .06em; text-transform: uppercase; font-size: .78rem; }

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 24px;
}
.req-card {
  background: var(--white);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  border: 1px solid var(--line);
  display: flex;
  flex-direction: column;
}
.req-card .thumb {
  aspect-ratio: 16/10;
  background: var(--ivory-2) center/cover no-repeat;
  position: relative;
}
.req-card .status-badge {
  position: absolute; top: 10px; right: 10px;
  background: var(--white); padding: 4px 12px; border-radius: 999px;
  font-size: .74rem; font-weight: 700; box-shadow: var(--shadow);
}
.status-active { color: var(--teal); }
.status-completed { color: var(--marigold-dark); }
.status-closed { color: #999; }

.req-card .body { padding: 18px 18px 20px; display: flex; flex-direction: column; flex-grow: 1; }
.req-card h3 { font-size: 1.15rem; margin-bottom: 6px; }
.req-card .beneficiary { font-size: .82rem; color: #7A6E5F; margin-bottom: 10px; }
.req-card .excerpt { font-size: .92rem; color: #574C40; flex-grow: 1; margin-bottom: 14px; }

.progress-track {
  height: 9px; background: var(--ivory-2); border-radius: 999px; overflow: hidden; margin-bottom: 6px;
}
.progress-fill { height: 100%; background: linear-gradient(90deg, var(--marigold), var(--teal)); }
.progress-numbers { display: flex; justify-content: space-between; font-size: .82rem; font-weight: 600; margin-bottom: 14px; }
.progress-numbers .collected { color: var(--teal); }
.progress-numbers .target { color: #7A6E5F; font-weight: 400; }

.req-card .actions { display: flex; gap: 10px; }
.req-card .actions .btn { flex: 1; text-align: center; }

/* ---------------- Detail page ---------------- */
.detail-hero { display: grid; grid-template-columns: 1.1fr .9fr; gap: 34px; align-items: start; }
@media (max-width: 800px) { .detail-hero { grid-template-columns: 1fr; } }
.detail-gallery img { border-radius: var(--radius); margin-bottom: 10px; box-shadow: var(--shadow); }
.detail-gallery .gallery-strip { display: flex; gap: 8px; overflow-x: auto; }
.detail-gallery .gallery-strip img { width: 90px; height: 70px; object-fit: cover; margin: 0; flex-shrink: 0; cursor: pointer; }
.video-gallery { display: flex; flex-direction: column; gap: 12px; margin-top: 14px; }
.video-gallery video { width: 100%; border-radius: var(--radius); box-shadow: var(--shadow); background: #000; max-height: 420px; }

.fund-box {
  background: var(--white); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 22px; box-shadow: var(--shadow); position: sticky; top: 90px;
}
.fund-box h3 { font-size: 1rem; text-transform: uppercase; letter-spacing: .03em; color: #7A6E5F; margin-bottom: 14px; }
.fund-box .big-amount { font-family: var(--font-display); font-size: 2.1rem; color: var(--teal); }
.fund-box .of-target { color: #7A6E5F; margin-bottom: 14px; }
.fund-box .handed { background: var(--ivory-2); padding: 10px 14px; border-radius: 10px; font-size: .88rem; margin-top: 14px; }

.doc-list { list-style: none; padding: 0; margin: 10px 0 0; }
.doc-list li { margin-bottom: 6px; }
.doc-list a { font-size: .88rem; }

.contrib-table { width: 100%; border-collapse: collapse; margin-top: 10px; font-size: .9rem; }
.contrib-table th, .contrib-table td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.contrib-table th { color: #7A6E5F; font-weight: 600; font-size: .78rem; text-transform: uppercase; }

.description-block { margin-top: 26px; font-size: 1.02rem; white-space: pre-line; }
.description-parallel {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 28px;
  margin-top: 20px;
}
.description-parallel .description-block { margin-top: 10px; }
.description-col { border-left: 3px solid var(--marigold); padding-left: 16px; }
.description-col:last-child { border-left-color: var(--teal); }
.description-col-label {
  font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em;
  color: #7A6E5F; margin-top: 6px;
}

/* ---------------- Forms (admin) ---------------- */
.form-card { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 26px; box-shadow: var(--shadow); max-width: 640px; }
.form-group { margin-bottom: 18px; }
.form-group label { display: block; font-weight: 600; margin-bottom: 6px; font-size: .9rem; }
.form-group input[type=text], .form-group input[type=number], .form-group input[type=password],
.form-group input[type=tel], .form-group input[type=date], .form-group input[type=email],
.form-group input[type=url], .form-group textarea, .form-group select {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; font-family: var(--font-body); font-size: .95rem;
}
.form-group textarea { min-height: 140px; resize: vertical; }
.form-hint { font-size: .8rem; color: #7A6E5F; margin-top: 4px; }
.phone-input-group { display: flex; gap: 8px; }
.phone-input-group .country-code-select {
  flex: 0 0 190px; padding: 10px 6px; border: 1px solid var(--line); border-radius: 8px;
  font-family: var(--font-body); font-size: .9rem; background: var(--white);
  overflow: hidden; text-overflow: ellipsis;
}
.phone-input-group input[type=tel] { flex: 1; min-width: 0; }
.upload-tabs { display: flex; gap: 6px; margin-bottom: 12px; flex-wrap: wrap; }
.upload-tab {
  padding: 8px 16px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--white); font-weight: 600; font-size: .85rem; cursor: pointer;
  color: #7A6E5F;
}
.upload-tab.active { background: var(--teal); border-color: var(--teal); color: var(--white); }
.upload-tab-panel { background: var(--ivory-2); padding: 14px; border-radius: 10px; }

.recipient-list {
  max-height: 220px; overflow-y: auto; border: 1px solid var(--line); border-radius: 8px;
  padding: 6px; margin-top: 6px; background: var(--white);
}
.recipient-item { display: flex; align-items: center; gap: 8px; padding: 6px 8px; font-size: .88rem; }
.recipient-item:hover { background: var(--ivory-2); border-radius: 6px; }
.recipient-item input[type=checkbox] { width: auto; }
/* ---------------- Subscribe box (footer, all pages) ---------------- */
.subscribe-box { background: var(--ivory-2); padding: 30px 0; }
.subscribe-box h3 { font-size: 1.05rem; margin-bottom: 14px; color: var(--teal-dark); }
.subscribe-form { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.subscribe-form input { flex: 1; min-width: 160px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 8px; font-family: var(--font-body); }
.subscribe-box .alert { text-align: left; }

/* ---------------- Hero quick-nav (UI polish) ---------------- */
.hero-quicknav { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; margin-top: 22px; }
.hero-quicknav a {
  background: var(--white); border: 1px solid var(--line); border-radius: 999px;
  padding: 7px 16px; font-size: .82rem; font-weight: 600; color: var(--teal-dark);
}
.hero-quicknav a:hover { background: var(--teal); color: #fff; border-color: var(--teal); }

/* ---------------- How-it-works steps (UI polish) ---------------- */
.how-it-works { display: flex; flex-direction: column; gap: 16px; }
.how-step {
  display: flex; align-items: flex-start; gap: 16px;
  background: var(--ivory); border-radius: 12px; padding: 16px 18px;
}
.how-step-num {
  flex-shrink: 0; width: 34px; height: 34px; border-radius: 50%;
  background: var(--teal); color: #fff; font-family: var(--font-display); font-weight: 700;
  display: flex; align-items: center; justify-content: center; font-size: 1.05rem;
}
.how-step p { margin: 0; padding-top: 5px; text-align: left; }

/* ---------------- How-it-works paired with YouTube video (homepage) ---------------- */
.container-narrow-800 { max-width: 800px; }
.how-video-grid {
  display: grid; grid-template-columns: 2fr 3fr; gap: 36px; align-items: start;
}
.how-it-works-compact { gap: 10px; }
.how-it-works-compact .how-step { padding: 11px 13px; gap: 11px; }
.how-it-works-compact .how-step-num { width: 26px; height: 26px; font-size: .85rem; }
.how-it-works-compact .how-step p { font-size: .85rem; padding-top: 2px; }
.how-video-col-video .yt-player-wrap { max-width: 100%; }

/* ---------------- Language toggle bar ---------------- */
.lang-bar { background: var(--teal-dark); padding: 4px 0; }
.lang-link { color: rgba(255,255,255,.65); font-size: .78rem; font-weight: 600; padding: 3px 8px; border-radius: 6px; }
.lang-link:hover { color: #fff; }
.lang-link.lang-active { color: var(--marigold); background: rgba(255,255,255,.1); }

/* ---------------- Back to top button ---------------- */
.back-to-top {
  position: fixed; right: 20px; bottom: 24px; width: 46px; height: 46px;
  border-radius: 50%; background: var(--teal); color: #fff; border: none;
  font-size: 1.4rem; cursor: pointer; box-shadow: 0 4px 14px rgba(0,0,0,.25);
  opacity: 0; visibility: hidden; transform: translateY(10px);
  transition: opacity .25s ease, transform .25s ease, visibility .25s;
  z-index: 50;
}
.back-to-top.visible { opacity: 1; visibility: visible; transform: translateY(0); }
.back-to-top:hover { background: var(--teal-dark); }

/* ---------------- Floating Donate QR button + modal (all pages) ---------------- */
.donate-qr-fab {
  position: fixed; left: 16px; bottom: 24px; z-index: 50;
  display: flex; align-items: center; gap: 8px;
  background: #fff; border: 2px solid var(--marigold); border-radius: 999px;
  padding: 5px 14px 5px 5px; cursor: pointer; box-shadow: 0 4px 14px rgba(0,0,0,.2);
}
.donate-qr-fab img { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; }
.donate-qr-fab span { font-weight: 700; font-size: .85rem; color: var(--maroon); }
.donate-qr-fab:hover { background: var(--ivory-2); }

.donate-qr-modal {
  display: none; position: fixed; inset: 0; background: rgba(20,15,10,.6);
  z-index: 200; align-items: center; justify-content: center; padding: 20px;
}
.donate-qr-modal.open { display: flex; }
.donate-qr-modal-inner {
  background: #fff; border-radius: var(--radius); padding: 26px 28px 22px;
  max-width: 340px; width: 100%; text-align: center; position: relative;
  box-shadow: 0 10px 40px rgba(0,0,0,.3);
}
.donate-qr-modal-inner h3 { color: var(--teal-dark); font-size: 1.05rem; margin-bottom: 14px; }
.donate-qr-modal-inner img { width: 100%; max-width: 260px; border-radius: 10px; border: 1px solid var(--line); }
.donate-qr-modal-inner .form-hint { margin-top: 12px; }
.donate-qr-modal-close {
  position: absolute; top: 10px; right: 12px; background: none; border: none;
  font-size: 1.2rem; cursor: pointer; color: #7A6E5F;
}
.donate-qr-modal-close:hover { color: var(--maroon); }

/* ---------------- Hanging Subscribe tab (right side, vertically centered) ---------------- */
.subscribe-hang-tab {
  position: fixed; right: 0; top: 50%; transform: translateY(-50%);
  writing-mode: vertical-rl; text-orientation: mixed;
  background: var(--teal); color: #fff; border: none; border-radius: 8px 0 0 8px;
  padding: 16px 8px; font-weight: 700; font-size: .85rem; cursor: pointer;
  box-shadow: -2px 2px 10px rgba(0,0,0,.2); z-index: 49; white-space: nowrap;
  line-height: 1.4;
}
.subscribe-hang-tab:hover { background: var(--teal-dark); }
@media (max-width: 640px) {
  .subscribe-hang-tab { padding: 12px 6px; font-size: .75rem; }
}

/* ---------------- Twin section grid (how-it-works + success stories) ---------------- */
/* ---------------- Causes search box (homepage) ---------------- */
.causes-search-form {
  display: flex; gap: 8px; flex-wrap: wrap; justify-content: center;
  max-width: 520px; margin: 0 auto 18px;
}
.causes-search-form input[type=text] {
  flex: 1; min-width: 200px; padding: 10px 14px;
  border: 1px solid var(--line); border-radius: 8px; font-family: var(--font-body);
}

.twin-section-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 40px; align-items: start; }
.story-carousel-wide { max-width: 1080px; }
.story-track-wide .story-slide-wide { flex: 0 0 340px; }
.story-track-wide .story-slide-wide img { height: 280px; }
.story-track-wide .story-slide-wide video { height: 280px; width: 100%; object-fit: cover; background: #000; display: block; }


/* ---------------- Case ID share box (requirement detail page) ---------------- */
.case-id-box {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  background: var(--ivory-2); border-radius: 8px; padding: 8px 12px; margin: 10px 0 18px;
  font-size: .85rem; color: #574C40;
}
.case-id-box input {
  flex: 1; min-width: 160px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 6px;
  font-size: .8rem; background: var(--white); color: #574C40;
}


.form-row { display: flex; gap: 16px; }
.form-row .form-group { flex: 1; }

.alert { padding: 12px 16px; border-radius: 10px; margin-bottom: 18px; font-size: .92rem; }
.alert-success { background: #E6F3EE; color: var(--teal-dark); border: 1px solid #BFE0D2; }
.alert-error { background: #FBEAEA; color: var(--maroon); border: 1px solid #F0C7C7; }

/* ---------------- Admin layout ---------------- */
.admin-shell { display: flex; min-height: 100vh; }
.admin-sidebar { width: 220px; background: var(--teal-dark); color: var(--white); flex-shrink: 0; padding: 20px 0; }
.admin-sidebar .brand-mini { padding: 0 20px 20px; font-family: var(--font-display); font-size: 1.2rem; border-bottom: 1px solid rgba(255,255,255,.15); margin-bottom: 14px; }
.admin-sidebar a { display: block; color: rgba(255,255,255,.85); padding: 11px 20px; font-weight: 600; font-size: .92rem; }
.admin-sidebar a:hover, .admin-sidebar a.active { background: rgba(255,255,255,.1); color: var(--white); }
.admin-main { flex-grow: 1; padding: 30px 34px; background: var(--ivory); }
.admin-topbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; }

.data-table { width: 100%; border-collapse: collapse; background: var(--white); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.data-table th, .data-table td { padding: 12px 14px; border-bottom: 1px solid var(--line); text-align: left; font-size: .92rem; }
.data-table th { background: var(--ivory-2); font-size: .78rem; text-transform: uppercase; color: #7A6E5F; }
.pill { padding: 3px 10px; border-radius: 999px; font-size: .74rem; font-weight: 700; }
.pill-active { background: #E6F3EE; color: var(--teal-dark); }
.pill-completed { background: #FCEFDA; color: var(--marigold-dark); }
.pill-closed { background: #EEE; color: #888; }

/* ---------------- Footer ---------------- */
.site-footer { background: var(--teal-dark); color: rgba(255,255,255,.85); padding: 34px 0; margin-top: 50px; text-align: center; font-size: .88rem; }
.site-footer a { color: var(--marigold); }

/* ---------------- Footer credit ---------------- */
.footer-credit {
  text-align: center;
  padding: 14px 0 6px;
  font-size: .8rem;
  color: rgba(255,255,255,.6);
}
.footer-credit a { color: var(--marigold); font-weight: 600; }

/* ---------------- Logo ---------------- */
.brand .logo-img { width: 42px; height: 42px; border-radius: 50%; flex-shrink: 0; object-fit: cover; }
.admin-sidebar .logo-img { width: 40px; height: 40px; border-radius: 50%; margin-bottom: 8px; }
.login-logo { width: 76px; height: 76px; border-radius: 50%; display: block; margin: 0 auto 14px; }

/* ---------------- Blood request ticker (site-wide, admin-toggleable) ---------------- */
.blood-ticker {
  background: #7A2E2E;
  color: #fff;
  overflow: hidden;
  white-space: nowrap;
  padding: 6px 0;
  font-size: .85rem;
  font-weight: 600;
}
.blood-ticker-track {
  display: inline-block;
  padding-left: 100%;
  animation: blood-ticker-scroll 28s linear infinite;
}
.blood-ticker-item { display: inline-block; padding: 0 40px; }
.blood-ticker-item a { color: #FFD8D8; text-decoration: underline; }
@keyframes blood-ticker-scroll {
  0% { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}
@media (prefers-reduced-motion: reduce) {
  .blood-ticker-track { animation: none; padding-left: 20px; }
}

/* ---------------- Blood request cards (homepage) ---------------- */
.blood-card {
  background: var(--white);
  border: 2px solid #F0C7C7;
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}
.blood-card-group {
  display: inline-block;
  background: var(--maroon);
  color: #fff;
  font-weight: 700;
  font-size: 1.1rem;
  padding: 4px 14px;
  border-radius: 999px;
  margin-bottom: 10px;
}
.blood-card h3 { font-size: 1.05rem; margin-bottom: 6px; }
.blood-card p { margin: 4px 0; font-size: .92rem; }

/* ---------------- Success story carousel (homepage) ---------------- */
.story-carousel { display: flex; align-items: center; gap: 10px; max-width: 900px; margin: 0 auto; }
.story-track {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  flex: 1;
  padding-bottom: 4px; /* room for any scrollbar so it doesn't clip cards */
}
.story-track::-webkit-scrollbar { height: 6px; }
.story-track::-webkit-scrollbar-thumb { background: var(--line); border-radius: 999px; }
.story-slide {
  flex: 0 0 260px;
  scroll-snap-align: start;
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  display: block;
}
.story-slide img { width: 100%; height: 220px; object-fit: cover; }
.story-caption { padding: 12px 14px; }
.story-caption strong { display: block; color: var(--teal-dark); }
.story-caption span { font-size: .85rem; color: #7A6E5F; }
.story-caption .story-link-hint { font-size: .78rem; color: var(--teal); font-weight: 600; margin-top: 4px; display: block; }
.story-nav {
  flex-shrink: 0; width: 38px; height: 38px; border-radius: 50%;
  border: 1px solid var(--line); background: var(--white); font-size: 1.3rem;
  cursor: pointer; color: var(--teal);
}
.story-nav:hover { background: var(--teal); color: #fff; }

/* ---------------- YouTube player (homepage) ---------------- */
.yt-player-wrap { position: relative; max-width: 640px; margin: 0 auto 14px; }
.yt-player-frame {
  position: relative; width: 100%; padding-top: 56.25%; /* 16:9 */
  border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); background: #000;
}
.yt-player-frame iframe { position: absolute; top: 0; left: 0; width: 100%; height: 100%; border: 0; }
.yt-nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 40px; height: 40px; border-radius: 50%; border: none;
  background: rgba(0,0,0,.55); color: #fff; font-size: 1.4rem; cursor: pointer; z-index: 2;
}
.yt-nav:hover { background: rgba(0,0,0,.8); }
.yt-nav-prev { left: -6px; }
.yt-nav-next { right: -6px; }
.yt-title { font-weight: 600; color: var(--teal-dark); margin: 10px 0 14px; min-height: 1.4em; }


/* ---------------- Donor profile card (dashboard) ---------------- */
.profile-card {
  display: flex; gap: 20px; align-items: center; flex-wrap: wrap;
  background: var(--white); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px; box-shadow: var(--shadow); margin-bottom: 24px;
}
.profile-photo-wrap { flex-shrink: 0; }
.profile-photo { width: 90px; height: 90px; border-radius: 50%; object-fit: cover; border: 3px solid var(--ivory-2); }
.profile-photo-placeholder {
  display: flex; align-items: center; justify-content: center;
  background: var(--ivory-2); font-size: 2.2rem; color: #B5A88E;
}
.profile-info { flex: 1; min-width: 220px; }
.profile-upload-form input[type=file] { font-size: .85rem; }
.profile-share-box { margin-top: 14px; }
.profile-share-link { display: flex; gap: 8px; margin-top: 6px; }
.profile-share-link input {
  flex: 1; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px;
  font-size: .82rem; color: #574C40; background: var(--ivory-2);
}

/* ---------------- Public profile page ---------------- */
.public-profile-card {
  text-align: center; background: var(--white); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 36px 24px; max-width: 380px; margin: 0 auto;
}
.public-profile-photo {
  width: 140px; height: 140px; border-radius: 50%; object-fit: cover;
  border: 4px solid var(--marigold); margin: 0 auto 18px;
}
.public-profile-photo-placeholder {
  width: 140px; height: 140px; border-radius: 50%; margin: 0 auto 18px;
  display: flex; align-items: center; justify-content: center;
  background: var(--ivory-2); font-size: 3.5rem; color: #B5A88E;
}
.public-profile-badge {
  display: inline-block; margin-top: 10px; padding: 5px 16px; border-radius: 999px;
  background: #E6F3EE; color: var(--teal-dark); font-size: .8rem; font-weight: 700;
}


.accountability-banner {
  background: linear-gradient(90deg, var(--maroon), var(--teal-dark));
  color: var(--white);
  text-align: center;
  padding: 10px 16px;
  font-size: .88rem;
  font-weight: 600;
  letter-spacing: .01em;
}
.accountability-banner strong { color: var(--marigold); }

/* ---------------- Ticket UI ---------------- */
.ticket-box {
  background: var(--white);
  border: 2px dashed var(--marigold);
  border-radius: var(--radius);
  padding: 26px;
  text-align: center;
  max-width: 420px;
  margin: 0 auto 24px;
}
.ticket-box .ticket-number {
  font-family: var(--font-display);
  font-size: 2.6rem;
  letter-spacing: .12em;
  color: var(--maroon);
  font-weight: 700;
  margin: 8px 0;
}
.ticket-box .ticket-label { font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: #7A6E5F; }
.ticket-status-pill { display: inline-block; padding: 5px 16px; border-radius: 999px; font-weight: 700; font-size: .85rem; margin-top: 8px; }
.ticket-status-pending { background: #FCEFDA; color: var(--marigold-dark); }
.ticket-status-confirmed { background: #E6F3EE; color: var(--teal-dark); }
.ticket-status-cancelled { background: #EEE; color: #888; }

.lookup-form { display: flex; gap: 8px; max-width: 360px; margin: 0 auto 30px; }
.lookup-form input { flex-grow: 1; padding: 10px 14px; border: 1px solid var(--line); border-radius: 8px; font-family: var(--font-display); letter-spacing: .08em; text-transform: uppercase; text-align: center; }


/* ---------------- Table scroll wrapper (prevents horizontal page overflow on mobile) ---------------- */
.table-scroll { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: var(--radius); }
.table-scroll .data-table { min-width: 560px; }

/* ---------------- Prevent long titles/words from breaking layout ---------------- */
.req-card h3 a, .brand span, .hero h1 { overflow-wrap: break-word; word-break: break-word; }

@media (max-width: 900px) {
  /* Admin sidebar becomes a horizontally-scrollable top bar instead of a
     220px-wide column that crushes the main content on tablets/phones. */
  .admin-shell { flex-direction: column; min-height: auto; }
  .admin-sidebar {
    width: 100%; display: flex; align-items: center; gap: 4px;
    overflow-x: auto; -webkit-overflow-scrolling: touch;
    padding: 10px 12px; white-space: nowrap;
  }
  .admin-sidebar .brand-mini {
    display: flex; align-items: center; gap: 8px; flex-shrink: 0;
    border-bottom: none; margin-bottom: 0; padding: 0 12px 0 0;
    border-right: 1px solid rgba(255,255,255,.15); font-size: 1rem;
  }
  .admin-sidebar .brand-mini .logo-img { width: 30px; height: 30px; margin-bottom: 0; }
  .admin-sidebar .brand-mini small { display: none; }
  .admin-sidebar a { padding: 8px 12px; flex-shrink: 0; border-radius: 8px; }
  .admin-main { padding: 20px 16px; }
}

@media (max-width: 640px) {
  body { -webkit-text-size-adjust: 100%; }

  /* iOS Safari auto-zooms on any input with font-size under 16px — this was
     happening on every form on the site (donate, admin, login, contact). */
  .form-group input, .form-group textarea, .form-group select,
  .lookup-form input { font-size: 16px; }

  .phone-input-group { flex-direction: column; }
  .phone-input-group .country-code-select { flex-basis: auto; width: 100%; }

  .description-parallel { grid-template-columns: 1fr; gap: 20px; }
  .twin-section-grid { grid-template-columns: 1fr; gap: 30px; }
  .how-video-grid { grid-template-columns: 1fr; gap: 26px; }

  .story-slide { flex-basis: 78vw; }
  .story-nav { display: none; } /* swipe/scroll works natively on touch, buttons just add clutter */
  .yt-nav-prev { left: 6px; }
  .yt-nav-next { right: 6px; }

  .site-header .container { flex-wrap: wrap; row-gap: 10px; justify-content: center; text-align: center; }
  .brand { justify-content: center; }
  .brand small { font-size: .62rem; }
  .nav-links { justify-content: center; flex-wrap: wrap; row-gap: 8px; }

  .accountability-banner { font-size: .78rem; padding: 8px 12px; }

  .stats-bar { gap: 22px; }

  .form-row { flex-direction: column; gap: 0; }

  .card-grid { grid-template-columns: 1fr; }

  .ticket-box { padding: 20px 16px; }
  .ticket-box .ticket-number { font-size: 2rem; }

  /* A sticky fund box only makes sense in the two-column desktop layout;
     once detail-hero stacks to one column (≤800px) sticky positioning
     causes it to pin awkwardly mid-scroll on phones. */
  .fund-box { position: static; }

  .admin-main { padding: 16px 12px; }
  .form-card { padding: 18px; }

  .admin-topbar { flex-wrap: wrap; gap: 10px; }
  .admin-topbar h2 { font-size: 1.3rem; }
  .admin-topbar .btn { width: 100%; text-align: center; }

  .table-scroll { position: relative; }
  .table-scroll::after {
    content: '⇠ இழுத்து மேலும் காண ⇢';
    display: block; text-align: center; font-size: .72rem; color: #7A6E5F;
    padding: 6px 0 2px;
  }
}


@media (max-width: 400px) {
  .hero h1 { font-size: 1.6rem; }
  .stat .num { font-size: 1.5rem; }
  .btn { padding: 10px 16px; font-size: .88rem; }
}

/* ---------------- Visitor analytics bar chart (admin) ---------------- */
.visit-chart {
  display: flex; align-items: flex-end; gap: 4px; height: 220px;
  overflow-x: auto; padding-bottom: 4px;
}
.visit-bar-col {
  display: flex; flex-direction: column; align-items: center; justify-content: flex-end;
  flex: 1 0 28px; min-width: 28px; height: 100%;
}
.visit-bar {
  width: 100%; max-width: 26px; background: var(--teal); border-radius: 3px 3px 0 0;
  display: flex; align-items: flex-start; justify-content: center;
  position: relative; min-height: 2px; transition: background .15s;
}
.visit-bar:hover { background: var(--teal-dark); }
.visit-bar-value {
  position: absolute; top: -16px; font-size: .65rem; color: #574C40; white-space: nowrap;
}
.visit-bar-label {
  font-size: .62rem; color: #7A6E5F; margin-top: 4px; white-space: nowrap;
  writing-mode: vertical-rl; transform: rotate(180deg); max-height: 60px;
}

/* ---------------- Chat with Admin (donor + admin) ---------------- */
.chat-box { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.chat-thread { height: 380px; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; background: var(--ivory); }
.chat-bubble-row { display: flex; }
.chat-row-mine { justify-content: flex-end; }
.chat-row-theirs { justify-content: flex-start; }
.chat-bubble { max-width: 75%; padding: 9px 13px; border-radius: 14px; font-size: .88rem; line-height: 1.45; }
.chat-bubble-mine { background: var(--teal); color: #fff; border-bottom-right-radius: 3px; }
.chat-bubble-theirs { background: #fff; border: 1px solid var(--line); color: #2B2420; border-bottom-left-radius: 3px; }
.chat-sender-label { font-size: .7rem; font-weight: 700; opacity: .7; margin-bottom: 2px; }
.chat-message-text { white-space: pre-wrap; word-break: break-word; }
.chat-time { font-size: .65rem; opacity: .6; margin-top: 4px; text-align: right; }
.chat-input-row { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--line); }
.chat-input-row textarea {
  flex: 1; resize: none; padding: 9px 12px; border: 1px solid var(--line); border-radius: 10px;
  font-family: var(--font-body); font-size: .9rem;
}
.chat-attach-btn { display: flex; align-items: center; justify-content: center; cursor: pointer; font-size: 1.1rem; padding: 8px 12px; }
.chat-attachment { display: block; margin-top: 6px; }
.chat-attachment img { max-width: 180px; max-height: 180px; border-radius: 8px; display: block; }

/* ---------------- Account dropdown (header nav) ---------------- */
.account-dropdown { position: relative; display: inline-block; }
.account-dropdown-trigger {
  background: none; border: none; font: inherit; color: inherit; cursor: pointer;
  padding: 0; display: inline-flex; align-items: center; gap: 3px;
}
.account-dropdown-caret { font-size: .7em; }
.account-dropdown-menu {
  display: none; position: absolute; right: 0; top: calc(100% + 10px);
  background: #fff; border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,.15); min-width: 220px; z-index: 60; overflow: hidden;
}
.account-dropdown-menu.open { display: block; }
.account-dropdown-menu a {
  display: block; padding: 11px 16px; font-size: .88rem; color: #2B2420;
  border-bottom: 1px solid var(--line);
}
.account-dropdown-menu a:last-child { border-bottom: none; }
.account-dropdown-menu a:hover { background: var(--ivory); color: var(--teal); }

.admin-chat-grid { display: grid; grid-template-columns: 280px 1fr; gap: 18px; align-items: start; }
.admin-chat-list { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); max-height: 560px; overflow-y: auto; }
.admin-chat-list-item { display: block; padding: 12px 14px; border-bottom: 1px solid var(--line); color: #2B2420; }
.admin-chat-list-item:hover { background: var(--ivory); }
.admin-chat-list-item.active { background: var(--ivory-2); border-left: 3px solid var(--teal); }
.admin-chat-thread-wrap { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.admin-chat-header { padding: 12px 16px; border-bottom: 1px solid var(--line); font-size: .9rem; }
.admin-chat-thread { height: 440px; }
@media (max-width: 760px) {
  .admin-chat-grid { grid-template-columns: 1fr; }
  .admin-chat-list { max-height: 220px; }
}

/* ---------------- Donate page: multiple payment methods ---------------- */
.pay-method-block { margin-top: 16px; padding-top: 14px; border-top: 1px dashed var(--line); }
.pay-method-title { font-weight: 700; font-size: .92rem; color: var(--teal-dark); }
.pay-app-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.pay-app-grid .btn { text-align: center; }

