/* ============================================
   দিলশানা পারুল – ঢাকা-১৯ Voter Lookup
   Aesthetic: Campaign-rally boldness meets
   dignified institutional form.
   ============================================ */

/* ---------- reset & base ---------- */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --green-deep:   #022c2e;
  --green-main:   #044042;
  --green-mid:    #0a6a6d;
  --green-pale:   #e0f0f0;
  --red:          #e63946;
  --red-dark:     #b71c2c;
  --gold:         #d4a843;
  --white:        #ffffff;
  --off-white:    #f4f7f6;
  --text:         #1a1a1a;
  --text-muted:   #6b7c7d;
  --shadow:       0 4px 24px rgba(4,64,66,.18);
  --radius:       8px;
  --transition:   .25s cubic-bezier(.4,0,.2,1);
}

@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+Bengali:wght@400;500;600;700;800;900&family=Tiro+Bangla:ital@0;1&display=swap');

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

body {
  font-family: 'Noto Sans Bengali', 'Tiro Bangla', sans-serif;
  background: var(--off-white);
  color: var(--text);
  line-height: 1.6;
  overflow-x: hidden;
}

/* ---------- subtle texture overlay ---------- */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
  background: url("data:image/svg+xml,%3Csvg width='4' height='4' xmlns='http://www.w3.org/2000/svg'%3E%3Crect width='1' height='1' fill='%23000' opacity='.02'/%3E%3C/svg%3E");
}

/* ============================================
   HERO
   ============================================ */
.hero {
  position: relative;
  background: var(--green-deep);
  overflow: hidden;
}

/* halftone-dot decorative band at top */
.hero::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 6px;
  background: linear-gradient(90deg, var(--red) 0%, var(--red) 40%, var(--green-mid) 40%, var(--green-mid) 60%, var(--gold) 60%, var(--gold) 100%);
  z-index: 2;
}

.hero__inner {
  max-width: none;
  margin: 0 auto;
  position: relative;
}

.hero__img {
  display: block;
  width: 100%;
  max-width: 1400px;
  height: auto;
  margin: 0 auto;
}

/* floating constituency badge */
.hero__badge {
  position: absolute;
  top: 20px;
  right: 16px;
  background: rgba(4,64,66,.85);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 6px;
  padding: 8px 14px;
  color: var(--white);
  font-weight: 700;
  font-size: .85rem;
  letter-spacing: .03em;
  display: none;
  /* shown via JS or kept hidden if poster already has it */
}

/* ============================================
   NATIONAL RIBBON DIVIDER
   ============================================ */
.ribbon-divider {
  height: 8px;
  background: linear-gradient(
    to right,
    var(--green-mid) 0%,
    var(--green-mid) 33%,
    var(--red) 33%,
    var(--red) 66%,
    var(--green-mid) 66%,
    var(--green-mid) 100%
  );
}

/* ============================================
   SEARCH SECTION
   ============================================ */
.search-section {
  background:
    radial-gradient(ellipse at 20% 50%, rgba(10,106,109,.25) 0%, transparent 60%),
    var(--green-main);
  padding: 40px 16px 48px;
  position: relative;
}

/* decorative halftone dots */
.search-section::after {
  content: '';
  position: absolute;
  top: 0; right: 0;
  width: 260px;
  height: 260px;
  background: radial-gradient(circle 2px, rgba(255,255,255,.06) 50%, transparent 50%);
  background-size: 12px 12px;
  pointer-events: none;
  opacity: .6;
}

.search-section__inner {
  max-width: clamp(960px, 85vw, 1100px);
  margin: 0 auto;
  position: relative;
  z-index: 1;
}

.search-section__heading {
  color: var(--white);
  font-size: 1.25rem;
  font-weight: 700;
  text-align: center;
  margin-bottom: 28px;
  line-height: 1.5;
  text-shadow: 0 2px 8px rgba(0,0,0,.25);
}

