/* SFUP — Shikana Frontliners for Unity Party · membership system
   Design system
   navy #16233F / #0E1830 · rust #8B3A26 · gold #A9862F · cream #F6F1E4
   headline: Bitter · body: Karla · motif: mountain-ridge divider (--ridge) */

:root {
  --navy: #16233F;
  --navy-deep: #0E1830;
  --navy-soft: #2C3E68;
  --rust: #8B3A26;
  --rust-dark: #6F2D1D;
  --gold: #A9862F;
  --gold-dark: #8A6D22;
  --cream: #F6F1E4;
  --ink: #0E1830;
  --white: #FFFFFF;
  --line: #E3D9C0;
  --muted: #5B6377;
  --font-display: 'Bitter', Georgia, serif;
  --font-body: 'Karla', system-ui, sans-serif;
  --container: 640px;
  /* Mountain-ridge divider: white silhouette with a gold ridge line on top */
  --ridge: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1200 40' preserveAspectRatio='none'%3E%3Cpath d='M0 40V27L90 13 150 23 250 5 330 21 420 11 520 27 620 9 700 23 800 7 900 25 1000 13 1100 23 1200 11V40Z' fill='%23fff'/%3E%3Cpath d='M0 27L90 13 150 23 250 5 330 21 420 11 520 27 620 9 700 23 800 7 900 25 1000 13 1100 23 1200 11' fill='none' stroke='%23A9862F' stroke-width='2.5' vector-effect='non-scaling-stroke'/%3E%3C/svg%3E");
}

* { margin: 0; padding: 0; box-sizing: border-box; }

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

body {
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--cream);
  line-height: 1.6;
  font-size: 16px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 40px 20px;
}

/* admin pages: the sidebar shell owns the layout */
body:has(> .admin-shell) { display: block; padding: 0; }
.admin-shell { width: 100%; }

.brand-header {
  text-align: center;
  margin-bottom: 28px;
}

.brand-header img {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  margin-bottom: 10px;
}

.brand-wordmark {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 700;
  color: var(--navy);
}

.brand-wordmark span {
  color: var(--rust);
}

.brand-tagline {
  font-size: 12px;
  letter-spacing: 2px;
  color: var(--muted);
  text-transform: uppercase;
  margin-top: 2px;
}

.card {
  width: 100%;
  max-width: var(--container);
  background: var(--white);
  border-radius: 16px;
  border: 1px solid var(--line);
  box-shadow: 0 20px 40px -20px rgba(14, 24, 48, 0.25);
  overflow: hidden;
}

.card-banner {
  position: relative;
  background: linear-gradient(135deg, var(--navy), var(--navy-deep));
  padding: 22px 28px 40px;
  color: var(--white);
}

/* mountain-ridge divider between banner and card body */
.card-banner::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -1px;
  height: 22px;
  background: var(--ridge) center bottom / 100% 100% no-repeat;
  pointer-events: none;
}

.card-banner h1 {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
}

.card-banner p {
  font-size: 13px;
  color: #D9CFAE;
  margin-top: 4px;
}

.card-body {
  padding: 28px;
}

.step-indicator {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
}

.step-indicator .dot {
  flex: 1;
  height: 4px;
  border-radius: 2px;
  background: var(--line);
}

.step-indicator .dot.active {
  background: var(--gold);
}

fieldset {
  border: none;
  margin-bottom: 20px;
}

legend {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 12px;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 14px;
}

@media (max-width: 520px) {
  .field-row { grid-template-columns: 1fr; }
}

.field {
  margin-bottom: 14px;
}

.field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 6px;
}

.field .hint {
  font-size: 12px;
  color: var(--muted);
  font-weight: 400;
}

.field input[type="text"],
.field input[type="email"],
.field input[type="tel"],
.field input[type="password"],
.field input[type="date"],
.field input[type="file"],
.field select {
  width: 100%;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--ink);
  background: var(--white);
}

.field input:focus,
.field select:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(169, 134, 47, 0.28);
}

.otp-input {
  text-align: center;
  font-size: 28px;
  letter-spacing: 10px;
  font-weight: 700;
  color: var(--navy);
}

.btn {
  display: inline-block;
  width: 100%;
  padding: 13px 20px;
  border-radius: 8px;
  border: none;
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
}

.btn-primary {
  background: var(--rust);
  color: var(--white);
  transition: background 0.15s ease;
}

.btn-primary:hover {
  background: var(--rust-dark);
}

.btn-link {
  background: none;
  color: var(--gold-dark);
  text-decoration: underline;
  text-underline-offset: 3px;
  font-size: 13px;
  font-weight: 600;
  width: auto;
  padding: 0;
}

