/* USF Affiliate Dashboard styles — layered on top of /css/style.css */
:root{
  --aff-gold:#FFD700;
  --aff-navy:#0A1628;
  --aff-navy-2:#111a2b;
  --aff-gold-soft: rgba(255,215,0,0.12);
}
.aff-shell{min-height:100vh;background:var(--bg)}
.aff-topbar{background:var(--aff-navy);color:#fff;padding:14px 16px;display:flex;align-items:center;justify-content:space-between;gap:12px;position:sticky;top:0;z-index:50}
.aff-topbar .brand{display:flex;align-items:center;gap:10px;font-weight:700;color:#fff}
.aff-topbar .brand img{width:32px;height:32px;border-radius:8px}
.aff-topbar .brand small{color:var(--aff-gold);font-weight:600;letter-spacing:.06em;font-size:11px;display:block}
.aff-topbar .who{font-size:13px;color:#cbd5e1}
.aff-topbar .who b{color:#fff}
.aff-topbar .btn-logout{background:transparent;color:#fff;border:1px solid rgba(255,255,255,.25);padding:8px 14px;border-radius:8px;font-size:13px;cursor:pointer}

.aff-tabs{display:flex;overflow-x:auto;background:var(--surface);border-bottom:1px solid var(--border);padding:0 8px;gap:2px;position:sticky;top:60px;z-index:40}
.aff-tab{padding:14px 16px;font-size:14px;font-weight:600;color:var(--muted);border:none;background:transparent;cursor:pointer;white-space:nowrap;border-bottom:3px solid transparent}
.aff-tab.active{color:var(--aff-navy);border-bottom-color:var(--aff-gold)}
[data-theme="dark"] .aff-tab.active{color:#fff}

.aff-main{max-width:1100px;margin:0 auto;padding:20px 16px 60px}
.aff-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(210px,1fr));gap:14px}
.aff-stat{background:var(--surface);border:1px solid var(--border);border-radius:14px;padding:16px;position:relative;overflow:hidden}
.aff-stat .lbl{font-size:12px;letter-spacing:.05em;color:var(--muted);text-transform:uppercase}
.aff-stat .val{font-size:26px;font-weight:800;color:var(--text);margin-top:6px}
.aff-stat.gold{background:linear-gradient(135deg,#111a2b 0%,#0A1628 100%);color:#fff;border-color:transparent}
.aff-stat.gold .lbl{color:#ffd700}
.aff-stat.gold .val{color:#fff}

.aff-card{background:var(--surface);border:1px solid var(--border);border-radius:14px;padding:18px;margin-top:16px}
.aff-card h3{margin:0 0 14px;font-size:16px;color:var(--text)}

.aff-link-row{display:flex;gap:8px;align-items:center;flex-wrap:wrap}
.aff-link-input{flex:1;min-width:200px;font-family:monospace;font-size:14px}
.aff-earn-pill{display:inline-block;background:var(--aff-gold-soft);color:var(--aff-navy);border:1px solid var(--aff-gold);padding:8px 14px;border-radius:999px;font-weight:700;margin-top:12px}
[data-theme="dark"] .aff-earn-pill{color:#fff}

.aff-milestone-track{display:flex;flex-direction:column;gap:8px}
.aff-milestone-item{display:flex;align-items:center;gap:12px;padding:12px;border:1px solid var(--border);border-radius:10px;background:var(--bg)}
.aff-milestone-item.done{border-color:var(--aff-gold);background:var(--aff-gold-soft)}
.aff-milestone-item.current{border-color:var(--aff-navy);box-shadow:0 0 0 2px var(--aff-gold-soft)}
.aff-milestone-icon{width:34px;height:34px;border-radius:50%;background:var(--border);display:flex;align-items:center;justify-content:center;font-size:15px}
.aff-milestone-item.done .aff-milestone-icon{background:var(--aff-gold);color:var(--aff-navy)}
.aff-milestone-name{font-weight:700}
.aff-milestone-goal{font-size:13px;color:var(--muted)}
.aff-progress{height:10px;background:var(--border);border-radius:999px;overflow:hidden;margin-top:12px}
.aff-progress > i{display:block;height:100%;background:linear-gradient(90deg,var(--aff-gold),#ffb400);border-radius:999px}

.aff-empty{text-align:center;color:var(--muted);padding:36px 12px;font-size:14px}
.aff-status-pill{display:inline-block;padding:2px 10px;border-radius:999px;font-size:12px;font-weight:600}
.aff-status-paid{background:#e6f4ea;color:#1e8e3e}
.aff-status-pending_otp,.aff-status-otp_verified,.aff-status-processing{background:#fff4d6;color:#8a6d00}
.aff-status-released,.aff-status-refunded{background:#fde7e7;color:#d93025}
[data-theme="dark"] .aff-status-paid{background:#13351f;color:#7fdf9b}
[data-theme="dark"] .aff-status-released,[data-theme="dark"] .aff-status-refunded{background:#3a1414;color:#ff8a85}

/* Withdrawal modal hardening */
.aff-modal{
  position:fixed !important;
  inset:0 !important;
  box-sizing:border-box;
  width:100vw;
  max-width:none;
  height:100vh;
  height:100dvh;
  min-height:100dvh;
  margin:0 !important;
  padding:16px;
  background:rgba(0,0,0,.86);
  display:flex !important;
  align-items:center;
  justify-content:center;
  overflow-x:hidden;
  overflow-y:auto;
  overscroll-behavior:contain;
  -webkit-overflow-scrolling:touch;
  z-index:99999 !important;
}
.aff-modal .card{
  box-sizing:border-box;
  position:relative;
  width:100%;
  max-width:420px;
  max-height:calc(100dvh - 32px);
  margin:0 auto;
  padding:24px;
  overflow-x:hidden;
  overflow-y:auto;
  background:#0A1628 !important;
  color:#fff !important;
  border:1px solid rgba(255,255,255,.18);
  border-radius:12px;
  box-shadow:0 10px 40px rgba(0,0,0,.20);
  flex:0 1 auto;
  animation:affModalIn .2s ease;
}
.aff-modal .card h3{margin:0 0 14px;color:#fff}
.aff-modal .card input{box-sizing:border-box;max-width:100%;width:100%;background:#111d31;color:#fff;border:1px solid rgba(255,255,255,.25)}
.aff-modal .card p,.aff-modal .card .aff-help,.aff-modal .card label{color:#dbe4f0}
.aff-modal .card b,.aff-modal .card strong{color:#fff}
.aff-modal .card .error-msg{color:#ff9b9b}
.aff-modal .card > div[style*="display:flex"]{
  display:flex;
  flex-wrap:wrap;
  gap:12px !important;
  margin-top:20px !important;
}
.aff-modal .card > div[style*="display:flex"] .btn{
  flex:1 1 150px;
  min-width:0;
}
@keyframes affModalIn{
  from{opacity:0;transform:scale(.97)}
  to{opacity:1;transform:scale(1)}
}
@media (max-width:480px){
  .aff-modal{padding:12px}
  .aff-modal .card{
    width:100%;
    max-width:none;
    max-height:calc(100dvh - 24px);
    padding:20px;
  }
  .aff-modal .card > div[style*="display:flex"] .btn{flex-basis:100%}
}
.aff-hidden{display:none !important}
.aff-row{display:flex;gap:10px;flex-wrap:wrap}
.aff-row > *{flex:1;min-width:140px}

.aff-form-label{display:block;font-size:13px;color:var(--muted);margin:12px 0 6px;font-weight:600}
.aff-help{color:var(--muted);font-size:13px;margin-top:6px}
.aff-readonly-input{background:var(--bg,#f4f4f5);color:var(--text);cursor:default;font-weight:600}
.aff-readonly-input:focus{outline:none}

/* Two-column form row (e.g. First name / Last name on signup) */
.aff-form-row-2{display:grid;grid-template-columns:1fr 1fr;gap:12px}
.aff-form-row-2 .aff-form-label{margin-top:0}
@media (max-width:480px){.aff-form-row-2{grid-template-columns:1fr}}

/* Auth pages */
.aff-auth-wrap{min-height:100vh;display:flex;align-items:center;justify-content:center;padding:24px;background:#FFFFFF}
.aff-auth-card{background:var(--surface);border-radius:16px;padding:28px;max-width:420px;width:100%;box-shadow:0 20px 60px rgba(0,0,0,.4)}
.aff-auth-card h1{margin:0 0 4px;font-size:22px}
.aff-auth-card p.sub{color:var(--muted);margin:0 0 20px;font-size:14px}
.aff-auth-brand{display:flex;align-items:center;gap:10px;margin-bottom:18px}
.aff-auth-brand img{width:40px;height:40px;border-radius:10px}
.aff-auth-brand div{line-height:1.1}
.aff-auth-brand small{color:var(--aff-gold);font-weight:700;letter-spacing:.06em;font-size:11px}
.aff-google-btn{display:flex;align-items:center;justify-content:center;gap:10px;width:100%;padding:12px;border:1px solid var(--border);border-radius:10px;background:#fff;color:#0A1628;font-weight:600;cursor:pointer;font-size:15px}
.aff-google-btn:hover{background:#f7f8fa}
.aff-divider{display:flex;align-items:center;gap:10px;color:var(--muted);font-size:12px;margin:16px 0}
.aff-divider::before,.aff-divider::after{content:"";flex:1;height:1px;background:var(--border)}

/* Password visibility toggle (signup / login) */
.aff-pw-wrap{position:relative;display:flex;align-items:center}
.aff-pw-wrap input{flex:1;padding-right:44px}
.aff-pw-toggle{position:absolute;right:6px;top:50%;transform:translateY(-50%);background:transparent;border:none;cursor:pointer;font-size:17px;line-height:1;padding:6px;color:var(--muted);border-radius:6px}
.aff-pw-toggle:hover{color:var(--text)}
.aff-pw-toggle:focus-visible{outline:2px solid var(--aff-gold);outline-offset:1px}

/* Lightweight password strength meter (invite completion) */
.aff-pw-strength{display:flex;align-items:center;gap:8px;margin-top:6px;min-height:16px}
.aff-pw-strength-track{flex:1;height:5px;border-radius:999px;background:var(--border);overflow:hidden}
.aff-pw-strength-track > i{display:block;height:100%;width:0%;border-radius:999px;background:var(--border);transition:width .18s ease,background-color .18s ease}
.aff-pw-strength-label{font-size:12px;font-weight:600;color:var(--muted);min-width:56px;text-align:right}
.aff-pw-strength.weak .aff-pw-strength-track > i{background:#d93025}
.aff-pw-strength.weak .aff-pw-strength-label{color:#d93025}
.aff-pw-strength.fair .aff-pw-strength-track > i{background:#f0a500}
.aff-pw-strength.fair .aff-pw-strength-label{color:#8a6d00}
.aff-pw-strength.good .aff-pw-strength-track > i{background:#1e8e3e}
.aff-pw-strength.good .aff-pw-strength-label{color:#1e8e3e}
.aff-pw-strength.strong .aff-pw-strength-track > i{background:var(--aff-gold)}
[data-theme="dark"] .aff-pw-strength.strong .aff-pw-strength-label{color:#ffd700}
.aff-pw-strength:not(.weak):not(.fair):not(.good):not(.strong) .aff-pw-strength-label{visibility:hidden}

/* Remember me row (login) */
.aff-remember-row{display:flex;align-items:center;gap:8px;margin:12px 0 0;font-size:13px;color:var(--muted)}
.aff-remember-row input[type="checkbox"]{width:16px;height:16px;margin:0;accent-color:var(--aff-gold);cursor:pointer}
.aff-remember-row label{cursor:pointer;user-select:none}

/* ------------------------------------------------------------
   Data tables: horizontal scroll (desktop) + card stacking (mobile)
   Applied via .aff-table-responsive on <table>. Scoped so it only
   affects tables that opt in — existing tables without the class
   are untouched.

   NOTE — sticky header removed (was position:sticky;top:71px on
   thead th). Two earlier attempts to make that work (border-
   collapse:separate, then isolation:isolate on the wrapper) still
   left a "ghost" first row visibly painted above the header on
   production Chromium — this is because .aff-table-scroll's
   overflow-x:auto forces its overflow-y to a computed 'auto' too
   (a CSS spec rule: an axis left 'visible' is coerced to 'auto'
   the moment the other axis isn't 'visible'), which silently makes
   this wrapper — not the page — the sticky containing block. Since
   the wrapper is only ever exactly as tall as the table itself,
   there's no room in it for a sticky element to genuinely travel,
   so Chromium's sticky+scroll compositing glitches instead of
   just doing nothing.
   Admin's table (.table-wrap in admin/dashboard.html) never had
   this bug for the simple reason that it never used position:sticky
   in the first place. Rather than patch the sticky approach a third
   time, this now matches Admin's real, working behavior exactly:
   the header scrolls away with the page like any other row.
------------------------------------------------------------ */
.aff-table-scroll{
  overflow-x:auto;
}
.aff-table-responsive{
  width:100%;
  border-collapse:separate;border-spacing:0;
}
.aff-table-responsive thead th{
  background:var(--surface);
  text-align:left;padding:10px 8px;font-size:13px;color:var(--muted);
  border-bottom:1px solid var(--border);
}
.aff-table-responsive tbody tr{height:auto}
.aff-table-responsive tbody td{padding:12px 8px;border-bottom:1px solid var(--border);font-size:14px;vertical-align:middle;background:var(--surface)}

@media (max-width:680px){
  .aff-table-responsive thead{display:none}
  .aff-table-responsive, .aff-table-responsive tbody, .aff-table-responsive tr, .aff-table-responsive td{display:block;width:100%}
  .aff-table-responsive tr{
    border:1px solid var(--border);border-radius:12px;
    padding:10px 12px;margin-bottom:10px;background:var(--surface);
  }
  .aff-table-responsive td{
    display:flex;justify-content:space-between;align-items:center;gap:12px;
    border-bottom:1px dashed var(--border);padding:8px 0;text-align:right;
  }
  .aff-table-responsive td:last-child{border-bottom:none}
  .aff-table-responsive td::before{
    content:attr(data-label);font-weight:600;color:var(--muted);
    text-align:left;flex-shrink:0;
  }
}

/* ------------------------------------------------------------
   Wallet empty-state (Bug fix — Creator Wallet + Affiliate Wallet)
   ------------------------------------------------------------
   Shared by creator-wallet.html and affiliate-wallet.html (both
   already load this stylesheet). Renders as a single <tr> with a
   colspan cell spanning every visible column, so the message is
   centered across the whole table instead of being squeezed into
   one cell.
   Uses this project's existing theme variables (--text / --muted,
   defined in css/style.css and already dark-mode aware via
   [data-theme="dark"]) rather than introducing new
   --foreground/--muted-foreground variables, so dark mode keeps
   working with zero extra rules.
   The two rules inside the @media block below are required: without
   them, the generic ".aff-table-responsive td" mobile rule (above)
   turns this cell into a space-between flex row and right-aligns the
   text — exactly the "squeezed into the middle" bug being fixed here.
   Higher specificity here (an added class) overrides that rule
   without needing !important.
------------------------------------------------------------ */
.wallet-empty-cell{
  text-align:center;
  padding:48px 24px;
}

.wallet-empty-state{
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  gap:8px;
  color:var(--muted,#64748b);
}

.wallet-empty-state strong{
  color:var(--text,#0f172a);
  font-size:16px;
  font-weight:600;
}

.wallet-empty-state p{
  margin:0;
  font-size:14px;
  line-height:1.5;
}

@media (max-width:680px){
  .aff-table-responsive td.wallet-empty-cell{
    display:block;
    text-align:center;
  }
  .aff-table-responsive td.wallet-empty-cell::before{
    content:none;
  }
}

/* ------------------------------------------------------------
   Milestone timeline enhancements (Task D)
------------------------------------------------------------ */
.aff-milestone-track.aff-milestone-track-visual{position:relative;padding-left:6px}
.aff-milestone-track-visual::before{
  content:"";position:absolute;left:23px;top:6px;bottom:6px;width:2px;
  background:var(--border);z-index:0;
}
.aff-milestone-track-visual .aff-milestone-item{position:relative;z-index:1}
.aff-milestone-reward-row{display:grid;grid-template-columns:repeat(auto-fit,minmax(160px,1fr));gap:10px;margin-top:14px}
.aff-milestone-reward-card{
  border:1px dashed var(--aff-gold);border-radius:12px;padding:12px;
  background:var(--aff-gold-soft);
}
.aff-milestone-reward-card .tier{font-weight:800;font-size:14px;color:var(--aff-navy)}
[data-theme="dark"] .aff-milestone-reward-card .tier{color:#fff}
.aff-milestone-reward-card .goal{font-size:12px;color:var(--muted);margin-top:4px}

/* Profile picture upload / preview */
.aff-profile-photo-card{overflow:hidden}
.aff-profile-photo-row{display:flex;align-items:center;gap:18px;flex-wrap:wrap}
.aff-profile-photo-preview{width:88px;height:88px;border-radius:50%;object-fit:cover;border:2px solid var(--border);background:var(--bg);flex:0 0 88px}
.aff-profile-photo-copy{min-width:220px;flex:1}
.aff-profile-photo-copy p{margin:0 0 10px;color:var(--muted);font-size:13px}
.aff-profile-photo-copy input[type=file]{display:block;max-width:100%;padding:8px;border:1px solid var(--border);border-radius:10px;background:var(--surface);color:var(--text)}
.aff-profile-photo-copy small{display:block;margin-top:6px;color:var(--muted);font-size:11px}
@media(max-width:600px){.aff-profile-photo-row{align-items:flex-start}.aff-profile-photo-preview{width:76px;height:76px;flex-basis:76px}.aff-profile-photo-copy{min-width:0;width:100%}}


/* ============================================================
   USF AUTH — CLEAN STUDENT-PORTAL LIGHT THEME
   Keep all affiliate/creator authentication screens on the
   same white, navy, light-border surface as the student portal.
============================================================ */
.aff-auth-wrap{
  min-height:100vh;
  display:flex;
  align-items:center;
  justify-content:center;
  padding:32px 20px;
  background:#FFFFFF;
  color:#0B1B33;
}
.aff-auth-card{
  width:100%;
  max-width:460px;
  background:#FFFFFF;
  color:#0B1B33;
  border:1px solid #E3E8F2;
  border-radius:16px;
  padding:30px;
  box-shadow:0 12px 40px rgba(11,27,51,.08);
}
.aff-auth-card h1{color:#0B1B33}
.aff-auth-card p.sub{color:#5B6B85}
.aff-auth-brand small{color:#122A4E}
.aff-form-label{color:#0B1B33}
.aff-auth-card input,
.aff-auth-card select,
.aff-auth-card textarea{
  background:#FFFFFF;
  color:#0B1B33;
  border:1px solid #D9E1EC;
  border-radius:10px;
  min-height:44px;
}
.aff-auth-card input::placeholder{color:#8A97AA}
.aff-auth-card input:focus,
.aff-auth-card select:focus,
.aff-auth-card textarea:focus{
  border-color:#2F6FED;
  outline:3px solid rgba(47,111,237,.12);
}
.aff-auth-card .aff-help,
.aff-auth-card .aff-divider{color:#5B6B85}
.aff-auth-card .aff-divider::before,
.aff-auth-card .aff-divider::after{background:#E3E8F2}
.aff-google-wrap{
  background:#FFFFFF;
  border-color:#E3E8F2;
}
.aff-pw-toggle{color:#5B6B85}
.aff-pw-toggle:hover{color:#0B1B33}
@media (max-width:600px){
  .aff-auth-wrap{padding:24px 16px;align-items:flex-start}
  .aff-auth-card{margin-top:8px;padding:24px;border-radius:14px}
}

.aff-pw-toggle-svg{
  width:40px;height:40px;right:2px;top:50%;
  display:inline-flex;align-items:center;justify-content:center;
  padding:0;border:0;background:transparent;
}
.aff-pw-toggle-svg svg{width:19px;height:19px;display:block}
.aff-pw-wrap .aff-pw-toggle-svg{position:absolute;transform:translateY(-50%);color:#5B6B85}
.aff-pw-wrap .aff-pw-toggle-svg:hover{background:rgba(11,27,51,.05);color:#0B1B33}
.aff-pw-wrap .aff-pw-toggle-svg:focus-visible{outline:2px solid #2F6FED;outline-offset:1px}