/* ---------- form grid ---------- */
.form-grid {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

/* ---------- field group ---------- */
.field-group { display: flex; flex-direction: column; gap: 6px; }

.field-label {
  color: rgba(255,255,255,.82);
  font-size: .82rem;
  font-weight: 500;
}

.field-input,
.field-select {
  width: 100%;
  padding: 12px 14px;
  border: 2px solid rgba(255,255,255,.15);
  border-radius: var(--radius);
  background: rgba(255,255,255,.08);
  color: var(--white);
  font-family: inherit;
  font-size: .95rem;
  transition: border-color var(--transition), background var(--transition), box-shadow var(--transition);
  outline: none;
  appearance: none;
  -webkit-appearance: none;
}

.field-input::placeholder { color: rgba(255,255,255,.4); }

.field-input:focus,
.field-select:focus {
  border-color: var(--gold);
  background: rgba(255,255,255,.12);
  box-shadow: 0 0 0 3px rgba(212,168,67,.2);
}

/* custom dropdown arrow */
.select-wrap {
  position: relative;
}
.select-wrap::after {
  content: '';
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 0; height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 6px solid rgba(255,255,255,.5);
  pointer-events: none;
}

.field-select option {
  background: var(--green-deep);
  color: var(--white);
}

.field-select:disabled {
  opacity: .45;
  cursor: not-allowed;
}

.field-hint {
  color: rgba(255,255,255,.5);
  font-size: .72rem;
  margin-top: 2px;
}

/* ---------- button row ---------- */
.btn-row {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 24px;
  flex-wrap: wrap;
}

.btn {
  padding: 12px 32px;
  border: none;
  border-radius: var(--radius);
  font-family: inherit;
  font-size: .95rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition), background var(--transition);
  letter-spacing: .02em;
}
.btn:active { transform: scale(.97); }

.btn--reset {
  background: rgba(255,255,255,.12);
  color: var(--white);
  border: 1.5px solid rgba(255,255,255,.2);
}
.btn--reset:hover {
  background: rgba(255,255,255,.2);
}

.btn--search {
  background: var(--red);
  color: var(--white);
  box-shadow: 0 4px 16px rgba(230,57,70,.35);
}
.btn--search:hover {
  background: var(--red-dark);
  box-shadow: 0 6px 22px rgba(230,57,70,.45);
}
.btn--search:disabled {
  opacity: .6;
  cursor: not-allowed;
}

/* ============================================
   RESULTS
   ============================================ */
.results-section {
  max-width: clamp(960px, 85vw, 1100px);
  margin: 0 auto;
  padding: 32px 16px 48px;
  min-height: 120px;
}

/* --- loading spinner --- */
.loader {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 40px 0;
}
.loader.is-visible { display: flex; }

.loader__spinner {
  width: 40px;
  height: 40px;
  border: 4px solid var(--green-pale);
  border-top-color: var(--green-main);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.loader__text {
  color: var(--text-muted);
  font-size: .9rem;
}

/* --- empty / error states --- */
.msg-box {
  display: none;
  text-align: center;
  padding: 32px 16px;
  border-radius: var(--radius);
  font-size: .95rem;
  line-height: 1.6;
}
.msg-box.is-visible { display: block; }

.msg-box--empty {
  background: var(--green-pale);
  color: var(--green-main);
}
.msg-box--error {
  background: #fdeaea;
  color: var(--red-dark);
}

.msg-box__icon {
  font-size: 2rem;
  margin-bottom: 8px;
}

/* --- results count --- */
.results-count {
  display: none;
  font-size: .85rem;
  color: var(--text-muted);
  margin-bottom: 12px;
  padding: 0 2px;
}
.results-count.is-visible { display: block; }

/* --- data table --- */
.table-wrap {
  display: none;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  background: var(--white);
}
.table-wrap.is-visible { display: block; }

.voter-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .88rem;
  white-space: nowrap;
}

.voter-table thead {
  background: var(--green-main);
  color: var(--white);
  position: sticky;
  top: 0;
  z-index: 1;
}

.voter-table th {
  padding: 14px 16px;
  font-weight: 600;
  text-align: left;
  font-size: .8rem;
  letter-spacing: .02em;
  border-bottom: 3px solid var(--gold);
}

.voter-table td {
  padding: 12px 16px;
  border-bottom: 1px solid #e8eded;
  color: var(--text);
  word-break: break-word;
}

.voter-table tbody tr {
  transition: background var(--transition);
}
.voter-table tbody tr:hover {
  background: var(--green-pale);
}
.voter-table tbody tr:nth-child(even) {
  background: #f8fbfb;
}
.voter-table tbody tr:nth-child(even):hover {
  background: var(--green-pale);
}

/* serial number column highlight */
.voter-table td:first-child {
  font-weight: 600;
  color: var(--green-main);
}

/* ============================================
   VOTER INFO CARD
   ============================================ */