.alert {
  padding: 12px 14px;
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 18px;
}

.alert-error {
  background: #F6E4DE;
  color: var(--rust-dark);
  border: 1px solid #E8C4B8;
}

.alert-success {
  background: #F4ECD2;
  color: #6B5217;
  border: 1px solid #E2D2A0;
}

.success-panel {
  text-align: center;
  padding: 20px 0;
}

.success-panel .check {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--cream);
  color: var(--gold-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
  font-size: 28px;
}

.success-panel h2 {
  font-family: var(--font-display);
  color: var(--navy);
  margin-bottom: 8px;
}

.success-panel .membership-no {
  display: inline-block;
  margin-top: 14px;
  padding: 10px 18px;
  background: var(--cream);
  border: 1px dashed var(--gold);
  border-radius: 8px;
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--navy);
  letter-spacing: 1px;
}

/* Member dashboard */

.profile-summary {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 8px;
}

.profile-photo {
  width: 84px;
  height: 84px;
  border-radius: 14px;
  overflow: hidden;
  flex-shrink: 0;
  background: var(--cream);
  border: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
}

.profile-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.profile-photo-fallback {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 700;
  color: var(--navy);
}

.status-pill {
  display: inline-block;
  margin-top: 6px;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .3px;
}

.status-active { background: #F4ECD2; color: #6B5217; }
.status-pending { background: #FDF3D9; color: #97650B; }
.status-resigned,
.status-expired { background: #F6E4DE; color: var(--rust-dark); }

.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 20px;
}

@media (max-width: 520px) {
  .detail-grid { grid-template-columns: 1fr; }
}

.detail-grid > div {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.detail-label {
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .4px;
}

.detail-value {
  font-size: 14px;
  color: var(--ink);
  font-weight: 500;
}

/* Admin dashboard */

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 24px;
}

@media (max-width: 640px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
}

.stat-card {
  background: var(--cream);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stat-card-accent {
  background: var(--navy);
  border-color: var(--navy);
}

.stat-card-accent .stat-value,
.stat-card-accent .stat-label { color: #fff; }

.stat-value {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 700;
  color: var(--navy);
}

.stat-label {
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .3px;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.admin-table th {
  text-align: left;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .3px;
  color: var(--muted);
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
}

.admin-table td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
}

.admin-table tr:last-child td { border-bottom: none; }

.admin-table-num {
  text-align: right;
  font-weight: 600;
}

/* Admin sidebar layout */

.admin-shell {
  display: flex;
  min-height: 100vh;
  align-items: flex-start;
}

.admin-sidebar {
  width: 230px;
  flex-shrink: 0;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  background: var(--navy);
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  box-shadow: 2px 0 16px rgba(14, 24, 48, .18);
  z-index: 10;
  overflow-y: auto;
}

.admin-sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 26px;
  padding: 0 6px;
}

.admin-sidebar-brand img {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  object-fit: cover;
}

.admin-sidebar-brand .wordmark {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 18px;
  color: #fff;
}

.admin-sidebar-brand .wordmark span { color: var(--gold); }

.admin-nav {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.admin-nav-link {
  display: block;
  padding: 10px 14px;
  border-radius: 10px;
  color: #D9CFAE;
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: background .15s, color .15s;
}

.admin-nav-link:hover { background: rgba(255,255,255,.08); color: #fff; }

.admin-nav-link.active {
  background: var(--gold);
  color: var(--navy-deep);
  font-weight: 600;
}

.admin-nav-logout {
  margin-top: auto;
  color: #E8B7A6;
}

.admin-content {
  margin-left: 230px;
  flex: 1;
  min-width: 0;
  padding: 40px 32px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

@media (max-width: 768px) {
  .admin-shell { flex-direction: column; }
  .admin-sidebar {
    position: relative;
    width: 100%;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    padding: 14px 16px;
  }
  .admin-sidebar-brand { margin-bottom: 0; margin-right: 8px; }
  .admin-nav { flex-direction: row; flex-wrap: wrap; flex: 1; }
  .admin-nav-logout { margin-top: 0; }
  .admin-content { margin-left: 0; padding: 24px 16px; }
}

/* Clickable stat cards (admin dashboard) */
a.stat-card {
  text-decoration: none;
  cursor: pointer;
  transition: transform .15s, box-shadow .15s;
}

a.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(14, 24, 48, .12);
}

.footer-note {
  text-align: center;
  font-size: 12px;
  color: var(--muted);
  margin-top: 22px;
}

.footer-note a {
  color: var(--navy-soft);
}

.btn-secondary {
  background: transparent;
  color: var(--white);
  border: 1.5px solid var(--gold);
  transition: background 0.15s ease;
}
.card-body .btn-secondary { color: var(--navy); }
.btn-secondary:hover { background: rgba(169, 134, 47, 0.18); }

.btn:focus-visible, .btn-link:focus-visible, .admin-nav-link:focus-visible, a:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 2px;
}

.detail-value, .detail-grid > div { min-width: 0; overflow-wrap: anywhere; }

/* mountain-ridge divider above the footer note */
.footer-note::before {
  content: "";
  display: block;
  width: 120px; height: 14px;
  margin: 0 auto 12px;
  background: var(--navy);
  -webkit-mask: var(--ridge) center / 100% 100% no-repeat;
  mask: var(--ridge) center / 100% 100% no-repeat;
  opacity: .55;
}

/* ================================================================
   PHONE / SMALL SCREENS
   ================================================================ */

/* wide content scrolls inside the card instead of pushing the page sideways */
.card-body { overflow-x: auto; }

@media (max-width: 768px) {
  /* sidebar becomes a compact sticky top bar with a swipeable nav strip */
  .admin-shell { align-items: stretch; }
  .admin-sidebar {
    position: sticky;
    top: 0;
    padding: 10px 12px;
    gap: 8px;
    box-shadow: 0 2px 12px rgba(14, 24, 48, .3);
  }
  .admin-sidebar-brand { margin: 0 8px 0 0; padding: 0; }
  .admin-sidebar-brand img { width: 34px; height: 34px; }
  .admin-nav {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    gap: 6px;
  }
  .admin-nav::-webkit-scrollbar { display: none; }
  .admin-nav-link { white-space: nowrap; padding: 9px 13px; font-size: 14px; }
  .admin-sidebar-role { display: none; }
  .admin-nav-logout { margin: 0 0 0 auto; white-space: nowrap; }
  .admin-content { padding: 16px 12px 28px; align-items: stretch; }
  .admin-content .card { max-width: 100% !important; }
}

@media (max-width: 640px) {
  /* tables become stacked cards; labels come from <th> (script in sidebar.php) */
  .admin-table, .admin-table tbody, .admin-table tr, .admin-table td { display: block; width: 100%; }
  .admin-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .admin-table tr {
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--white);
    padding: 6px 12px;
    margin-bottom: 12px;
  }
  .admin-table td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 14px;
    text-align: right;
    padding: 8px 0;
    border-bottom: 1px dashed var(--line);
    overflow-wrap: anywhere;
  }
  .admin-table tr td:last-child { border-bottom: none; }
  .admin-table td[data-label]::before {
    content: attr(data-label);
    flex-shrink: 0;
    text-align: left;
    font-size: 11.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .4px;
    color: var(--muted);
  }
  .admin-table td:empty { display: none; }
  .admin-table-num { font-size: 16px; }
}

@media (max-width: 520px) {
  body { padding: 20px 12px; }
  .brand-header { margin-bottom: 18px; }
  .brand-header img { width: 80px; height: 80px; }
  .brand-wordmark { font-size: 24px; }
  .card { border-radius: 14px; }
  .card-banner { padding: 18px 18px 36px; }
  .card-banner h1 { font-size: 20px; }
  .card-body { padding: 18px 16px; }
  .card > p[style*="padding:0 30px"] { padding: 0 16px !important; }

  /* 16px inputs stop iOS zooming on focus; bigger tap targets */
  .field input[type="text"], .field input[type="email"], .field input[type="tel"],
  .field input[type="date"], .field input[type="password"], .field input[type="file"],
  .field select, .role-select { font-size: 16px; padding: 12px 13px; min-height: 46px; }
  .btn { min-height: 48px; padding: 13px 16px; }
  .btn-link { padding: 6px 0; }
  .otp-input { font-size: 24px; letter-spacing: 6px; }

  .profile-summary { flex-direction: column; align-items: flex-start; gap: 14px; }
  .profile-photo { width: 76px; height: 76px; }
  .stat-grid { gap: 10px; }
  .stat-card { padding: 12px; }
  .stat-value { font-size: 22px; }
  fieldset { margin-bottom: 16px; }

  /* banners holding a title + button: stack them */
  .card-banner[style*="display:flex"] { flex-direction: column; align-items: stretch !important; }
  .card-banner[style*="display:flex"] .btn { width: 100%; }
}

/* buttons inside a banner size to their label on wide screens (full-width on phones, see above) */
.card-banner .btn { width: auto; }
.membership-no { font-family: var(--font-display); font-weight: 700; color: var(--navy); letter-spacing: 1px; }
@media (max-width: 520px) { .card-banner[style*="display:flex"] .btn { width: 100%; } }
