:root {
  --primary: #1f6f4a;
  --accent: #f4b400;
  --bg: #f7f9f4;
  --text: #1f2933;
  --white: #ffffff;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: "Noto Sans Devanagari", "Segoe UI", Tahoma, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
}
main, .page-shell { flex: 1; }
a { color: inherit; text-decoration: none; }
.hero {
  background: linear-gradient(135deg, var(--primary), #2f855a);
  color: var(--white);
  padding: 20px 24px 60px;
}
.top-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  max-width: 1100px;
  margin: 0 auto;
  row-gap: 8px;
}
.brand { font-size: 1.25rem; font-weight: 700; order: 1; }
.nav-links { display: flex; gap: 16px; flex-wrap: wrap; align-items: center; order: 4; }
.nav-links a { opacity: 0.95; transition: opacity 0.15s; }
.nav-links a:hover { opacity: 1; }
.nav-links a.active-nav { border-bottom: 2px solid var(--accent); padding-bottom: 2px; }
.hamburger {
  display: none;
  order: 2;
  margin-left: auto;
  background: none;
  border: none;
  color: var(--white);
  font-size: 1.7rem;
  cursor: pointer;
  padding: 4px 6px;
  line-height: 1;
  border-radius: 6px;
}
.hamburger:hover { background: rgba(255,255,255,0.12); }
.nav-tagline { display: none; order: 3; width: 100%; }
.hero-content { max-width: 900px; margin: 40px auto 0; text-align: center; }
.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.14em;
  opacity: 0.9;
  font-size: 0.86rem;
  margin-bottom: 8px;
}
h1 { font-size: clamp(1.8rem, 3vw, 2.8rem); margin: 0 0 12px; }
.hero-title { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.hero-logo { height: clamp(90px, 9vw, 130px); width: auto; flex-shrink: 0; }
.hero-title span { max-width: 720px; display: inline-block; }
.hero-text { font-size: 1.05rem; max-width: 700px; margin-left: auto; margin-right: auto; }
.cta {
  display: inline-block;
  margin-top: 16px;
  background: var(--accent);
  color: var(--white);
  padding: 10px 16px;
  border-radius: 999px;
  font-weight: 700;
}
.lang-toggle {
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.35);
  background: rgba(255,255,255,0.16);
  color: var(--white);
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  line-height: 1;
}
.hero-details {
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid rgba(255,255,255,0.28);
  max-width: 700px;
  margin-left: auto;
  margin-right: auto;
}
.hero-details p { margin: 6px 0; font-size: 0.98rem; }
section { padding: 48px 24px; max-width: 1100px; margin: 0 auto; }
.section-title { font-size: 1.5rem; margin: 0 0 16px; color: var(--primary); }
.grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 20px; }
.grid article { background: var(--white); border-radius: 16px; padding: 20px; box-shadow: 0 8px 24px rgba(0,0,0,0.06); }
.about-card { background: var(--white); border-radius: 16px; padding: 24px; box-shadow: 0 8px 24px rgba(0,0,0,0.06); margin-top: 20px; }
.about-grid { margin-top: 20px; }
.objective-list { padding-left: 20px; margin: 0; }
.objective-list li { margin-bottom: 8px; }
.values-list { display: flex; flex-wrap: wrap; gap: 10px; }
.values-list span { background: #e7f6ed; color: var(--primary); padding: 8px 12px; border-radius: 999px; font-weight: 600; }
.bearer-grid { display: flex; flex-wrap: wrap; justify-content: center; gap: 20px; }
.bearer-grid .bearer-card { flex: 0 0 220px; }
.bearer-card { background: var(--white); border-radius: 16px; padding: 18px; box-shadow: 0 8px 24px rgba(0,0,0,0.06); text-align: center; }
.bearer-photo { width: 110px; height: 110px; object-fit: cover; border-radius: 50%; margin: 0 auto 12px; border: 3px solid var(--accent); background: #e7f6ed; }
.bearer-name { font-size: 1rem; font-weight: 700; margin: 0 0 6px; color: var(--primary); }
.bearer-role { font-size: 0.95rem; color: #4a5568; margin: 0; }
form { display: grid; gap: 12px; }
input, textarea, button { font: inherit; padding: 12px 14px; border-radius: 10px; border: 1px solid #d7e1d8; }
textarea { min-height: 110px; resize: vertical; }
button { background: var(--primary); color: white; border: none; cursor: pointer; font-weight: 600; }
button:hover { background: #18563b; }
.event-list { display: grid; gap: 20px; }
.event-item { background: var(--white); border-radius: 16px; overflow: hidden; box-shadow: 0 8px 24px rgba(0,0,0,0.06); }
.event-item { position: relative; }
.event-item img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; display: block; }
.event-img-fallback { width: 100%; aspect-ratio: 4 / 3; display: flex; align-items: center; justify-content: center; background: #e7f6ed; color: var(--primary); font-size: 0.9rem; font-weight: 600; }
.event-body { padding: 18px; }
.event-date-badge {
  position: absolute; top: 12px; right: 12px;
  background: var(--accent); color: #1f2933;
  padding: 6px 14px; border-radius: 999px;
  font-weight: 700; font-size: 0.85rem;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.meta { color: #5c6b68; font-size: 0.92rem; margin-bottom: 8px; }
.status { margin-top: 12px; color: var(--primary); font-weight: 600; }
.status.error { color: #c53030; }
.empty-state { text-align: center; padding: 40px 0; color: #889988; font-size: 1rem; }
.location-section {
  width: 100%; max-width: none; margin: 0;
  padding: 48px 0 0; background: transparent;
}
.location-copy {
  text-align: center; margin-bottom: 20px; color: #4a5568;
  max-width: 760px; margin-left: auto; margin-right: auto; padding: 0 24px;
}
.location-section .section-title { text-align: center; }
#office-bearers .section-title { text-align: center; }
.map-card { width: 100%; border-radius: 0; overflow: hidden; border: 0; box-shadow: none; }
.map-card iframe { width: 100%; min-height: 450px; border: 0; display: block; }
.site-footer {
  width: 100%; margin: 0; padding: 20px 24px;
  background: #e7f6ed; color: var(--primary); text-align: center;
  font-size: 0.9rem; border: 1px solid #d8e9dc;
  border-left: 0; border-right: 0; box-shadow: none; box-sizing: border-box;
}
.site-footer p { margin: 6px 0; }

/* Admin */
.admin-page {
  max-width: 900px; margin: 0 auto; padding: 0 24px;
  display: flex; align-items: flex-start; justify-content: center;
  min-height: 100vh; width: 100%;
}
.admin-page > .admin-card { margin-top: 40px; margin-bottom: 40px; }
.admin-card {
  background: var(--white); border-radius: 16px;
  padding: 32px; box-shadow: 0 8px 24px rgba(0,0,0,0.06);
  width: 100%; max-width: 800px; margin: 40px 0;
  overflow: hidden;
}
.admin-card input, .admin-card textarea, .admin-card select, .admin-card button { max-width: 100%; }
.admin-header { display: flex; justify-content: space-between; align-items: center; margin: 0 0 20px; }
.admin-header h2 { margin: 0; color: var(--primary); }
.secondary-btn { background: #e7f6ed !important; color: var(--primary) !important; border: 1px solid #c7dbcb !important; }
.admin-events-list { margin-top: 24px; }
.admin-event-card {
  display: grid; grid-template-columns: 160px 1fr;
  background: var(--white); border-radius: 12px; overflow: hidden;
  margin-bottom: 14px; box-shadow: 0 1px 6px rgba(0,0,0,0.06);
  transition: transform 0.15s, box-shadow 0.15s; cursor: default;
}
.admin-event-card.dragging { opacity: 0.5; transform: scale(0.98); }
.admin-event-card.drag-over { box-shadow: 0 0 0 2px var(--accent); }
.drag-handle {
  position: absolute; top: 50%; right: 8px; transform: translateY(-50%);
  cursor: grab; color: #c0c8c0; font-size: 1.1rem; padding: 4px; line-height: 1;
  user-select: none; opacity: 0; transition: opacity 0.15s;
}
.admin-event-card:hover .drag-handle { opacity: 1; }
.drag-handle:active { cursor: grabbing; }
.admin-event-card img { width: 160px; height: 100%; object-fit: cover; grid-row: 1/-1; }
.admin-event-card .no-img {
  width: 160px; grid-row: 1/-1; display: flex; align-items: center; justify-content: center;
  background: #e7f6ed; font-size: 0.8rem; color: var(--primary);
}
.admin-event-card .card-content { padding: 14px 16px; display: flex; flex-direction: column; min-width: 0; position: relative; }
.admin-event-card h3 { margin: 0 0 6px; font-size: 0.98rem; line-height: 1.3; }
.admin-event-card .admin-event-desc {
  font-size: 0.84rem; color: #4a5568; line-height: 1.5; flex: 1;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
  margin: 0 0 10px;
}
.admin-event-card .card-footer {
  display: flex; justify-content: space-between; align-items: center;
  padding-top: 10px; border-top: 1px solid #f0f2ef; gap: 8px; flex-wrap: nowrap;
}
.admin-event-card .admin-event-date {
  font-size: 0.78rem; color: var(--primary); font-weight: 600;
  background: #e7f6ed; padding: 3px 10px; border-radius: 999px; white-space: nowrap;
}
.admin-actions { display: flex; gap: 10px; align-items: center; flex-shrink: 0; }
.admin-actions .reorder-group { display: flex; gap: 2px; margin-right: 6px; }
.admin-actions .reorder-group button {
  padding: 2px 6px; font-size: 0.7rem; border: none; background: none; color: #889988; cursor: pointer;
}
.admin-actions .reorder-group button:hover { color: var(--primary); }
.admin-actions [data-action="edit"],
.admin-actions [data-action="delete"] {
  padding: 0; font-size: 0.78rem; cursor: pointer; font-weight: 500; background: none; border: none;
  text-decoration: underline; text-underline-offset: 3px;
}
.admin-actions [data-action="edit"] { color: var(--primary); }
.admin-actions [data-action="delete"] { color: #c53030; }
.admin-tabs { display: flex; gap: 0; margin-bottom: 20px; border-bottom: 2px solid #d7e1d8; }
.admin-tab {
  padding: 10px 24px; border: none; border-radius: 10px 10px 0 0;
  background: transparent; color: #4a5568; font-weight: 600; font-size: 0.95rem;
  cursor: pointer; border-bottom: 3px solid transparent;
  margin-bottom: -2px; transition: color 0.15s ease, border-color 0.15s ease;
}
.admin-tab:hover { color: var(--white); background: var(--primary); }
.admin-tab.active { color: var(--primary); border-bottom-color: var(--primary); background: transparent; }
.admin-tab.active:hover { color: var(--white); background: var(--primary); }
.admin-tab-content { padding-top: 4px; }
.form-row { display: flex; gap: 12px; }
.form-row > * { flex: 1; }
.member-form { background: #f7f9f4; border-radius: 12px; padding: 20px; margin-bottom: 20px; }
.member-form h3 { margin: 0 0 16px; color: var(--primary); }
.member-form-actions { display: flex; gap: 10px; }
.member-card { display: flex; gap: 16px; align-items: center; background: #f7f9f4; border-radius: 12px; padding: 14px; margin-bottom: 12px; }
.member-card img { width: 60px; height: 60px; object-fit: cover; border-radius: 50%; flex-shrink: 0; border: 2px solid var(--accent); background: #e7f6ed; }
.member-card-info { flex: 1; }
.member-card-info h4 { margin: 0 0 2px; font-size: 1rem; }
.member-card-info p { margin: 0; color: #4a5568; font-size: 0.9rem; }
.member-card-info .member-en { font-size: 0.82rem; color: #889988; }
.member-card-actions { display: flex; gap: 6px; }
.member-card-actions button { padding: 4px 12px; font-size: 0.82rem; border-radius: 6px; }

.back-to-top {
  position: fixed; bottom: 24px; right: 24px; z-index: 999;
  width: 44px; height: 44px; border-radius: 50%;
  background: var(--primary); color: var(--white);
  border: none; cursor: pointer; font-size: 1.3rem;
  box-shadow: 0 4px 16px rgba(0,0,0,0.2);
  opacity: 0; transform: translateY(20px);
  pointer-events: none; transition: opacity 0.25s, transform 0.25s;
}
.back-to-top.visible { opacity: 1; transform: translateY(0); pointer-events: auto; }
.back-to-top:hover { background: #18563b; }

.spinner {
  display: none; width: 36px; height: 36px;
  border: 3px solid #d7e1d8; border-top-color: var(--primary);
  border-radius: 50%; animation: spin 0.7s linear infinite;
  margin: 32px auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Question Paper Table */
.question-paper-table-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: 16px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.06);
  background: var(--white);
}
.qp-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
  background: var(--white);
}
.qp-table thead th {
  background: var(--primary);
  color: var(--white);
  padding: 14px 16px;
  text-align: left;
  font-weight: 700;
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 2;
}
.qp-table thead th.text-center { text-align: center; }
.qp-table tbody td {
  padding: 12px 16px;
  border-bottom: 1px solid #e8ede5;
  vertical-align: middle;
}
.qp-table tbody td.text-center { text-align: center; }
.qp-table tbody td.qp-year {
  font-weight: 700;
  color: var(--primary);
  background: #f7f9f4;
  white-space: nowrap;
}
.qp-table tbody tr:hover td {
  background: #f0f7f1;
}
.qp-table tbody tr:hover td.qp-year {
  background: #e7f0e8;
}
.qp-table .link-color {
  color: var(--primary);
  text-decoration: underline;
  text-underline-offset: 3px;
  font-weight: 600;
  white-space: nowrap;
}
.qp-table .link-color:hover {
  color: #18563b;
}

@media (max-width: 760px) {
  .qp-table {
    font-size: 0.82rem;
  }
  .qp-table thead th,
  .qp-table tbody td {
    padding: 10px 10px;
  }
  .qp-table tbody td.qp-year {
    white-space: normal;
    min-width: 100px;
    font-size: 0.8rem;
  }
}

/* Admin Question Papers */
.qp-admin-header {
  margin-bottom: 16px;
}
.qp-admin-header h3 {
  color: var(--primary);
  margin: 0;
}
.qp-admin-add-year {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
}
.qp-admin-add-year input {
  flex: 1;
}
.qp-admin-add-year button {
  white-space: nowrap;
}
.qp-admin-year {
  background: var(--white);
  border-radius: 12px;
  margin-bottom: 12px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}
.qp-year-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: #f7f9f4;
  border-bottom: 1px solid #e8ede5;
  flex-wrap: wrap;
  gap: 8px;
}
.qp-year-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}
.qp-year-actions button {
  padding: 4px 12px;
  font-size: 0.8rem;
  border-radius: 6px;
  background: var(--primary);
  color: var(--white);
  border: none;
  cursor: pointer;
}
.qp-year-actions button:hover {
  background: #18563b;
}
.qp-admin-subjects {
  padding: 8px 0;
}
.qp-admin-subject {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  border-bottom: 1px solid #f0f2ef;
  flex-wrap: wrap;
}
.qp-admin-subject:last-child {
  border-bottom: none;
}
.qp-subj-name {
  flex: 1;
  font-size: 0.9rem;
  min-width: 150px;
}
.qp-subj-pdf {
  flex-shrink: 0;
}
.qp-subj-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}
.qp-subj-actions button {
  padding: 3px 10px;
  font-size: 0.75rem;
  border-radius: 4px;
  background: #e7f6ed;
  color: var(--primary);
  border: 1px solid #c7dbcb;
  cursor: pointer;
}
.qp-subj-actions button:hover {
  background: var(--primary);
  color: var(--white);
}

@media (max-width: 760px) {
  .qp-admin-add-year {
    flex-direction: column;
  }
  .qp-year-header {
    flex-direction: column;
    align-items: flex-start;
  }
  .qp-admin-subject {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }
  .qp-subj-name {
    min-width: auto;
    width: 100%;
  }
}

@media (max-width: 760px) {
  body { overflow-x: hidden; }
  .hero { padding: 16px 18px 44px; }
  .hero-content, .grid { grid-template-columns: 1fr; }
  section { padding: 36px 18px; }

  .top-nav { row-gap: 4px; }
  .hamburger { display: block; }
  .nav-tagline { display: block; text-align: center; font-size: 0.68rem; opacity: 0.9; }
  .eyebrow { display: none; }

  .nav-links {
    display: none;
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    gap: 4px;
    margin-top: 10px;
    padding: 10px;
    background: rgba(0,0,0,0.14);
    border-radius: 12px;
  }
  .nav-links.open { display: flex; }
  .nav-links a,
  .nav-links .lang-toggle { width: 100%; }
  .nav-links a {
    padding: 10px 12px;
    border-radius: 8px;
  }
  .nav-links a:active,
  .nav-links a.active-nav { background: rgba(255,255,255,0.12); }
  .nav-links a.active-nav { border-bottom: none; }
  .nav-links .lang-toggle { text-align: center; }

  .hero-logo { height: 110px; }
  h1 { font-size: 1.3rem; }
  .hero-details p { text-align: center; }

  .cta {
    display: block;
    width: 100%;
    text-align: center;
  }

  .grid { gap: 14px; }
  .about-card { padding: 18px; }
  .bearer-grid { gap: 14px; }
  .bearer-grid .bearer-card { flex: 1 1 140px; max-width: 160px; }

  .map-card iframe { min-height: 300px; }

  .admin-page { padding: 0 16px; }
  .admin-card { padding: 20px; }
  .admin-header { flex-wrap: wrap; gap: 10px; }
  .admin-tabs { overflow-x: auto; -webkit-overflow-scrolling: touch; flex-wrap: nowrap; }
  .admin-tab { padding: 10px 16px; white-space: nowrap; }
  .form-row { flex-direction: column; }
  .admin-card input, .admin-card textarea, .admin-card select { width: 100%; }

  .admin-event-card { grid-template-columns: 1fr; }
  .admin-event-card img { width: 100%; height: auto; aspect-ratio: 4/3; grid-row: auto; }
  .admin-event-card .no-img { width: 100%; height: 120px; grid-row: auto; }
  .card-footer { flex-wrap: wrap; gap: 8px; }
  .card-footer .admin-event-date { font-size: 0.7rem; padding: 2px 8px; }
  .admin-actions { flex-wrap: wrap; width: 100%; justify-content: flex-start; }
  .drag-handle { display: none; }

  .member-card { flex-wrap: wrap; }
  .member-card-actions { width: 100%; justify-content: flex-end; }
}

@media (max-width: 420px) {
  .bearer-grid .bearer-card { flex: 1 1 100%; max-width: 220px; }
}
