/* ============================================
   RESET & BASE
============================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #0a0e17;
    color: #e4e8ef;
    min-height: 100vh;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ============================================
   LOGIN OVERLAY
============================================ */
.login-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(10, 14, 23, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.login-overlay.hidden {
    display: none;
}

.login-card {
    background: #111e30;
    padding: 40px;
    border-radius: 16px;
    border: 1px solid #2a4a7a;
    max-width: 400px;
    width: 90%;
    text-align: center;
}

.login-card h2 {
    font-size: 1.8rem;
    margin-bottom: 10px;
    color: #f7971e;
}

.login-card p {
    color: #8aa4c8;
    margin-bottom: 20px;
}

.login-card input {
    width: 100%;
    padding: 12px 16px;
    border-radius: 8px;
    border: 1px solid #2a4a7a;
    background: #0a1628;
    color: #fff;
    font-size: 1rem;
    margin-bottom: 15px;
}

.login-card input:focus {
    outline: none;
    border-color: #f7971e;
}

.login-card button {
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: 8px;
    background: #f7971e;
    color: #0a0e17;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s;
}

.login-card button:hover {
    background: #e08a1a;
}

.login-error {
    color: #ff6b6b;
    margin-top: 12px;
    font-size: 0.9rem;
}

.login-error.hidden {
    display: none;
}

/* ============================================
   HEADER
============================================ */
header {
    background: #111e30;
    padding: 15px 0;
    border-bottom: 1px solid #1a3050;
}

header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

header h1 {
    font-size: 1.5rem;
    color: #f7971e;
}

.badge {
    background: #f7971e;
    color: #0a0e17;
    padding: 2px 12px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 600;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

.btn-logout {
    background: transparent;
    border: 1px solid #ff6b6b;
    color: #ff6b6b;
    padding: 6px 14px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.3s;
}

.btn-logout:hover {
    background: #ff6b6b;
    color: #0a0e17;
}

/* ============================================
   STATS GRID
============================================ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    padding: 25px 20px;
    max-width: 1400px;
    margin: 0 auto;
}

.stat-card {
    background: #111e30;
    border-radius: 12px;
    padding: 18px 20px;
    border: 1px solid #1a3050;
    display: flex;
    align-items: center;
    gap: 14px;
    transition: border-color 0.3s;
}

.stat-card:hover {
    border-color: #2a4a7a;
}

.stat-icon {
    font-size: 2rem;
}

.stat-info {
    display: flex;
    flex-direction: column;
}

.stat-label {
    font-size: 0.8rem;
    color: #8aa4c8;
}

.stat-value {
    font-size: 1.6rem;
    font-weight: 700;
    color: #fff;
}

/* ============================================
   TABS
============================================ */
.tabs-section {
    background: #0f1a2e;
    padding: 12px 0;
    border-bottom: 1px solid #1a3050;
}

.tabs {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.tab-btn {
    background: transparent;
    color: #8aa4c8;
    border: 1px solid #1a3050;
    padding: 8px 20px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s;
}

.tab-btn:hover {
    background: #1a3050;
    color: #fff;
}

.tab-btn.active {
    background: #f7971e;
    color: #0a0e17;
    border-color: #f7971e;
}

/* ============================================
   TAB CONTENT
============================================ */
.tab-content {
    padding: 25px 0;
}

.tab-panel {
    display: none;
}

.tab-panel.active {
    display: block;
}

.tab-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 18px;
    flex-wrap: wrap;
    gap: 10px;
}

.tab-header h2 {
    font-size: 1.3rem;
}

.btn-refresh {
    background: transparent;
    border: 1px solid #2a4a7a;
    color: #8aa4c8;
    padding: 6px 16px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-refresh:hover {
    background: #2a4a7a;
    color: #fff;
}

/* ============================================
   TABLE
============================================ */
.table-container {
    background: #111e30;
    border-radius: 12px;
    border: 1px solid #1a3050;
    overflow: hidden;
    overflow-x: auto;
    padding: 16px;
}

.table-container table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
    min-width: 600px;
}

.table-container th {
    text-align: left;
    padding: 12px 14px;
    color: #8aa4c8;
    font-weight: 600;
    border-bottom: 1px solid #1a3050;
}

.table-container td {
    padding: 10px 14px;
    border-bottom: 1px solid #0f1a2e;
}

.table-container tr:hover td {
    background: #0f1a2e;
}

.table-container .empty {
    text-align: center;
    padding: 40px;
    color: #5a7a9a;
}

.loading {
    text-align: center;
    padding: 40px;
    color: #5a7a9a;
}

/* ============================================
   CHART
============================================ */
.chart-container {
    background: #111e30;
    border-radius: 12px;
    border: 1px solid #1a3050;
    padding: 20px;
    height: 300px;
    position: relative;
}

/* ============================================
   REFERRAL STATS CARDS
============================================ */
.ref-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 16px;
    padding: 16px;
}

.ref-stat-card {
    background: #0f1a2e;
    border-radius: 10px;
    padding: 16px;
    text-align: center;
    border: 1px solid #1a3050;
}

.ref-stat-card .ref-value {
    font-size: 1.8rem;
    font-weight: 700;
    color: #f7971e;
}

.ref-stat-card .ref-label {
    font-size: 0.8rem;
    color: #8aa4c8;
    margin-top: 4px;
}

/* Rank medals */
.rank-1 { color: #ffd700; font-weight: 700; }
.rank-2 { color: #c0c0c0; font-weight: 700; }
.rank-3 { color: #cd7f32; font-weight: 700; }

/* Plan badges */
.plan-premium {
    background: #f7971e;
    color: #0a0e17;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}

.plan-free {
    background: #1a3050;
    color: #8aa4c8;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
}

/* ============================================
   LOGIN LINKS
============================================ */
.login-links {
    margin-top: 12px;
    text-align: center;
}

.btn-forgot {
    background: transparent;
    border: none;
    color: #8aa4c8;
    cursor: pointer;
    font-size: 0.85rem;
    text-decoration: underline;
    transition: color 0.3s;
    width: auto;
    padding: 0;
}

.btn-forgot:hover {
    color: #f7971e;
    background: transparent;
}

/* ============================================
   RESPONSIVE
============================================ */
@media (max-width: 768px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        padding: 15px;
    }

    .stat-value {
        font-size: 1.2rem;
    }

    .tabs {
        gap: 6px;
    }

    .tab-btn {
        padding: 6px 14px;
        font-size: 0.8rem;
    }

    .header-left h1 {
        font-size: 1.2rem;
    }

    .chart-container {
        height: 220px;
    }
}

/* PIN input styling */
#pinInput {
    letter-spacing: 8px;
    font-size: 1.2rem;
    text-align: center;
}