@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Space+Grotesk:wght@500;700;900&display=swap');

:root {
    --bg-main: #050505;
    --bg-card: rgba(17, 17, 17, 0.7);
    --bg-hover: rgba(30, 30, 30, 0.8);
    
    /* Paleta KNC MKT */
    --lime: #a3e635;
    --lime-dim: rgba(163, 230, 53, 0.15);
    --lime-glow: rgba(163, 230, 53, 0.25);
    
    --gold: #fbbf24;
    --gold-dim: rgba(251, 191, 36, 0.15);
    --gold-glow: rgba(251, 191, 36, 0.2);
    
    --blue: #3b82f6;
    --blue-dim: rgba(59, 130, 246, 0.15);
    
    --red: #ef4444;
    --red-dim: rgba(239, 68, 68, 0.15);
    
    /* Textos */
    --text-primary: #f0f0f0;
    --text-dim: #9ca3af;
    
    /* Bordas & Glass */
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-highlight: rgba(255, 255, 255, 0.15);
    --shadow-premium: 0 25px 50px -12px rgba(0, 0, 0, 0.7);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', system-ui, sans-serif;
}

body {
    background-color: var(--bg-main);
    color: var(--text-primary);
    min-height: 100vh;
    background-image: 
        radial-gradient(circle at 15% 50%, rgba(163, 230, 53, 0.05), transparent 30%),
        radial-gradient(circle at 85% 30%, rgba(251, 191, 36, 0.03), transparent 30%);
    background-attachment: fixed;
    margin: 0;
}

h1, h2, h3, .logo-text, .stat-value, .btn-primary {
    font-family: 'Space Grotesk', sans-serif;
}

/* ── APP LAYOUT ─────────────────────────────────────────── */
.app-layout, .app {
    display: flex;
    min-height: 100vh;
}

/* ── SIDEBAR ──────────────────────────────────────────────── */
.sidebar {
    width: 250px;
    background: rgba(5, 5, 5, 0.85);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-right: 1px solid var(--glass-border);
    padding: 2rem 1.5rem;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 100;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 2.5rem;
}

.sidebar-logo img {
    width: 40px;
    height: 40px;
    border-radius: 8px;
}

.sidebar-logo h2, .logo-text {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 900;
    letter-spacing: -1px;
    background: linear-gradient(135deg, var(--lime), #fff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.sidebar-menu, .nav {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex: 1;
}

.menu-item, .nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 1rem 1.2rem;
    border-radius: 12px;
    color: var(--text-dim);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    border: 1px solid transparent;
}

.menu-item:hover, .nav-item:hover {
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-primary);
    transform: translateX(5px);
}

.menu-item.active, .nav-item.active {
    background: linear-gradient(90deg, var(--lime-dim), transparent);
    color: var(--lime);
    border-left: 3px solid var(--lime);
    border-radius: 0 12px 12px 0;
}

/* ── MAIN ────────────────────────────────────────────── */
.main-content, .main {
    flex: 1;
    margin-left: 250px;
    padding: 2rem 3rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 0;
    overflow-x: hidden;
}

.container {
    width: 100%;
    max-width: 1200px;
    animation: fadeIn 0.5s ease-out;
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 2rem;
    width: 100%;
}

.header h1 {
    font-size: 2.2rem;
    font-weight: 900;
    letter-spacing: -1px;
    color: var(--text-primary);
}

.header p { color: var(--text-dim); font-size: 1rem; }

/* ── CHIPS (SALDO HEADER) ─────────────────────────────────── */
.saldo-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}
.chip {
    padding: 10px 16px;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 0.8rem;
    font-weight: 600;
    border: 1px solid var(--glass-border);
    background: rgba(255,255,255,0.03);
}
.chip span { color: var(--text-dim); text-transform: uppercase; font-size: 0.7rem; letter-spacing: 1px; }
.chip strong { font-size: 1.1rem; color: var(--text-primary); }
.chip-green { background: var(--lime-dim); border-color: rgba(163, 230, 53, 0.2); }
.chip-green strong { color: var(--lime); }
.chip-red { background: var(--red-dim); border-color: rgba(239, 68, 68, 0.2); }
.chip-red strong { color: var(--red); }
.chip-blue { background: var(--blue-dim); border-color: rgba(59, 130, 246, 0.2); }
.chip-blue strong { color: var(--blue); }
.chip-orange { background: var(--gold-dim); border-color: rgba(251, 191, 36, 0.2); }
.chip-orange strong { color: var(--gold); }

/* ── PANELS ───────────────────────────────────────────────── */
.panel { display: none; width: 100%; }
.panel.active { display: block; animation: fadeIn 0.4s ease-out; }

/* ── CARDS (GLASSMORPHISM) ────────────────────────────────── */
.card, .glass-card {
    background: var(--bg-card);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 2rem;
    box-shadow: var(--shadow-premium);
    margin-bottom: 2rem;
    position: relative;
    overflow: hidden;
}

.card::before, .glass-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--glass-highlight), transparent);
}

.card-title {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
}

/* ── FORMS & INPUTS ───────────────────────────────────────── */
input, select, textarea {
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 0.8rem 1rem;
    color: var(--text-primary);
    font-size: 0.95rem;
    transition: all 0.3s ease;
    width: 100%;
    outline: none;
    color-scheme: dark;
}

