/* ============================================================
   AffairOva — Main CSS
   Design tokens + global components
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@700;900&family=DM+Sans:wght@300;400;500;600&family=DM+Mono:wght@400;500&display=swap');

/* ── DESIGN TOKENS ──────────────────────────────────────────── */
:root {
  --font-serif: 'Playfair Display', 'Georgia', serif;
  --font-sans:  'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono:  'DM Mono', 'Menlo', monospace;

  /* Palette */
  --navy:          #0f1b2d;
  --navy-mid:      #1a2e47;
  --blue:          #1e5fa8;
  --blue-light:    #2d7dd2;
  --blue-pale:     #dbeafe;
  --gold:          #c9860a;
  --gold-light:    #f5b942;
  --gold-pale:     #fef3c7;
  --green:         #0f6e56;
  --green-pale:    #d1fae5;
  --rose:          #9b1c3a;
  --rose-pale:     #fce7ef;
  --ink:           #1a1a2e;
  --ink-mid:       #3d3d5c;
  --ink-soft:      #6b7280;
  --surface:       #f8f7f4;
  --surface-2:     #eeecea;
  --white:         #ffffff;
  --border:        #e0ddd8;
  --border-strong: #c8c4be;
  --red:           #dc2626;
  --red-pale:      #fee2e2;
  --purple:        #7c3aed;
  --purple-pale:   #ede9fe;

  /* Spacing */
  --sp-xs:  6px;
  --sp-sm:  10px;
  --sp-md:  16px;
  --sp-lg:  24px;
  --sp-xl:  36px;
  --sp-2xl: 52px;

  /* Radii */
  --radius-sm:  6px;
  --radius-md:  10px;
  --radius-lg:  14px;
  --radius-xl:  20px;
  --radius-pill: 100px;

  /* Shadows */
  --shadow-sm:  0 1px 3px rgba(0,0,0,0.08);
  --shadow-md:  0 4px 16px rgba(0,0,0,0.10);
  --shadow-lg:  0 10px 32px rgba(0,0,0,0.14);
  --shadow-xl:  0 24px 80px rgba(0,0,0,0.22);
}

/* ── RESET ──────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  width: 100%;
  min-height: 100%;
  font-family: var(--font-sans);
  background: var(--surface);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
button { cursor: pointer; font-family: var(--font-sans); border: none; }
input, textarea, select { font-family: var(--font-sans); }
a { text-decoration: none; }
img { max-width: 100%; height: auto; display: block; }

/* ── BUTTONS ────────────────────────────────────────────────── */
.btn-primary {
  background: linear-gradient(135deg, var(--gold), var(--gold-light));
  color: var(--navy);
  font-size: 15px;
  font-weight: 700;
  padding: 13px 24px;
  border-radius: var(--radius-md);
  border: none;
  transition: transform 0.18s, box-shadow 0.18s;
  letter-spacing: 0.3px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.btn-primary:hover  { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(245,185,66,0.4); }
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }

.btn-gold {
  background: linear-gradient(135deg, var(--gold), var(--gold-light));
  color: var(--navy);
  font-size: 15px;
  font-weight: 700;
  padding: 13px 28px;
  border-radius: var(--radius-md);
  border: none;
  transition: transform 0.18s, box-shadow 0.18s;
  width: 100%;
  margin-top: 8px;
  display: block;
  text-align: center;
}
.btn-gold:hover  { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(245,185,66,0.4); }

.btn-outline {
  background: transparent;
  border: 2px solid var(--border-strong);
  color: var(--ink-mid);
  font-size: 14px;
  font-weight: 600;
  padding: 11px 24px;
  border-radius: var(--radius-md);
  transition: border-color 0.2s, color 0.2s;
  width: 100%;
  margin-top: 8px;
  display: block;
  text-align: center;
}
.btn-outline:hover { border-color: var(--navy); color: var(--navy); }

