/* ════════════════════════════════════════════
   CSB WORLD AP PORTAL — Full Stylesheet
   Matches reference HTML design exactly
════════════════════════════════════════════ */

/* ── Variables ── */
:root {
  --navy: #0B1B3D;
  --navy-mid: #162850;
  --navy-light: #1E3A6E;
  --gold: #C8942A;
  --gold-light: #F0B93B;
  --gold-pale: #FDF4E3;
  --cream: #FAFAF7;
  --border: rgba(11,27,61,0.12);
  --border-gold: rgba(200,148,42,0.3);
  --text: #0B1B3D;
  --text-muted: #5A6A85;
  --text-light: #8A9AB5;
  --success: #1A7A4A;
  --success-bg: #EAF6F0;
  --danger: #B03A2E;
  --danger-bg: #FDEEEC;
  --warn-bg: #FDF4E3;
  --radius: 10px;
  --radius-lg: 16px;
  --shadow: 0 2px 12px rgba(11,27,61,0.08);
  --shadow-lg: 0 8px 32px rgba(11,27,61,0.14);
}

/* ── Scoped Reset (inside #csb-ap-wrapper only) ── */
#csb-ap-wrapper, #csb-ap-wrapper * { box-sizing: border-box; }
#csb-ap-wrapper { font-family: 'Plus Jakarta Sans', sans-serif; background: var(--cream); color: var(--text); font-size: 14px; line-height: 1.6; }
#csb-ap-wrapper h1, #csb-ap-wrapper h2, #csb-ap-wrapper h3, #csb-ap-wrapper h4 { font-family: 'Syne', sans-serif; margin: 0; padding: 0; }

