/* =========================================
   Democratics — Base Shared Styles
   ========================================= */

/* --- Font Import (en base, no repetida) --- */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;600;800&display=swap');

/* --- CSS Variables (Theme tokens) --- */
:root {
    --bg-dark: #0B0E14;
    --bg-panel: #151A25;
    --accent-primary: #4F46E5;
    --accent-secondary: #0EA5E9;
    --text-main: #FFFFFF;
    --text-muted: #CBD5E1;
    --border-color: rgba(255, 255, 255, 0.05);
    --scrollbar-thumb: rgba(255, 255, 255, 0.1);
    --sidebar-width: 240px;
    --topbar-height: 56px;
    /* Sidebar gradient */
    --sidebar-bg-start: #1a1f35;
    --sidebar-bg-end: #0d1020;
    --sidebar-text: #FFFFFF;
    --sidebar-text-muted: rgba(255, 255, 255, 0.6);
    --sidebar-item-hover: rgba(255, 255, 255, 0.1);
    --sidebar-item-active: rgba(79, 70, 229, 0.25);
    --sidebar-dot-active: #4F46E5;
}

[data-theme="light"] {
    --bg-dark: #F1F5F9;
    --bg-panel: #FFFFFF;
    --text-main: #0F172A;
    --text-muted: #334155;
    --border-color: rgba(0, 0, 0, 0.08);
    --scrollbar-thumb: rgba(0, 0, 0, 0.15);
    /* Sidebar gradient light */
    --sidebar-bg-start: #2d3561;
    --sidebar-bg-end: #1a1f3a;
    --sidebar-text: #FFFFFF;
    --sidebar-text-muted: rgba(255, 255, 255, 0.6);
    --sidebar-item-hover: rgba(255, 255, 255, 0.1);
    --sidebar-item-active: rgba(79, 70, 229, 0.3);
    --sidebar-dot-active: #4F46E5;
}

/* --- Reset & Body --- */
*, *::before, *::after { box-sizing: border-box; }

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: 'Outfit', sans-serif;
    margin: 0;
    padding: 0;
    min-height: 100vh;
}

/* --- Layout App Shell --- */
.app-shell {
    display: flex;
    min-height: 100vh;
}

/* --- Sidebar --- */
.sidebar {
    width: var(--sidebar-width);
    background: linear-gradient(180deg, var(--sidebar-bg-start), var(--sidebar-bg-end));
    border-right: none;
    padding: 1.5rem 1rem;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 1100;
    transition: transform 0.3s ease;
    overflow-y: auto;
    border-radius: 0 24px 24px 0;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1099;
}

.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    overflow-y: auto;
    min-height: 100vh;
    padding: 1.5rem;
}

/* --- Mobile topbar --- */
.mobile-topbar {
    display: none;
    position: sticky;
    top: 0;
    z-index: 1050;
    background: var(--bg-dark);
    border-bottom: 1px solid var(--border-color);
    padding: 0.75rem 1rem;
    align-items: center;
    justify-content: space-between;
}

.hamburger-btn {
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.2rem;
    transition: all 0.2s;
}

.hamburger-btn:hover { border-color: var(--accent-primary); }

/* --- Brand --- */
.brand {
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: 1px;
    margin-bottom: 2rem;
    color: var(--sidebar-text);
    display: flex;
    align-items: center;
    gap: 10px;
}

.brand .brand-icon {
    width: 36px;
    height: 36px;
    background: rgba(79, 70, 229, 0.3);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
}

/* --- Nav Items --- */
.nav-item {
    color: var(--sidebar-text-muted);
    text-decoration: none;
    padding: 0.75rem 1rem;
    margin-bottom: 0.3rem;
    border-radius: 12px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.9rem;
    font-weight: 500;
    position: relative;
}

.nav-item:hover {
    background: var(--sidebar-item-hover);
    color: var(--sidebar-text);
}

.nav-item.active {
    background: var(--sidebar-item-active);
    color: var(--sidebar-text);
    border-left: none;
    font-weight: 600;
}

/* Active dot indicator */
.nav-item.active::after {
    content: '';
    width: 8px;
    height: 8px;
    background: var(--sidebar-dot-active);
    border-radius: 50%;
    position: absolute;
    right: 12px;
    box-shadow: 0 0 8px var(--sidebar-dot-active);
}

.nav-item i {
    font-size: 1.1rem;
    width: 22px;
    text-align: center;
}

/* --- Theme Toggle --- */
.theme-toggle {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--sidebar-text);
    width: 38px;
    height: 38px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-bottom: 1.5rem;
}

.theme-toggle:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.2);
}

/* Mobile topbar theme toggle uses page colors */
.mobile-topbar .theme-toggle {
    background: var(--bg-panel);
    border-color: var(--border-color);
    color: var(--text-main);
}

/* --- Cards --- */
.stat-card {
    background: var(--bg-panel);
    border-radius: 16px;
    padding: 1.25rem;
    position: relative;
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.content-card {
    background: var(--bg-panel);
    border-radius: 16px;
    padding: 1.5rem;
    border: 1px solid var(--border-color);
}

/* --- Buttons --- */
.btn-primary-custom {
    background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary));
    color: white;
    border: none;
    border-radius: 12px;
    padding: 0.65rem 1.4rem;
    font-weight: 600;
    font-family: 'Outfit', sans-serif;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary-custom:hover {
    box-shadow: 0 4px 15px rgba(79, 70, 229, 0.4);
    transform: translateY(-1px);
}

.btn-primary-custom:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* --- State Badges (Votantes) --- */
.badge-estado {
    padding: 0.35rem 0.7rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.82rem;
    white-space: nowrap;
}

.badge-comprometido { background: rgba(16, 185, 129, 0.1); color: #10b981; border: 1px solid rgba(16, 185, 129, 0.3); }
.badge-duda { background: rgba(245, 158, 11, 0.1); color: #f59e0b; border: 1px solid rgba(245, 158, 11, 0.3); }
.badge-no-comprometido { background: rgba(239, 68, 68, 0.1); color: #ef4444; border: 1px solid rgba(239, 68, 68, 0.3); }

/* --- Scrollbar --- */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--scrollbar-thumb); border-radius: 10px; }

/* ==========================================
   RESPONSIVE BREAKPOINTS
   ========================================== */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .sidebar-overlay.show {
        display: block;
    }

    .main-content {
        margin-left: 0;
        padding: 0.75rem;
    }

    .mobile-topbar {
        display: flex;
    }

    .brand { font-size: 1rem; }

    .sidebar {
        border-radius: 0;
    }
}

/* --- Sidebar section labels --- */
.sidebar .nav-section-label {
    font-size: 0.65rem;
    color: var(--sidebar-text-muted);
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    margin-bottom: 0.5rem;
}

/* --- Sidebar logout --- */
.sidebar .nav-item.nav-logout {
    color: rgba(239, 68, 68, 0.8);
}
.sidebar .nav-item.nav-logout:hover {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
}
