/* ============================================================
   VFS Referral Portal - Stylesheet
   ============================================================ */

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

:root {
    --primary:#4A4D4E;
    --primary2: #E60000;
    --primary-light: #25282B;
    --accent: #E60000 ;
    --accent-dark: #008A00 ;
    --danger: #BD0000;
    --warning: #EB6100;
    --info: #005EA5;
    --success: #008A00;
    --bg: #f0f4f8;
    --surface: #ffffff;
    --border: #dde3ed;
    --text: #1a202c;
    --muted:#7E7E7E;
    --sidebar-w: 260px;
    --radius: 10px;
    --shadow: 0 2px 12px rgba(0,0,0,0.08);
    --shadow-lg: 0 8px 32px rgba(0,0,0,0.12);
}

html { font-size: 16px; }
body { font-family: 'Inter', sans-serif; background: var(--bg); color: var(--text); min-height: 100vh; }

/* ---- Layout ---- */
.app-wrapper { display: flex; min-height: 100vh; }
.sidebar { width: var(--sidebar-w); background: var(--primary); color: #fff; display: flex; flex-direction: column; position: fixed; top: 0; left: 0; height: 100vh; z-index: 200; transition: transform .3s ease; }
.sidebar-header { display: flex; align-items: center; justify-content: space-between; padding: 20px 20px 16px; border-bottom: 1px solid rgba(255,255,255,.1); }
.logo { display: flex; align-items: center; gap: 10px; }
.logo-icon { width: 38px; height: 38px; background: var(--surface); border-radius: 8px; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; color: #fff; }
.logo-icon-2 { width: 38px; height: 38px;  background: var(--accent);  border-radius: 8px; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; color: #fff  }
.logo-icon-3 { width: 38px; height: 38px;  border-radius: 8px; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; color: #fff;  }

.logo-text { font-size: 18px; font-weight: 700; letter-spacing: -.3px; }
.sidebar-close { background: none; border: none; color: rgba(255,255,255,.6); font-size: 20px; cursor: pointer; display: none; }
.sidebar-nav { flex: 1; padding: 16px 12px; overflow-y: auto; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 8px; color: rgba(255,255,255,.75); text-decoration: none; font-size: 14px; font-weight: 500; margin-bottom: 2px; transition: background .15s, color .15s; }
.nav-item:hover { background: rgba(255,255,255,.1); color: #fff; }
.nav-item.active { background: var(--accent); color: #fff; }
.nav-icon { font-size: 16px; opacity: .8; }
.nav-icon-admin { font-size: 16px; opacity: .8; background-image: url('../imgs/members.png');}
.sidebar-footer { padding: 16px; border-top: 1px solid rgba(255,255,255,.1); }
.user-info { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.user-avatar { width: 36px; height: 36px; background: var(--accent); border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px; flex-shrink: 0; }
.user-name { font-size: 14px; font-weight: 600; color: #fff; }
.user-role { font-size: 12px; color: rgba(255,255,255,.6); text-transform: capitalize; }
.sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 190; }
.main-content { margin-left: var(--sidebar-w); flex: 1; display: flex; flex-direction: column; min-height: 100vh; }
.topbar { background: var(--surface); border-bottom: 1px solid var(--border); padding: 14px 24px; display: flex; align-items: center; gap: 16px; position: sticky; top: 0; z-index: 100; box-shadow: var(--shadow); }
.hamburger { display: none; background: none; border: none; font-size: 22px; cursor: pointer; color: var(--text); }
.page-title { font-size: 18px; font-weight: 600; flex: 1; }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.referral-code-badge { background: #e8f5e9; color: #2e7d32; border-radius: 20px; padding: 4px 12px; font-size: 13px; font-weight: 600; }
.content-area { flex: 1; padding: 24px; max-width: 1400px; width: 100%; margin: 0 auto; }

/* ---- Auth Pages ---- */
.auth-page { min-height: 100vh; display: flex; background: linear-gradient(135deg, var(--primary) 50%, #1a3a6b 100%); }
.auth-left { flex: 1; display: flex; align-items: center; justify-content: center; padding: 40px; }
.auth-box { background: var(--surface); border-radius: 16px; padding: 40px; width: 100%; max-width: 420px; box-shadow: var(--shadow-lg); }
.auth-logo { display: flex; align-items: center; gap: 12px; margin-bottom: 28px; }
.auth-logo .logo-icon { width: 44px; height: 44px; font-size: 15px; }
.auth-logo .logo-text { font-size: 22px; font-weight: 700; color: var(--primary); }
.auth-title { font-size: 22px; font-weight: 700; margin-bottom: 6px; color: var(--primary); }
.auth-subtitle { font-size: 14px; color: var(--muted); margin-bottom: 28px; }
.auth-right { flex: 1; display: flex; align-items: center; justify-content: center; padding: 60px; color: #fff; }
.auth-hero { max-width: 480px; }
.auth-hero h2 { font-size: 36px; font-weight: 700; line-height: 1.2; margin-bottom: 20px; }
.auth-hero p { font-size: 16px; opacity: .8; line-height: 1.7; }

/* ---- Cards ---- */
.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 24px; }
.card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; flex-wrap: wrap; gap: 12px; }
.card-title { font-size: 16px; font-weight: 600; color: var(--text); }

/* ---- Stat Cards ---- */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card { background: var(--surface); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); border-left: 4px solid var(--accent); }
.stat-card.danger { border-color: var(--danger); }
.stat-card.warning { border-color: var(--warning); }
.stat-card.info { border-color: var(--info); }
.stat-card.primary { border-color: var(--primary); }
.stat-label { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 8px; }
.stat-value { font-size: 32px; font-weight: 700; color: var(--text); line-height: 1; }
.stat-sub { font-size: 12px; color: var(--muted); margin-top: 4px; }

/* ---- Forms ---- */
.form-group { margin-bottom: 18px; }
label { display: block; font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 6px; }
input[type="text"], input[type="email"], input[type="password"], input[type="tel"], input[type="date"],
select, textarea {
    width: 100%; padding: 10px 14px; border: 1.5px solid var(--border); border-radius: 8px;
    font-size: 14px; font-family: inherit; background: #fff; color: var(--text);
    transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(0,184,148,.15); }
textarea { resize: vertical; min-height: 90px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-hint { font-size: 12px; color: var(--muted); margin-top: 4px; }

/* ---- Buttons ---- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 10px 20px; border-radius: 8px; font-size: 14px; font-weight: 600; font-family: inherit; cursor: pointer; border: 2px solid transparent; text-decoration: none; transition: background .15s, border-color .15s, opacity .15s; white-space: nowrap; }
.btn-primary { background: var(--primary2); color: #fff; border-color: var(--primary2); }
.btn-primary:hover { background: var(--primary-light); border-color: var(--primary-light); }
.btn-accent { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-accent:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
.btn-outline { background: transparent; color: rgba(255,255,255,.9); border-color: rgba(255,255,255,.4); }
.btn-outline:hover { background: rgba(255,255,255,.1); }
.btn-outline-dark { background: transparent; color: var(--text); border-color: var(--border); }
.btn-outline-dark:hover { background: var(--bg); }
.btn-danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-sm { padding: 6px 14px; font-size: 13px; }
.btn-lg { padding: 13px 28px; font-size: 16px; width: 100%; }
.btn-whatsapp { background: #25d366; color: #fff; border-color: #25d366; }
.btn-whatsapp:hover { background: #1da851; border-color: #1da851; }
.btn[disabled], .btn:disabled { opacity: .6; cursor: not-allowed; }

/* ---- Tables ---- */
.table-wrapper { overflow-x: auto; border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
thead tr { background: #f7fafc; }
th { padding: 12px 14px; text-align: left; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); border-bottom: 2px solid var(--border); white-space: nowrap; }
td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: #f7fafc; }
.text-muted { color: var(--muted); font-size: 12px; }

/* ---- Badges / Status ---- */
.badge { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 20px; font-size: 12px; font-weight: 600; }
.badge-pending { background: #fff8e1; color: #f57f17; }
.badge-contacted { background: #e3f2fd; color: #1565c0; }
.badge-won { background: #e8f5e9; color: #2e7d32; }
.badge-loss { background: #ffebee; color: #c62828; }
.badge-admin { background: #f3e5f5; color: #6a1b9a; }
.badge-staff { background: #e0f2f1; color: #00695c; }
.badge-active { background: #e8f5e9; color: #2e7d32; }
.badge-inactive { background: #fafafa; color: #757575; }

/* ---- Alerts ---- */
.alert { padding: 14px 18px; border-radius: 8px; margin-bottom: 20px; font-size: 14px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.alert-success { background: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
.alert-error, .alert-danger { background: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }
.alert-info { background: #d1ecf1; color: #0c5460; border: 1px solid #bee5eb; }
.alert-close { background: none; border: none; cursor: pointer; font-size: 16px; opacity: .6; }

/* ---- Referral Link Box ---- */
.referral-link-box { background: linear-gradient(135deg, var(--primary), var(--primary-light)); color: #fff; border-radius: var(--radius); padding: 24px; margin-bottom: 24px; }
.referral-link-box h3 { font-size: 15px; font-weight: 600; margin-bottom: 6px; opacity: .85; }
.referral-code-display { font-size: 26px; font-weight: 700; letter-spacing: 2px; margin-bottom: 12px; }
.referral-url-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.referral-url { background: rgba(255,255,255,.15); border-radius: 6px; padding: 8px 14px; font-size: 13px; font-family: monospace; color: rgba(255,255,255,.9); flex: 1; word-break: break-all; }
.btn-copy { background: rgba(255,255,255,.2); color: #fff; border: 1px solid rgba(255,255,255,.3); padding: 8px 16px; border-radius: 6px; font-size: 13px; font-weight: 600; cursor: pointer; }
.btn-copy:hover { background: rgba(255,255,255,.3); }

/* ---- Charts ---- */
.charts-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 24px; }
.chart-card { background: var(--surface); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.chart-title { font-size: 14px; font-weight: 600; margin-bottom: 16px; color: var(--text); }
canvas { max-height: 280px; }

/* ---- Modal ---- */
.modal-backdrop { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 1000; align-items: center; justify-content: center; padding: 20px; }
.modal-backdrop.open { display: flex; }
.modal { background: var(--surface); border-radius: 14px; padding: 28px; width: 100%; max-width: 540px; max-height: 90vh; overflow-y: auto; box-shadow: var(--shadow-lg); animation: modalIn .2s ease; }
@keyframes modalIn { from { transform: scale(.95); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.modal-title { font-size: 18px; font-weight: 700; }
.modal-close { background: none; border: none; font-size: 22px; cursor: pointer; color: var(--muted); }

/* ---- Filters ---- */
.filters-bar { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; margin-bottom: 20px; }
.filter-group { display: flex; flex-direction: column; gap: 4px; min-width: 150px; flex: 1; }
.filter-group label { font-size: 12px; font-weight: 600; color: var(--muted); }
.filter-group select, .filter-group input { padding: 8px 12px; font-size: 13px; }

/* ---- Misc ---- */
.empty-state { text-align: center; padding: 60px 20px; color: var(--muted); }
.empty-state-icon { font-size: 48px; margin-bottom: 12px; opacity: .4; }
.divider { margin: 20px 0; border: none; border-top: 1px solid var(--border); }
.top-staff-table td:first-child { font-weight: 600; }
.chart-three { grid-column: span 2; }
.actions-row { display: flex; gap: 8px; flex-wrap: wrap; }
.badge-pill { display: inline-block; width: 32px; height: 32px; border-radius: 50%; background: var(--accent); color: #fff; font-weight: 700; font-size: 13px; text-align: center; line-height: 32px; }
.download-btn-wrapper { text-align: right; margin-bottom: 20px; }
.page-header { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin-bottom: 24px; }
.page-header h2 { font-size: 18px; font-weight: 700; }

/* ---- Responsive ---- */
@media (max-width: 900px) {
    .charts-grid { grid-template-columns: 1fr; }
    .chart-three { grid-column: span 1; }
}
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .sidebar-close { display: block; }
    .sidebar-overlay.open { display: block; }
    .hamburger { display: block; }
    .main-content { margin-left: 0; }
    .form-row { grid-template-columns: 1fr; }
    .auth-right { display: none; }
    table { min-width: 600px; }
    .content-area { padding: 16px; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .auth-box { padding: 28px 20px; }
}

/* ---- Public referral form ---- */
.public-page { min-height: 100vh; background: linear-gradient(135deg, var(--primary) 0%, #1a3a6b 100%); display: flex; align-items: center; justify-content: center; padding: 30px 16px; }
.public-card { background: var(--surface); border-radius: 16px; padding: 36px; width: 100%; max-width: 560px; box-shadow: var(--shadow-lg); }
.public-header { text-align: center; margin-bottom: 28px; }
.public-header .logo-icon { width: 52px; height: 52px; font-size: 16px; margin: 0 auto 12px; }
.public-header h1 { font-size: 22px; font-weight: 700; color: var(--primary); margin-bottom: 4px; }
.public-header p { font-size: 14px; color: var(--muted); }
.referred-by { background: #f0f4ff; border-radius: 8px; padding: 12px 16px; margin-bottom: 24px; align-content: center; align-items: center; font-size: 13px; color: var(--primary); font-weight: 500; }

/* ---- Print / download ---- */
@media print { .sidebar, .topbar, .hamburger, .btn { display: none !important; } .main-content { margin: 0; } }