input:focus, select:focus, textarea:focus {
    border-color: var(--lime);
    box-shadow: 0 0 0 3px var(--lime-glow);
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.form-group label {
    font-size: 0.85rem;
    color: var(--text-dim);
    font-weight: 600;
}

.grid, .two-col {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}

/* ── BUTTONS ──────────────────────────────────────────────── */
button, .btn-primary {
    background: linear-gradient(135deg, var(--lime), #84cc16);
    color: #000;
    border: none;
    border-radius: 12px;
    padding: 0.8rem 1.5rem;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 10px 20px -5px var(--lime-glow);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

button:hover, .btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 25px -5px var(--lime-glow);
    filter: brightness(1.1);
}

button:active, .btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    border: 1px solid var(--glass-border);
    box-shadow: none;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--glass-highlight);
    transform: translateY(-2px);
}

.btn-danger {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: #fff;
    box-shadow: 0 10px 20px -5px var(--red-dim);
}

/* ── STATS / KPIS ─────────────────────────────────────────── */
.stats-grid, .kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card, .kpi {
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    transition: transform 0.3s ease, border-color 0.3s ease;
    box-shadow: 0 10px 30px -10px rgba(0,0,0,0.5);
    position: relative;
    overflow: hidden;
}

.stat-card:hover, .kpi:hover {
    transform: translateY(-4px);
    border-color: var(--glass-highlight);
}

.stat-value, .kpi-val {
    font-size: 2rem;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -1px;
}

.stat-value.lime, .green {
    background: linear-gradient(135deg, var(--lime), #d9f99d);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 0 20px var(--lime-glow);
}

.stat-value.gold {
    background: linear-gradient(135deg, var(--gold), #fef08a);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 0 20px var(--gold-glow);
}

.stat-label, .kpi-label {
    font-size: 0.8rem;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
}

/* ── TABLES & LISTS ───────────────────────────────────────── */
table { width: 100%; border-collapse: separate; border-spacing: 0; text-align: left; }
th { padding: 1.2rem 1rem; color: var(--text-dim); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.1em; border-bottom: 1px solid var(--glass-border); font-weight: 700; }
td { padding: 1.2rem 1rem; font-size: 0.9rem; border-bottom: 1px solid rgba(255,255,255,0.03); transition: background 0.2s ease; }
tr:hover td { background: var(--bg-hover); }
tr:last-child td { border-bottom: none; }

.feed-list, .sales-list { display: flex; flex-direction: column; gap: 0.8rem; max-height: 400px; overflow-y: auto; padding-right: 0.5rem; }
.feed-item, .sale-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.2rem;
    border-radius: 12px;
    border: 1px solid var(--glass-border);
    background: rgba(255,255,255,0.02);
    transition: background 0.2s;
}
.feed-item:hover, .sale-item:hover { background: rgba(255,255,255,0.05); }

/* ── RANKING / WAR ROOM ─────────────────────────────────── */
.ranking-container { display: flex; flex-direction: column; gap: 1rem; }
.rank-card {
    display: flex;
    align-items: center;
    gap: 1.2rem;
    padding: 1.2rem 1.5rem;
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    transition: transform 0.2s;
}
.rank-card.top-1 {
    background: linear-gradient(90deg, rgba(251,191,36,0.1), transparent);
    border-color: rgba(251,191,36,0.3);
    box-shadow: 0 0 20px var(--gold-glow);
}
.rank-number { font-size: 1.5rem; font-weight: 900; color: var(--text-dim); min-width: 35px; font-family: 'Space Grotesk', sans-serif;}
.top-1 .rank-number { color: var(--gold); }

.avatar { width: 50px; height: 50px; border-radius: 50%; object-fit: cover; border: 2px solid var(--glass-border); }
.avatar-large { width: 64px; height: 64px; border-color: var(--gold); border-width: 3px; }

.rank-details { flex: 1; min-width: 0; }
.progress-container-full {
    background: rgba(0,0,0,0.5);
    height: 10px;
    border-radius: 5px;
    overflow: hidden;
    margin-top: 10px;
}
.progress-bar { height: 100%; background: linear-gradient(90deg, var(--lime), #84cc16); border-radius: 5px; transition: width 0.5s ease-out; }
.top-1 .progress-bar { background: linear-gradient(90deg, var(--gold), #fef08a); }

/* ── UTILITIES ────────────────────────────────────────────── */
.badge { padding: 0.35rem 0.75rem; border-radius: 8px; font-size: 0.7rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.05em; display: inline-block; border: 1px solid transparent; }
.badge-lime { background: var(--lime-dim); color: var(--lime); border-color: rgba(163, 230, 53, 0.2); }
.badge-gold { background: var(--gold-dim); color: var(--gold); border-color: rgba(251, 191, 36, 0.2); }

@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.1); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.2); }

@media (max-width: 768px) {
    /* Menu lateral escondido no mobile - abre com o botão hamburger */
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        box-shadow: 10px 0 30px rgba(0,0,0,0.5);
        z-index: 200;
    }
    .sidebar.open {
        transform: translateX(0);
    }
    /* Conteudo principal ocupa 100% no mobile */
    .main-content, .main {
        margin-left: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        padding: 1rem !important;
    }
    .grid, .two-col, .kpi-grid, .stats-grid {
        grid-template-columns: 1fr;
    }
    .header h1 { font-size: 1.5rem; }
    .mobile-menu-btn { display: flex !important; }
    .saldo-chips { display: none; } /* esconde chips do header no mobile pra nao poluir */
}

/* Overlay escuro quando sidebar abre no mobile */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.6);
    z-index: 199;
}
.sidebar-overlay.active { display: block; }

.mobile-menu-btn {
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(163, 230, 53, 0.1);
    border: 1px solid rgba(163, 230, 53, 0.3);
    color: var(--lime);
    width: 40px;
    height: 40px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1.3rem;
    line-height: 1;
    margin-right: 12px;
    flex-shrink: 0;
    z-index: 1000;
}
.header-left {
    display: flex;
    align-items: center;
}