.btn-admin {
  background: var(--navy);
  color: var(--white);
  font-size: 13px;
  font-weight: 600;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  transition: background 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.btn-admin:hover { background: var(--navy-mid); }

.btn-danger {
  background: var(--red);
  color: var(--white);
  font-size: 12px;
  font-weight: 600;
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  transition: background 0.2s;
}
.btn-danger:hover { background: #b91c1c; }

.btn-success {
  background: var(--green);
  color: var(--white);
  font-size: 12px;
  font-weight: 600;
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  transition: background 0.2s;
}
.btn-success:hover { background: #0a5540; }

.btn-sm {
  font-size: 12px;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
}

.btn-blue {
  background: var(--blue);
  color: var(--white);
  font-size: 13px;
  font-weight: 600;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  transition: background 0.2s;
}
.btn-blue:hover { background: var(--blue-light); }

/* ── NAV BUTTON ─────────────────────────────────────────────── */
.nav-btn {
  background: transparent;
  border: 1.5px solid rgba(255,255,255,0.35);
  color: rgba(255,255,255,0.85);
  font-size: 12px;
  font-weight: 500;
  padding: 6px 13px;
  border-radius: var(--radius-pill);
  transition: border-color 0.2s, color 0.2s, box-shadow 0.2s;
  letter-spacing: 0.2px;
  white-space: nowrap;
  display: inline-block;
}
.nav-btn:hover {
  border-color: var(--gold-light);
  color: var(--gold-light);
  box-shadow: 0 0 8px rgba(245,185,66,0.35);
}
/* Neon variants for specific buttons */
.nav-btn.btn-profile { border-color: rgba(45,125,210,0.6); color: rgba(45,125,210,0.9); }
.nav-btn.btn-profile:hover { border-color: var(--blue-light); color: var(--blue-light); box-shadow: 0 0 8px rgba(45,125,210,0.4); }
.nav-btn.btn-support { border-color: rgba(15,110,86,0.6); color: rgba(52,211,153,0.85); }
.nav-btn.btn-support:hover { border-color: #34d399; color: #34d399; box-shadow: 0 0 8px rgba(52,211,153,0.35); }
.nav-btn.btn-logout  { border-color: rgba(220,38,38,0.45); color: rgba(252,100,100,0.85); }
.nav-btn.btn-logout:hover  { border-color: #f87171; color: #f87171; box-shadow: 0 0 8px rgba(248,113,113,0.35); }
.nav-btn.btn-dashboard { border-color: rgba(245,185,66,0.5); color: rgba(245,185,66,0.85); }
.nav-btn.btn-dashboard:hover { border-color: var(--gold-light); color: var(--gold-light); box-shadow: 0 0 8px rgba(245,185,66,0.4); }

/* ── FORM FIELDS ────────────────────────────────────────────── */
.form-row   { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; }
.form-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-family: var(--font-mono);
}

.form-input, .form-select, .form-textarea {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 14px;
  outline: none;
  color: var(--ink);
  background: var(--white);
  transition: border-color 0.2s, box-shadow 0.2s;
  width: 100%;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--blue-light);
  box-shadow: 0 0 0 3px var(--blue-pale);
}
.form-textarea {
  resize: vertical;
  min-height: 110px;
  line-height: 1.6;
}

/* ── ALERTS ─────────────────────────────────────────────────── */
.alert {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 12px;
  display: flex;
  align-items: flex-start;
  gap: 8px;
}
.alert-error   { background: rgba(220,38,38,0.1);  border: 1px solid rgba(220,38,38,0.3);  color: #991b1b; }
.alert-success { background: rgba(15,110,86,0.1);  border: 1px solid rgba(15,110,86,0.3);  color: var(--green); }
.alert-info    { background: var(--blue-pale);      border: 1px solid #93c5fd;              color: var(--blue); }
.alert-warning { background: var(--gold-pale);      border: 1px solid #fbbf24;              color: var(--gold); }

/* ── STATUS PILLS ───────────────────────────────────────────── */
.status-pill {
  font-size: 11px;
  font-family: var(--font-mono);
  font-weight: 600;
  padding: 3px 9px;
  border-radius: var(--radius-pill);
  display: inline-block;
}
.pill-active   { background: var(--green-pale); color: var(--green); }
.pill-pending  { background: var(--gold-pale);  color: var(--gold); }
.pill-inactive { background: var(--surface-2);  color: var(--ink-soft); }
.pill-expired  { background: var(--red-pale);   color: var(--red); }
.pill-open     { background: var(--blue-pale);  color: var(--blue); }
.pill-closed   { background: var(--surface-2);  color: var(--ink-soft); }
.pill-approved { background: var(--green-pale); color: var(--green); }
.pill-rejected { background: var(--red-pale);   color: var(--red); }

/* ── TABLES ─────────────────────────────────────────────────── */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.data-table th {
  background: var(--surface-2);
  padding: 10px 14px;
  text-align: left;
  font-weight: 600;
  color: var(--ink-mid);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-family: var(--font-mono);
  white-space: nowrap;
}
.data-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td      { background: var(--surface); }

/* ── CARD ───────────────────────────────────────────────────── */
.card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
}
.card-title {
  font-family: var(--font-serif);
  font-size: 17px;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

/* ── SECTION TYPOGRAPHY ─────────────────────────────────────── */
.eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  color: var(--ink-soft);
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-bottom: 5px;
}
.section-heading {
  font-family: var(--font-serif);
  font-size: 22px;
  font-weight: 900;
  color: var(--navy);
  margin-bottom: 16px;
}

/* ── NOTIFICATION TOAST ─────────────────────────────────────── */
#toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--navy);
  color: var(--white);
  padding: 12px 20px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 500;
  z-index: 9999;
  transform: translateY(100px);
  opacity: 0;
  transition: transform 0.3s cubic-bezier(.22,.68,0,1.2), opacity 0.3s;
  max-width: 320px;
  border-left: 3px solid var(--gold-light);
  box-shadow: var(--shadow-lg);
  pointer-events: none;
}
#toast.show  { transform: translateY(0); opacity: 1; }
#toast.error { border-left-color: var(--red); }

/* ── UPLOAD ZONE ────────────────────────────────────────────── */
.upload-zone {
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius-md);
  padding: 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  background: var(--surface);
}
.upload-zone:hover { border-color: var(--blue-light); background: var(--blue-pale); }
.upload-zone input[type="file"] { display: none; }

/* ── MODAL OVERLAY ──────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15,27,45,0.65);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: fadeIn 0.2s ease;
}
/* Modal box: fixed height cap, flex column so header/footer stay visible */
.modal-box {
  background: var(--white);
  border-radius: var(--radius-xl);
  max-width: 480px;
  width: 100%;
  box-shadow: var(--shadow-xl);
  position: relative;
  animation: slideUp 0.25s ease;
  /* flex column keeps header+footer pinned, body scrolls */
  display: flex;
  flex-direction: column;
  max-height: min(92vh, 700px);
  overflow: hidden; /* children handle their own scroll */
}
.modal-lg { max-width: 600px; }

/* Header — always visible at top */
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.modal-title {
  font-family: var(--font-serif);
  font-size: 18px;
  font-weight: 700;
  color: var(--navy);
}

/* Body — scrolls independently */
.modal-body {
  padding: 20px 24px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  flex: 1;
}

/* Footer — always pinned at bottom, buttons equal width side by side */
.modal-footer {
  display: flex;
  gap: 10px;
  align-items: stretch;
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  background: var(--white);
  border-bottom-left-radius: var(--radius-xl);
  border-bottom-right-radius: var(--radius-xl);
}
.modal-footer .btn-outline,
.modal-footer .btn-admin,
.modal-footer .btn-gold,
.modal-footer .btn-primary {
  flex: 1;
  width: auto;
  margin: 0;
  padding: 11px 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}
.modal-close {
  position: absolute;
  top: 14px; right: 14px;
  background: var(--surface-2);
  border: none;
  width: 30px; height: 30px;
  border-radius: 50%;
  font-size: 16px;
  color: var(--ink-soft);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.2s;
  flex-shrink: 0;
  z-index: 1;
}
.modal-close:hover { background: var(--border); }

@keyframes fadeIn  { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* ── SPINNER ────────────────────────────────────────────────── */
.spinner {
  width: 40px; height: 40px;
  border: 3px solid var(--blue-pale);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
  margin: 0 auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── TABS ───────────────────────────────────────────────────── */
.tabs {
  display: flex;
  gap: 6px;
  background: var(--surface-2);
  border-radius: var(--radius-md);
  padding: 4px;
  margin-bottom: 14px;
}
.tab-btn {
  flex: 1;
  padding: 8px;
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-soft);
  transition: background 0.18s, color 0.18s;
  cursor: pointer;
}
.tab-btn.active { background: var(--white); color: var(--navy); box-shadow: var(--shadow-sm); }
.tab-panel      { display: none; }
.tab-panel.active { display: block; }

/* ── QR / PAYMENT BOX ───────────────────────────────────────── */
.qr-box {
  background: var(--surface);
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 20px;
  text-align: center;
  margin: 14px 0;
}
.qr-img { max-width: 180px; border-radius: var(--radius-sm); margin: 0 auto 10px; }
.payment-link-btn {
  display: inline-block;
  background: var(--blue);
  color: var(--white);
  font-size: 14px;
  font-weight: 600;
  padding: 10px 22px;
  border-radius: var(--radius-sm);
  transition: background 0.2s;
  cursor: pointer;
  border: none;
}
.payment-link-btn:hover { background: var(--blue-light); }

/* ── SUBSCRIPTION BAR ───────────────────────────────────────── */
.sub-bar {
  background: var(--gold-pale);
  border: 1px solid var(--gold);
  border-radius: var(--radius-md);
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
}
.sub-bar-icon { font-size: 20px; }
.sub-bar-text { font-size: 13px; color: var(--gold); font-weight: 500; }

/* ── UTILITIES ──────────────────────────────────────────────── */
.hidden  { display: none !important; }
.flex    { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.gap-sm  { gap: 8px; }
.gap-md  { gap: 14px; }
.text-center { text-align: center; }
.text-right  { text-align: right; }
.text-mono   { font-family: var(--font-mono); }
.text-sm     { font-size: 12px; }
.text-xs     { font-size: 11px; }
.text-soft   { color: var(--ink-soft); }
.text-navy   { color: var(--navy); }
.text-gold   { color: var(--gold-light); }
.fw-bold     { font-weight: 700; }
.mt-sm  { margin-top: 8px; }
.mt-md  { margin-top: 16px; }
.mt-lg  { margin-top: 24px; }
.mb-sm  { margin-bottom: 8px; }
.mb-md  { margin-bottom: 16px; }
.mb-lg  { margin-bottom: 24px; }
.overflow-x { overflow-x: auto; }

/* ── RESPONSIVE ─────────────────────────────────────────────── */
@media (max-width: 600px) {
  .hide-mobile   { display: none !important; }
  .modal-overlay { padding: 0; align-items: flex-end; }
  .modal-box     {
    max-width: 100%;
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
    max-height: 90vh;
  }
}