.voter-card {
  display: none;
  width: 400px;
  max-width: 100%;
  margin: 24px auto;
  border: 3px solid var(--green-main);
  border-radius: var(--radius);
  overflow: hidden;
  font-family: 'Noto Sans Bengali', 'Tiro Bangla', sans-serif;
  background: var(--white);
}
.voter-card.is-visible { display: block; }

.voter-card__header {
  display: flex;
  background: var(--green-main);
  color: var(--white);
  align-items: center;
  height: 180px;
  overflow: hidden;
}

.voter-card__date {
  font-size: 2.2rem;
  font-weight: 900;
  padding: 12px;
  text-align: center;
  flex-shrink: 0;
  line-height: 1.1;
}
.voter-card__date span {
  font-size: .75rem;
  font-weight: 700;
  display: block;
  margin-top: 4px;
  line-height: 1.3;
}

.voter-card__photo {
  flex: 1;
  height: 180px;
  object-fit: cover;
  object-position: 30% 15%;
  min-width: 0;
}

.voter-card__symbol {
  font-size: 1.1rem;
  font-weight: 800;
  padding: 12px;
  text-align: center;
  flex-shrink: 0;
  line-height: 1.3;
  color: var(--gold);
}

.voter-card__slogan {
  text-align: center;
  font-weight: 700;
  font-size: .95rem;
  padding: 14px 12px;
  border: 2px solid var(--green-main);
  margin: 8px;
  line-height: 1.6;
  border-radius: 4px;
  color: var(--green-deep);
}

.voter-card__center {
  background: var(--green-main);
  color: var(--white);
  padding: 10px 16px;
  font-weight: 700;
  font-size: .95rem;
  text-align: center;
}

.voter-card__details {
  padding: 14px 20px;
  background: var(--white);
  line-height: 1.8;
  font-size: .9rem;
}
.voter-card__details p {
  margin: 3px 0;
  color: var(--text);
}
.voter-card__details strong {
  color: var(--green-deep);
}

.voter-card__footer {
  background: var(--green-main);
  color: rgba(255,255,255,.7);
  text-align: center;
  padding: 8px;
  font-size: .75rem;
}

/* card container + wrapper */
.card-container {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 32px;
  padding: 24px 0;
}
.card-container.is-visible { display: flex; }

.card-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

/* share button */
.btn--share {
  padding: 12px 32px;
  background: var(--green-main);
  color: var(--white);
  border: none;
  border-radius: var(--radius);
  font-family: inherit;
  font-size: .95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition), transform var(--transition);
  display: flex;
  align-items: center;
  gap: 8px;
}
.btn--share:hover {
  background: var(--green-mid);
}
.btn--share:active {
  transform: scale(.97);
}
.btn--share:disabled {
  opacity: .6;
  cursor: not-allowed;
}

/* ============================================
   FOOTER
   ============================================ */
.site-footer {
  background: var(--green-deep);
  color: rgba(255,255,255,.55);
  text-align: center;
  padding: 20px 16px;
  font-size: .78rem;
}
.site-footer a {
  color: var(--gold);
  text-decoration: none;
  font-weight: 500;
  transition: color var(--transition);
}
.site-footer a:hover { color: var(--white); }

/* ============================================
   ANIMATIONS
   ============================================ */
@keyframes fade-up {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}

.search-section__heading,
.form-grid,
.btn-row {
  animation: fade-up .55s ease-out both;
}
.form-grid      { animation-delay: .1s; }
.btn-row        { animation-delay: .2s; }

/* table row entrance */
.voter-table tbody tr {
  animation: fade-up .35s ease-out both;
}

/* ============================================
   UTILITIES
   ============================================ */
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  border: 0;
}

/* ============================================
   RESPONSIVE POLISH
   ============================================ */
@media (max-width: 599px) {
  .search-section { padding: 28px 14px 36px; }
  .search-section__heading { font-size: 1.05rem; }
  .btn-row { justify-content: stretch; }
  .btn { flex: 1; text-align: center; }
  .voter-table { font-size: .8rem; }
  .voter-table th,
  .voter-table td { padding: 10px 12px; }
}

@media (min-width: 600px) {
  .search-section__heading { font-size: 1.15rem; }
}

@media (min-width: 900px) {
  .search-section__heading { font-size: 1.35rem; margin-bottom: 32px; }
}

/* ============================================
   CALENDAR DATE PICKER
   ============================================ */