/* ── Utility ── */
.hidden { display: none !important; }
.badge { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 20px; font-size: 11px; font-weight: 600; letter-spacing: 0.4px; }
.badge-gold { background: var(--gold-pale); color: var(--gold); border: 1px solid var(--border-gold); }
.badge-green { background: var(--success-bg); color: var(--success); }
.badge-red { background: var(--danger-bg); color: var(--danger); }
.badge-navy { background: #E8EDF7; color: var(--navy-light); }

/* ── Buttons ── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 10px 20px; border-radius: var(--radius); font-family: 'Plus Jakarta Sans', sans-serif; font-size: 14px; font-weight: 600; cursor: pointer; border: none; transition: all 0.18s; text-decoration: none; }
.btn-primary { background: var(--navy); color: #fff; }
.btn-primary:hover { background: var(--navy-light); color: #fff; }
.btn-gold { background: var(--gold); color: #fff; }
.btn-gold:hover { background: var(--gold-light); color: #fff; }
.btn-outline { background: #fff; color: var(--navy); border: 1.5px solid var(--border); }
.btn-outline:hover { border-color: var(--navy); }
.btn-sm { padding: 6px 14px; font-size: 12px; }
.btn-danger { background: var(--danger-bg); color: var(--danger); border: none; }

/* ── Forms ── */
#csb-ap-wrapper input[type=text],
#csb-ap-wrapper input[type=email],
#csb-ap-wrapper input[type=number],
#csb-ap-wrapper input[type=password],
#csb-ap-wrapper input[type=url],
#csb-ap-wrapper input[type=date],
#csb-ap-wrapper input[type=tel],
#csb-ap-wrapper select,
#csb-ap-wrapper textarea {
  width: 100%; padding: 10px 14px; border: 1.5px solid var(--border); border-radius: var(--radius);
  font-family: 'Plus Jakarta Sans', sans-serif; font-size: 14px; background: #fff; color: var(--text); outline: none; transition: border 0.15s;
}
#csb-ap-wrapper select { padding: 0 14px; height: 44px; }
#csb-ap-wrapper input:focus, #csb-ap-wrapper select:focus, #csb-ap-wrapper textarea:focus { border-color: var(--navy-light); }
#csb-ap-wrapper label { display: block; font-size: 12px; font-weight: 600; color: var(--text-muted); margin-bottom: 5px; letter-spacing: 0.3px; }
.form-group { margin-bottom: 16px; }
.card { background: #fff; border-radius: var(--radius-lg); border: 1px solid var(--border); padding: 20px 24px; }
.section-title { font-size: 13px; font-weight: 700; color: var(--text-muted); letter-spacing: 1px; text-transform: uppercase; margin-bottom: 16px; }

/* ══════════════════════════════════
   LOGIN SCREEN
══════════════════════════════════ */
#screen-login {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: var(--navy); padding: 20px;
}
.login-wrap { width: 420px; max-width: 100%; }
.login-logo { text-align: center; margin-bottom: 36px; }
.login-logo .logo-mark {
  width: 56px; height: 56px; background: var(--gold); border-radius: 14px;
  display: inline-flex; align-items: center; justify-content: center;
  font-family: 'Syne', sans-serif; font-size: 22px; color: #fff; font-weight: 800; margin-bottom: 12px;
}
.login-logo h1 { color: #fff; font-size: 22px; letter-spacing: -0.5px; }
.login-logo p { color: rgba(255,255,255,0.5); font-size: 13px; margin-top: 4px; }
.portal-logo { max-height: 64px; margin-bottom: 12px; display: block; margin-left: auto; margin-right: auto; }
.login-card { background: #fff; border-radius: var(--radius-lg); padding: 32px; box-shadow: var(--shadow-lg); }
.login-card h2 { font-size: 20px; margin-bottom: 6px; }
.login-card .sub { color: var(--text-muted); font-size: 13px; margin-bottom: 24px; }
.otp-row { display: flex; gap: 10px; }
.otp-row input { text-align: center; font-size: 20px; font-weight: 700; padding: 12px 6px; letter-spacing: 2px; }
.resend { font-size: 12px; color: var(--text-muted); margin-top: 10px; text-align: center; }
.resend a { color: var(--navy-light); cursor: pointer; font-weight: 600; text-decoration: none; }

/* ══════════════════════════════════
   APP SHELL
══════════════════════════════════ */
#screen-app { min-height: 100vh; }
.app-shell { display: flex; min-height: 100vh; }

/* ══════════════════════════════════
   SIDEBAR
══════════════════════════════════ */
.sidebar { width: 230px; background: var(--navy); display: flex; flex-direction: column; position: fixed; top: 0; left: 0; height: 100vh; z-index: 100; }
.sidebar-logo { padding: 22px 20px 18px; border-bottom: 1px solid rgba(255,255,255,0.08); display: flex; align-items: center; gap: 12px; }
.sidebar-logo .logo-sm { width: 34px; height: 34px; background: var(--gold); border-radius: 8px; display: flex; align-items: center; justify-content: center; font-family: 'Syne', sans-serif; font-size: 14px; color: #fff; font-weight: 800; flex-shrink: 0; }
.sidebar-logo span { color: #fff; font-family: 'Syne', sans-serif; font-size: 15px; font-weight: 700; line-height: 1.2; }
.sidebar-logo small { color: rgba(255,255,255,0.4); font-size: 10px; display: block; font-family: 'Plus Jakarta Sans', sans-serif; font-weight: 400; }
.sidebar-user { padding: 16px 20px; border-bottom: 1px solid rgba(255,255,255,0.08); display: flex; align-items: center; gap: 10px; }
.sidebar-user .av { width: 36px; height: 36px; border-radius: 50%; background: var(--gold); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; color: #fff; flex-shrink: 0; }
.sidebar-user .info { flex: 1; }
.sidebar-user .name { color: #fff; font-size: 13px; font-weight: 600; }
.sidebar-user .code { color: rgba(255,255,255,0.45); font-size: 11px; }
.sidebar-nav { flex: 1; padding: 12px 0; overflow-y: auto; }
.nav-section { padding: 14px 20px 6px; color: rgba(255,255,255,0.3); font-size: 10px; font-weight: 700; letter-spacing: 1.2px; text-transform: uppercase; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 10px 20px; cursor: pointer; color: rgba(255,255,255,0.6); font-size: 13px; font-weight: 500; transition: all 0.15s; border-left: 3px solid transparent; margin: 1px 0; }
.nav-item:hover { background: rgba(255,255,255,0.06); color: #fff; }
.nav-item.active { background: rgba(200,148,42,0.15); color: var(--gold-light); border-left-color: var(--gold); }
.nav-icon { font-size: 16px; width: 18px; text-align: center; }
.nav-badge { margin-left: auto; background: var(--danger); color: #fff; font-size: 10px; font-weight: 700; padding: 2px 7px; border-radius: 20px; }
.sidebar-footer { padding: 16px 20px; border-top: 1px solid rgba(255,255,255,0.08); }
.sidebar-footer .nav-item { border-left: none; border-radius: var(--radius); padding: 8px 10px; margin: 0; }

/* ══════════════════════════════════
   TOPBAR & MAIN CONTENT
══════════════════════════════════ */
.main-content { margin-left: 230px; flex: 1; min-height: 100vh; background: var(--cream); }
.topbar { background: #fff; border-bottom: 1px solid var(--border); padding: 0 28px; height: 60px; display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 50; }
.topbar-title { font-family: 'Syne', sans-serif; font-size: 18px; color: var(--navy); }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.notif-dot { position: relative; }
.notif-dot::after { content: ''; position: absolute; top: 2px; right: 2px; width: 7px; height: 7px; background: var(--gold); border-radius: 50%; border: 2px solid #fff; }
.page-content { padding: 28px; }
.ap-page { animation: fadein 0.2s ease; }
@keyframes fadein { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

/* ══════════════════════════════════
   PROFILE PAGE
══════════════════════════════════ */
.profile-header { display: flex; align-items: center; gap: 18px; margin-bottom: 24px; background: #fff; border-radius: var(--radius-lg); border: 1px solid var(--border); padding: 24px; }
.profile-av { width: 60px; height: 60px; border-radius: 50%; background: var(--navy); color: #fff; display: flex; align-items: center; justify-content: center; font-family: 'Syne', sans-serif; font-size: 22px; font-weight: 700; flex-shrink: 0; }
.profile-header .name { font-size: 20px; }
.profile-header .meta { color: var(--text-muted); font-size: 13px; margin-top: 3px; }
.profile-header .meta span { margin-right: 14px; }
.info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.info-field { background: #fff; border-radius: var(--radius); border: 1px solid var(--border); padding: 14px 16px; }
.info-field .field-label { font-size: 11px; font-weight: 600; color: var(--text-muted); letter-spacing: 0.5px; text-transform: uppercase; margin-bottom: 4px; }
.info-field .field-val { font-size: 14px; font-weight: 500; color: var(--text); }
.info-field .field-edit { font-size: 11px; color: var(--navy-light); cursor: pointer; font-weight: 600; margin-top: 6px; display: inline-flex; align-items: center; gap: 4px; }
.edit-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.4); z-index: 200; display: flex; align-items: center; justify-content: center; padding: 20px; }
.edit-modal { background: #fff; border-radius: var(--radius-lg); padding: 28px; width: 400px; max-width: 100%; box-shadow: var(--shadow-lg); }
.edit-modal h3 { font-size: 16px; margin-bottom: 18px; }
.otp-note { background: var(--warn-bg); border: 1px solid var(--border-gold); border-radius: var(--radius); padding: 10px 14px; font-size: 12px; color: var(--gold); margin-bottom: 14px; }
.downloads-section { margin-top: 24px; }
.doc-item { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; background: #fff; border-radius: var(--radius); border: 1px solid var(--border); margin-bottom: 8px; }
.doc-item .doc-name { font-size: 13px; font-weight: 500; }
.doc-item .doc-meta { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.doc-icon { font-size: 22px; margin-right: 12px; }

/* ══════════════════════════════════
   LOYALTY PAGE
══════════════════════════════════ */
.tier-bar-wrap { background: var(--navy); border-radius: var(--radius-lg); padding: 24px 28px; color: #fff; margin-bottom: 24px; }
.tier-bar-wrap h2 { font-size: 16px; opacity: 0.6; font-family: 'Plus Jakarta Sans', sans-serif; font-weight: 500; margin-bottom: 4px; }
.current-tier { font-size: 28px; margin-bottom: 18px; display: flex; align-items: center; gap: 10px; }
.tier-medal { font-size: 30px; }
.tier-steps { display: flex; justify-content: space-between; margin-bottom: 8px; }
.tier-step { text-align: center; flex: 1; }
.tier-step .t-name { font-size: 10px; opacity: 0.55; text-transform: uppercase; letter-spacing: 0.5px; }
.tier-step .t-pts { font-size: 11px; font-weight: 600; margin-top: 2px; }
.tier-step.passed .t-name, .tier-step.passed .t-pts { opacity: 1; color: var(--gold-light); }
.tier-step.current .t-name, .tier-step.current .t-pts { color: #fff; opacity: 1; font-weight: 700; }
/* Tier Dots — matching reference */
.tier-dots { display: flex; justify-content: space-between; padding: 0 2px; margin-bottom: 6px; }
.tier-dot { width: 10px; height: 10px; border-radius: 50%; background: rgba(255,255,255,0.2); border: 2px solid rgba(255,255,255,0.3); }
.tier-dot.done { background: var(--gold); border-color: var(--gold-light); }
.tier-dot.active { background: #fff; border-color: #fff; box-shadow: 0 0 0 3px rgba(240,185,59,0.4); }
.progress-track { height: 8px; background: rgba(255,255,255,0.15); border-radius: 8px; margin-bottom: 8px; position: relative; }
.progress-fill { height: 100%; background: linear-gradient(90deg, var(--gold), var(--gold-light)); border-radius: 8px; transition: width 0.6s; }
.points-summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 24px; }
.points-card { background: #fff; border-radius: var(--radius); border: 1px solid var(--border); padding: 16px; }
.points-card .pc-label { font-size: 11px; color: var(--text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.4px; }
.points-card .pc-val { font-size: 22px; font-weight: 700; color: var(--navy); margin-top: 4px; }
.points-card .pc-sub { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.courses-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.course-card { background: #fff; border-radius: var(--radius); border: 1px solid var(--border); padding: 16px; }
.course-card .cc-name { font-size: 13px; font-weight: 600; color: var(--navy); margin-bottom: 8px; line-height: 1.4; }
.course-card .cc-pts { font-size: 20px; font-weight: 700; color: var(--gold); }
.course-card .cc-sub { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.course-card .cc-bar { height: 4px; background: var(--gold-pale); border-radius: 4px; margin-top: 10px; }
.course-card .cc-bar-fill { height: 100%; background: var(--gold); border-radius: 4px; }

/* ══════════════════════════════════
   PAYOUT PAGE
══════════════════════════════════ */
.payout-hero { background: var(--navy); border-radius: var(--radius-lg); padding: 24px 28px; color: #fff; margin-bottom: 24px; display: flex; align-items: flex-end; justify-content: space-between; }
.ph-label { font-size: 13px; opacity: 0.55; margin-bottom: 4px; }
.ph-amt { font-size: 36px; font-weight: 700; font-family: 'Syne', sans-serif; letter-spacing: -1px; }
.ph-sub { font-size: 12px; opacity: 0.5; margin-top: 4px; }
.bank-card-block { background: #fff; border-radius: var(--radius-lg); border: 1px solid var(--border); padding: 20px 24px; margin-bottom: 20px; }
.bank-row { display: flex; align-items: center; gap: 14px; }
.bank-icon { width: 42px; height: 42px; border-radius: 10px; background: #E8EDF7; display: flex; align-items: center; justify-content: center; font-size: 18px; flex-shrink: 0; }
.bank-row .bank-name { font-weight: 600; font-size: 15px; }
.bank-row .bank-acc { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.bank-row .bank-amt { margin-left: auto; text-align: right; }
.bank-row .bank-amt .ba-label { font-size: 11px; color: var(--text-muted); }
.bank-row .bank-amt .ba-val { font-size: 16px; font-weight: 700; color: var(--success); margin-top: 2px; }
.payout-form { background: #fff; border-radius: var(--radius-lg); border: 1px solid var(--border); padding: 20px 24px; margin-bottom: 20px; }
.payout-form h3 { font-size: 15px; margin-bottom: 16px; }
.amount-input-wrap { position: relative; }
.amount-input-wrap .rupee { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--text-muted); font-weight: 600; font-size: 16px; }
.amount-input-wrap input { padding-left: 28px !important; font-size: 18px; font-weight: 700; }
.quick-amounts { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.quick-amt { padding: 5px 12px; border: 1.5px solid var(--border); border-radius: 20px; font-size: 12px; font-weight: 600; cursor: pointer; color: var(--text-muted); transition: all 0.15s; background: #fff; }
.quick-amt:hover { border-color: var(--navy); color: var(--navy); }
.payout-notes { background: var(--warn-bg); border: 1px solid var(--border-gold); border-radius: var(--radius); padding: 14px 16px; font-size: 12px; color: var(--text-muted); line-height: 1.7; }
.payout-notes strong { color: var(--gold); }
.history-item { display: flex; align-items: center; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.history-item:last-child { border-bottom: none; }
.hi-icon { width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 14px; flex-shrink: 0; }
.hi-icon.approved { background: var(--success-bg); color: var(--success); }
.hi-icon.pending { background: var(--warn-bg); color: var(--gold); }
.hi-icon.rejected { background: var(--danger-bg); color: var(--danger); }
.hi-info .hi-label { font-size: 13px; font-weight: 500; }
.hi-info .hi-date { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.hi-amt { margin-left: auto; font-size: 15px; font-weight: 700; }
.hi-amt.approved { color: var(--success); }
.hi-amt.pending { color: var(--gold); }
.hi-amt.rejected { color: var(--danger); }

/* ══════════════════════════════════
   ADMIN PANEL
══════════════════════════════════ */
/* Stat cards */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 24px; }
.stat-card { background: #fff; border-radius: var(--radius); border: 1px solid var(--border); padding: 16px; }
.stat-card .sc-label { font-size: 11px; color: var(--text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.4px; }
.stat-card .sc-val { font-size: 26px; font-weight: 700; color: var(--navy); margin-top: 4px; font-family: 'Syne', sans-serif; }
.stat-card .sc-sub { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

/* Admin horizontal tabs (matching reference exactly) */
.admin-tabs { display: flex; gap: 0; border-bottom: 1px solid var(--border); margin-bottom: 24px; overflow-x: auto; }
.admin-tab { padding: 10px 20px; cursor: pointer; font-size: 13px; font-weight: 500; color: var(--text-muted); border-bottom: 2px solid transparent; margin-bottom: -1px; transition: all 0.15s; white-space: nowrap; }
.admin-tab:hover { color: var(--navy); }
.admin-tab.active { color: var(--navy); border-bottom-color: var(--navy); font-weight: 600; }

/* AP Table */
.ap-table { width: 100%; border-collapse: collapse; }
.ap-table th { background: var(--cream); padding: 10px 14px; text-align: left; font-size: 11px; font-weight: 700; color: var(--text-muted); letter-spacing: 0.5px; text-transform: uppercase; border-bottom: 1px solid var(--border); }
.ap-table td { padding: 12px 14px; border-bottom: 1px solid var(--border); font-size: 13px; vertical-align: middle; }
.ap-table tr:hover td { background: rgba(11,27,61,0.02); }
.ap-table tr:last-child td { border-bottom: none; }

/* Add Points inline form style (gold-tinted like reference) */
.add-points-form { background: var(--gold-pale); border: 1px solid var(--border-gold); border-radius: var(--radius); padding: 16px; margin-bottom: 16px; display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.add-points-form .apf-group { flex: 1; min-width: 140px; }

/* AP Modal */
.edit-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.4); z-index: 200; display: flex; align-items: center; justify-content: center; padding: 20px; }
.ap-modal-inner { background: #fff; border-radius: var(--radius-lg); padding: 28px; width: 540px; max-width: 100%; max-height: 90vh; overflow-y: auto; box-shadow: var(--shadow-lg); }
.ap-modal-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* ══════════════════════════════════
   TOAST
══════════════════════════════════ */
.toast { position: fixed; bottom: 28px; right: 28px; background: var(--navy); color: #fff; padding: 12px 20px; border-radius: var(--radius); font-size: 13px; font-weight: 500; z-index: 9999; box-shadow: var(--shadow-lg); transform: translateY(80px); opacity: 0; transition: all 0.3s; pointer-events: none; }
.toast.show { transform: translateY(0); opacity: 1; }
.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }
