/* ===== Infexor Partner Dashboard — Premium Orange Theme ===== */
:root {
    --orange: #f97316;
    --orange-dark: #ea580c;
    --orange-light: #fed7aa;
    --orange-bg: #fff7ed;
    --bg: #fafafa;
    --bg-card: #ffffff;
    --bg-sidebar: #1a1a2e;
    --border: #e5e7eb;
    --text: #1f2937;
    --text-muted: #6b7280;
    --text-light: #9ca3af;
    --success: #22c55e;
    --danger: #ef4444;
    --info: #3b82f6;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -2px rgba(0,0,0,0.05);
    --shadow-lg: 0 10px 25px -3px rgba(0,0,0,0.08), 0 4px 6px -4px rgba(0,0,0,0.05);
    --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: var(--font); background: var(--bg); color: var(--text); min-height: 100vh; }

/* ===== LOGIN ===== */
.login-screen {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    padding: 1rem;
    position: relative;
    overflow: hidden;
}
.login-screen::before {
    content: '';
    position: absolute;
    width: 600px; height: 600px;
    background: radial-gradient(circle, rgba(249,115,22,0.15) 0%, transparent 70%);
    top: -200px; right: -100px;
    animation: float 8s ease-in-out infinite;
}
.login-screen::after {
    content: '';
    position: absolute;
    width: 400px; height: 400px;
    background: radial-gradient(circle, rgba(249,115,22,0.1) 0%, transparent 70%);
    bottom: -100px; left: -50px;
    animation: float 6s ease-in-out infinite reverse;
}
@keyframes float { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-30px); } }

.login-card {
    background: rgba(255,255,255,0.05);
    backdrop-filter: blur(24px);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 24px;
    padding: 3rem 2.5rem;
    width: 100%;
    max-width: 420px;
    position: relative;
    z-index: 1;
    animation: fadeUp 0.6s ease;
}
@keyframes fadeUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }

.login-logo { text-align: center; margin-bottom: 2rem; }
.login-logo-icon { margin-bottom: 1rem; }
.login-logo h1 { color: #fff; font-size: 1.6rem; font-weight: 700; }
.login-logo h1 span { color: var(--orange); }
.login-logo p { color: rgba(255,255,255,0.5); font-size: 0.85rem; margin-top: 0.3rem; }

.input-group { margin-bottom: 1rem; }
.phone-input { display: flex; align-items: center; background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.15); border-radius: 12px; overflow: hidden; transition: border-color 0.3s; }
.phone-input:focus-within { border-color: var(--orange); }
.phone-prefix { padding: 0.85rem 0.75rem; color: var(--orange); font-weight: 600; font-size: 0.95rem; border-right: 1px solid rgba(255,255,255,0.1); }
.phone-input input { flex: 1; background: none; border: none; color: #fff; padding: 0.85rem; font-size: 1rem; outline: none; font-family: var(--font); }
.phone-input input::placeholder { color: rgba(255,255,255,0.3); }

.form-input { width: 100%; background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.15); border-radius: 12px; color: #fff; padding: 0.85rem; font-size: 0.95rem; outline: none; font-family: var(--font); transition: border-color 0.3s; }
.form-input:focus { border-color: var(--orange); }
.form-input::placeholder { color: rgba(255,255,255,0.3); }

.btn-primary { width: 100%; padding: 0.85rem; background: linear-gradient(135deg, var(--orange), var(--orange-dark)); color: #fff; border: none; border-radius: 12px; font-size: 1rem; font-weight: 600; cursor: pointer; font-family: var(--font); transition: transform 0.2s, box-shadow 0.2s; display: flex; align-items: center; justify-content: center; gap: 0.5rem; }
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 8px 20px rgba(249,115,22,0.3); }
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

.btn-loader { width: 18px; height: 18px; border: 2px solid rgba(255,255,255,0.3); border-top-color: #fff; border-radius: 50%; animation: spin 0.6s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.btn-text { background: none; border: none; color: rgba(255,255,255,0.5); font-size: 0.85rem; cursor: pointer; padding: 0.5rem; font-family: var(--font); }
.btn-text:hover { color: var(--orange); }

.login-note { text-align: center; color: rgba(255,255,255,0.35); font-size: 0.75rem; margin-top: 1rem; }

.otp-sent-msg { color: rgba(255,255,255,0.6); font-size: 0.85rem; text-align: center; margin-bottom: 1.5rem; }
.otp-sent-msg strong { color: var(--orange); }

.otp-inputs { display: flex; gap: 0.75rem; justify-content: center; margin-bottom: 1.5rem; }
.otp-box { width: 52px; height: 56px; text-align: center; font-size: 1.4rem; font-weight: 700; color: #fff; background: rgba(255,255,255,0.08); border: 1.5px solid rgba(255,255,255,0.15); border-radius: 12px; outline: none; font-family: var(--font); transition: border-color 0.3s; }
.otp-box:focus { border-color: var(--orange); background: rgba(249,115,22,0.08); }

.login-error { background: rgba(239,68,68,0.1); border: 1px solid rgba(239,68,68,0.3); color: #fca5a5; padding: 0.75rem 1rem; border-radius: 10px; font-size: 0.85rem; margin-top: 1rem; text-align: center; }

/* ===== TOP NAV ===== */
.top-nav { position: fixed; top: 0; left: 0; right: 0; height: 60px; background: var(--bg-card); border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; padding: 0 1.5rem; z-index: 100; }
.top-nav-left { display: flex; align-items: center; gap: 0.75rem; }
.top-nav-title { font-size: 1.1rem; font-weight: 700; color: var(--text); }
.top-nav-title span { color: var(--orange); }
.mobile-menu-btn { display: none; background: none; border: none; color: var(--text); cursor: pointer; padding: 0.25rem; }
.top-nav-right { display: flex; align-items: center; gap: 1rem; }
.notif-btn { background: none; border: none; cursor: pointer; position: relative; color: var(--text-muted); padding: 0.25rem; }
.notif-badge { position: absolute; top: -4px; right: -4px; background: var(--danger); color: #fff; font-size: 0.6rem; font-weight: 700; padding: 1px 5px; border-radius: 10px; min-width: 16px; text-align: center; }
.user-avatar { width: 34px; height: 34px; background: linear-gradient(135deg, var(--orange), var(--orange-dark)); border-radius: 50%; display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 700; font-size: 0.85rem; cursor: pointer; }

/* ===== LAYOUT ===== */
.app-layout { display: flex; margin-top: 60px; min-height: calc(100vh - 60px); }

/* ===== SIDEBAR ===== */
.sidebar { width: 240px; background: var(--bg-card); border-right: 1px solid var(--border); padding: 1rem 0.75rem; position: fixed; top: 60px; bottom: 0; display: flex; flex-direction: column; overflow-y: auto; z-index: 90; }
.sidebar-nav { flex: 1; display: flex; flex-direction: column; gap: 4px; }
.nav-item { display: flex; align-items: center; gap: 0.75rem; padding: 0.65rem 0.85rem; border: none; background: none; border-radius: var(--radius-sm); color: var(--text-muted); font-size: 0.875rem; font-weight: 500; cursor: pointer; font-family: var(--font); transition: all 0.2s; width: 100%; text-align: left; }
.nav-item:hover { background: var(--orange-bg); color: var(--orange); }
.nav-item.active { background: linear-gradient(135deg, var(--orange), var(--orange-dark)); color: #fff; box-shadow: 0 4px 12px rgba(249,115,22,0.25); }
.nav-item.active svg { stroke: #fff; }
.logout-item { margin-top: auto; color: var(--danger); }
.logout-item:hover { background: rgba(239,68,68,0.08); color: var(--danger); }

/* ===== MAIN CONTENT ===== */
.main-content { flex: 1; margin-left: 240px; padding: 1.5rem; max-width: 100%; overflow-x: hidden; }

/* ===== BOTTOM NAV (Hidden Top/Desktop) ===== */
.bottom-nav { display: none; }

/* ===== CARDS ===== */
.page-header { margin-bottom: 1.5rem; }
.page-header h1 { font-size: 1.5rem; font-weight: 800; color: var(--text); }
.page-header p { color: var(--text-muted); font-size: 0.85rem; margin-top: 0.25rem; }


.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.stat-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem; transition: transform 0.2s, box-shadow 0.2s; }
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.stat-card-label { font-size: 0.75rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; font-weight: 600; }
.stat-card-value { font-size: 1.75rem; font-weight: 800; margin-top: 0.25rem; color: var(--text); }
.stat-card-value.orange { color: var(--orange); }
.stat-card-value.green { color: var(--success); }
.stat-card-sub { font-size: 0.75rem; color: var(--text-muted); margin-top: 0.25rem; }

.card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem; margin-bottom: 1rem; }
.card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; }
.card-title { font-size: 1rem; font-weight: 700; }

/* ===== REFERRAL LINK BOX ===== */
.referral-box { background: linear-gradient(135deg, var(--orange), var(--orange-dark)); border-radius: var(--radius); padding: 1.5rem; color: #fff; margin-bottom: 1.5rem; position: relative; overflow: hidden; }
.referral-box::before { content: ''; position: absolute; width: 200px; height: 200px; background: rgba(255,255,255,0.08); border-radius: 50%; top: -60px; right: -40px; }
.referral-box h3 { font-size: 0.9rem; font-weight: 600; opacity: 0.9; margin-bottom: 0.5rem; }
.referral-link { display: flex; gap: 0.5rem; align-items: center; }
.referral-link input { flex: 1; background: rgba(255,255,255,0.2); border: 1px solid rgba(255,255,255,0.3); border-radius: 8px; padding: 0.6rem 0.75rem; color: #fff; font-size: 0.85rem; font-family: var(--font); outline: none; }
.referral-link button { background: rgba(255,255,255,0.2); border: 1px solid rgba(255,255,255,0.3); border-radius: 8px; padding: 0.6rem 0.85rem; color: #fff; font-size: 0.8rem; font-weight: 600; cursor: pointer; font-family: var(--font); transition: background 0.2s; white-space: nowrap; }
.referral-link button:hover { background: rgba(255,255,255,0.3); }

/* ===== TABLE ===== */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
th { text-align: left; padding: 0.75rem 1rem; background: var(--bg); color: var(--text-muted); font-weight: 600; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; border-bottom: 1px solid var(--border); }
td { padding: 0.75rem 1rem; border-bottom: 1px solid var(--border); color: var(--text); }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--orange-bg); }

/* Badges */
.badge { display: inline-block; padding: 2px 10px; border-radius: 20px; font-size: 0.7rem; font-weight: 600; text-transform: capitalize; }
.badge-new { background: #dbeafe; color: #2563eb; }
.badge-in-progress, .badge-in_progress { background: #fed7aa; color: #ea580c; }
.badge-completed { background: #bbf7d0; color: #16a34a; }
.badge-rejected { background: #fecaca; color: #dc2626; }
.badge-pending { background: #fed7aa; color: #ea580c; }
.badge-approved { background: #bbf7d0; color: #16a34a; }
.badge-bronze { background: #f4e4c1; color: #92400e; }
.badge-silver { background: #e5e7eb; color: #4b5563; }
.badge-gold { background: #fef3c7; color: #92400e; }
.badge-platinum { background: #ede9fe; color: #7c3aed; }

/* ===== FORM ===== */
.form-group { margin-bottom: 1rem; }
.form-label { display: block; font-size: 0.8rem; font-weight: 600; color: var(--text-muted); margin-bottom: 0.35rem; text-transform: uppercase; letter-spacing: 0.03em; }
.form-control { width: 100%; padding: 0.7rem 0.85rem; border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 0.9rem; font-family: var(--font); background: var(--bg-card); color: var(--text); outline: none; transition: border-color 0.3s; }
.form-control:focus { border-color: var(--orange); box-shadow: 0 0 0 3px rgba(249,115,22,0.1); }
textarea.form-control { resize: vertical; min-height: 80px; }

.btn-orange { display: inline-flex; align-items: center; gap: 0.5rem; padding: 0.6rem 1.25rem; background: linear-gradient(135deg, var(--orange), var(--orange-dark)); color: #fff; border: none; border-radius: var(--radius-sm); font-size: 0.85rem; font-weight: 600; cursor: pointer; font-family: var(--font); transition: transform 0.2s, box-shadow 0.2s; }
.btn-orange:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(249,115,22,0.3); }

.btn-outline { display: inline-flex; align-items: center; gap: 0.5rem; padding: 0.6rem 1.25rem; background: var(--bg-card); color: var(--text); border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 0.85rem; font-weight: 500; cursor: pointer; font-family: var(--font); transition: all 0.2s; }
.btn-outline:hover { border-color: var(--orange); color: var(--orange); }

/* ===== LEADERBOARD ===== */
.leaderboard-item { display: flex; align-items: center; gap: 0.75rem; padding: 0.65rem 0; border-bottom: 1px solid var(--border); }
.leaderboard-item:last-child { border-bottom: none; }
.leaderboard-rank { width: 28px; height: 28px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 0.75rem; font-weight: 700; }
.leaderboard-rank.top1 { background: #fef3c7; color: #92400e; }
.leaderboard-rank.top2 { background: #e5e7eb; color: #4b5563; }
.leaderboard-rank.top3 { background: #f4e4c1; color: #92400e; }
.leaderboard-rank.other { background: var(--bg); color: var(--text-muted); }
.leaderboard-info { flex: 1; }
.leaderboard-name { font-weight: 600; font-size: 0.85rem; }
.leaderboard-badge { font-size: 0.7rem; color: var(--text-muted); }
.leaderboard-earnings { font-weight: 700; color: var(--orange); font-size: 0.9rem; }

/* ===== EMPTY STATE ===== */
.empty-state { text-align: center; padding: 3rem 1rem; color: var(--text-muted); }
.empty-state svg { margin-bottom: 1rem; opacity: 0.3; }
.empty-state h3 { font-size: 1rem; color: var(--text); margin-bottom: 0.3rem; }
.empty-state p { font-size: 0.85rem; }

/* ===== TOAST ===== */
.toast-container { position: fixed; bottom: 1.5rem; right: 1.5rem; z-index: 9999; display: flex; flex-direction: column; gap: 0.5rem; }
.toast { display: flex; align-items: center; gap: 0.75rem; padding: 0.85rem 1.25rem; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); font-size: 0.85rem; animation: slideIn 0.3s ease; min-width: 280px; }
.toast.success { border-left: 3px solid var(--success); }
.toast.error { border-left: 3px solid var(--danger); }
.toast.info { border-left: 3px solid var(--info); }
@keyframes slideIn { from { opacity: 0; transform: translateX(50px); } to { opacity: 1; transform: translateX(0); } }

/* ===== MOBILE ===== */
@media (max-width: 768px) {
    .mobile-menu-btn { display: none !important; }
    .sidebar { display: none !important; }
    .main-content { margin-left: 0; padding: 1rem; padding-bottom: calc(75px + env(safe-area-inset-bottom, 0px)); }
    
    /* Bottom Navigation Styles */
    .bottom-nav {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: var(--bg-card);
        border-top: 1px solid var(--border);
        z-index: 100;
        justify-content: space-around;
        align-items: center;
        height: 65px;
        padding-bottom: env(safe-area-inset-bottom, 0px);
        box-shadow: 0 -4px 20px rgba(0,0,0,0.06);
    }
    
    .bnav-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 4px;
        width: 100%;
        height: 100%;
        border: none;
        background: transparent;
        color: var(--text-muted);
        cursor: pointer;
        transition: all 0.2s ease;
        padding: 0;
        margin: 0;
        outline: none;
        -webkit-tap-highlight-color: transparent;
    }
    
    .bnav-item svg { stroke: currentColor; opacity: 0.7; transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1); }
    .bnav-item span { font-size: 0.65rem; font-weight: 600; transition: opacity 0.2s; font-family: var(--font); }
    
    .bnav-item.active { color: var(--orange); }
    .bnav-item.active svg { opacity: 1; transform: scale(1.15) translateY(-2px); stroke-width: 2.2; stroke: var(--orange); stroke-linecap: round; stroke-linejoin: round; }
    .bnav-item.active span { opacity: 1; font-weight: 700; transform: translateY(-1px); }

    /* Tables to Card Lists on Mobile (When JS uses tables) */
    .table-wrap table { border: 0; display: block; }
    .table-wrap thead { display: none; }
    .table-wrap tbody, .table-wrap tr, .table-wrap td { display: block; width: 100%; }
    .table-wrap tr { margin-bottom: 0.8rem; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 0.5rem; overflow: hidden; }
    .table-wrap td { padding: 0.6rem 0.5rem; text-align: left; border-bottom: 1px dashed var(--border); display: flex; justify-content: space-between; align-items: center; }
    .table-wrap tr td:last-child { border-bottom: none; }
    .table-wrap td::before { content: attr(data-label); font-weight: 600; font-size: 0.7rem; color: var(--text-muted); text-transform: uppercase; float: left; text-align: left; display: block; }
    
    .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 0.75rem; margin-bottom: 1rem; }
    .stat-card { padding: 1rem; }
    .stat-card-value { font-size: 1.4rem; }
    .otp-inputs { gap: 0.5rem; }
    .otp-box { width: 44px; height: 48px; font-size: 1.2rem; }
    .login-card { padding: 2rem 1.5rem; border-radius: 20px; }
    .card { padding: 1rem; margin-bottom: 1rem; border-radius: 16px; }
    .top-nav { padding: 0 1rem; }
}

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