/* DOB input wrapper */
.dob-input-wrap {
  position: relative;
  display: flex;
  align-items: stretch;
}
.dob-input-wrap .field-input {
  flex: 1;
  padding-right: 44px;
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}
.dob-cal-btn {
  width: 44px;
  border: 2px solid rgba(255,255,255,.15);
  border-left: none;
  border-radius: 0 var(--radius) var(--radius) 0;
  background: rgba(255,255,255,.08);
  color: var(--gold);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition);
}
.dob-cal-btn:hover { background: rgba(255,255,255,.16); }

/* overlay */
.cal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 10000;
  justify-content: center;
  align-items: center;
}
.cal-overlay.is-open { display: flex; }

/* modal */
.cal-modal {
  background: var(--green-deep);
  border-radius: 12px;
  width: 320px;
  max-width: 95vw;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 8px 40px rgba(0,0,0,.4);
  color: var(--white);
  font-family: inherit;
}

/* header */
.cal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 12px 10px;
  border-bottom: 1px solid rgba(255,255,255,.1);
}
.cal-nav-btn {
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background: rgba(255,255,255,.1);
  color: var(--white);
  font-size: 1.3rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition);
}
.cal-nav-btn:hover { background: rgba(255,255,255,.2); }

.cal-title-btn {
  border: none;
  background: none;
  color: var(--gold);
  font-family: inherit;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  padding: 4px 12px;
  border-radius: 4px;
  transition: background var(--transition);
}
.cal-title-btn:hover { background: rgba(255,255,255,.08); }

/* weekday row */
.cal-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  padding: 10px 8px 6px;
  font-size: .72rem;
  color: rgba(255,255,255,.5);
  font-weight: 600;
}

/* day grid */
.cal-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  padding: 0 8px 8px;
}
.cal-day {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 50%;
  background: none;
  color: var(--white);
  font-family: inherit;
  font-size: .88rem;
  cursor: pointer;
  transition: background var(--transition);
}
.cal-day:hover { background: rgba(255,255,255,.15); }
.cal-day--empty { cursor: default; pointer-events: none; }
.cal-day--today { border: 1.5px solid var(--gold); }
.cal-day--selected {
  background: var(--gold);
  color: var(--green-deep);
  font-weight: 700;
}

/* year grid */
.cal-year-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  padding: 12px;
  max-height: 300px;
  overflow-y: auto;
}
.cal-year-btn {
  padding: 8px 4px;
  border: none;
  border-radius: 6px;
  background: rgba(255,255,255,.06);
  color: var(--white);
  font-family: inherit;
  font-size: .85rem;
  cursor: pointer;
  transition: background var(--transition);
}
.cal-year-btn:hover { background: rgba(255,255,255,.15); }
.cal-year-btn--selected {
  background: var(--gold);
  color: var(--green-deep);
  font-weight: 700;
}

/* month grid */
.cal-month-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 12px;
}
.cal-month-btn {
  padding: 10px 4px;
  border: none;
  border-radius: 6px;
  background: rgba(255,255,255,.06);
  color: var(--white);
  font-family: inherit;
  font-size: .88rem;
  cursor: pointer;
  transition: background var(--transition);
}
.cal-month-btn:hover { background: rgba(255,255,255,.15); }
.cal-month-btn--selected {
  background: var(--gold);
  color: var(--green-deep);
  font-weight: 700;
}

/* footer */
.cal-footer {
  padding: 8px 12px 14px;
  display: flex;
  justify-content: center;
}
.cal-cancel-btn {
  padding: 8px 28px;
  border: 1.5px solid rgba(255,255,255,.2);
  border-radius: var(--radius);
  background: none;
  color: var(--white);
  font-family: inherit;
  font-size: .88rem;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition);
}
.cal-cancel-btn:hover { background: rgba(255,255,255,.1); }

/* mobile bottom sheet */
@media (max-width: 599px) {
  .cal-overlay { align-items: flex-end; }
  .cal-modal {
    width: 100%;
    max-width: 100%;
    border-radius: 16px 16px 0 0;
    max-height: 70vh;
  }
}

/* ============================================
   PRINT
   ============================================ */
@media print {
  .hero, .search-section, .site-footer { display: none; }
  .results-section { padding: 0; }
  .table-wrap { box-shadow: none; }
  .voter-table th { background: #ddd; color: #000; -webkit-print-color-adjust: exact; }
}
