:root {
    --sidebar-bg: #1a1a2e;
    --sidebar-width: 260px;
    --primary: #0d6efd;
    --success: #198754;
    --warning: #ffc107;
    --danger: #dc3545;
}

html, body { height: 100%; margin: 0; font-size: 14px; }

/* ─── SIDEBAR ─── */
.sidebar {
    width: var(--sidebar-width);
    min-height: 100vh;
    background: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    transition: transform .3s ease;
    z-index: 1000;
}

.sidebar-header {
    padding: 1.25rem;
    border-bottom: 1px solid rgba(255,255,255,.1);
}

.sidebar .nav-link {
    color: rgba(255,255,255,.7);
    padding: .75rem 1.25rem;
    border-radius: 0;
    transition: all .2s;
}

.sidebar .nav-link:hover {
    color: #fff;
    background: rgba(255,255,255,.1);
}

.sidebar .nav-link.active {
    color: #fff;
    background: var(--primary);
}

.sidebar-footer {
    margin-top: auto;
    padding: 1rem;
    border-top: 1px solid rgba(255,255,255,.1);
}

.sidebar-toggle {
    position: fixed;
    top: 8px;
    left: 8px;
    z-index: 1050;
    padding: 4px 10px;
    font-size: 18px;
}

.main-content {
    background: #f5f6fa;
    min-height: 100vh;
    overflow-y: auto;
    transition: margin-left .3s ease;
}

/* ─── OFFLINE ─── */
.offline-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 9999;
    background: var(--danger);
    color: white;
    text-align: center;
    padding: 6px;
    font-weight: 600;
    font-size: 13px;
}

/* ─── TOAST ─── */
.toast-container {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 99999;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: 380px;
}

.toast-custom {
    background: white;
    border-radius: 10px;
    padding: 14px 18px;
    box-shadow: 0 4px 20px rgba(0,0,0,.15);
    display: flex;
    align-items: flex-start;
    gap: 10px;
    animation: slideInRight .3s ease;
    border-left: 4px solid #6c757d;
}

.toast-custom.toast-success { border-left-color: var(--success); }
.toast-custom.toast-error { border-left-color: var(--danger); }
.toast-custom.toast-warning { border-left-color: var(--warning); }
.toast-custom.toast-info { border-left-color: var(--primary); }

.toast-custom .toast-close {
    margin-left: auto;
    background: none;
    border: none;
    font-size: 18px;
    color: #999;
    cursor: pointer;
    padding: 0 0 0 8px;
}

@keyframes slideInRight {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes fadeOut {
    to { opacity: 0; transform: translateX(100%); }
}

/* ─── SKELETON ─── */
.skeleton {
    background: linear-gradient(90deg, #e0e0e0 25%, #f0f0f0 50%, #e0e0e0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 6px;
}

.skeleton-card {
    height: 120px;
    margin-bottom: 16px;
}

.skeleton-table {
    height: 40px;
    margin-bottom: 8px;
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ─── DASHBOARD ─── */
.card-dashboard {
    border: none;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,.08);
    transition: transform .2s;
}

.card-dashboard:hover {
    transform: translateY(-2px);
}

.card-dashboard .card-body {
    padding: 1.5rem;
}

.card-dashboard .numero {
    font-size: 2.2rem;
    font-weight: 700;
}

.progress-dashboard {
    height: 24px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.progress-dashboard .progress-bar {
    border-radius: 12px;
}

/* ─── CHART ─── */
.chart-bar-container {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    height: 200px;
    padding: 0 8px;
}

.chart-bar-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100%;
    justify-content: flex-end;
}

.chart-bar {
    width: 100%;
    max-width: 50px;
    border-radius: 6px 6px 0 0;
    transition: height .6s ease;
    min-height: 4px;
    position: relative;
}

.chart-bar .chart-value {
    position: absolute;
    top: -20px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 11px;
    font-weight: 700;
    color: #333;
}

.chart-label {
    margin-top: 6px;
    font-size: 11px;
    text-align: center;
    color: #666;
    word-break: break-all;
    max-width: 80px;
    line-height: 1.2;
}

.chart-legend {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 12px;
    font-size: 12px;
}

.chart-legend span {
    display: flex;
    align-items: center;
    gap: 6px;
}

.chart-legend .dot {
    width: 12px;
    height: 12px;
    border-radius: 3px;
    display: inline-block;
}

/* ─── TABLE ─── */
.table-participantes th {
    background: #e9ecef;
    font-weight: 600;
    white-space: nowrap;
    position: sticky;
    top: 0;
    z-index: 1;
}

.search-box {
    max-width: 400px;
}

/* ─── BADGES ─── */
.badge-entregado {
    background: #d1e7dd;
    color: #0f5132;
}

.badge-pendiente {
    background: #fff3cd;
    color: #664d03;
}

/* ─── COUNTER ─── */
.counter-info {
    font-size: 13px;
    color: #888;
}

/* ─── SKELETON LOADING PLACEHOLDER ─── */
.loading-placeholder {
    padding: 40px 20px;
}

/* ─── RESPONSIVE ─── */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        transform: translateX(-100%);
        width: 260px;
        box-shadow: 4px 0 20px rgba(0,0,0,.3);
    }

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

    .sidebar-overlay {
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,.4);
        z-index: 999;
    }

    .main-content {
        margin-left: 0 !important;
        padding: 12px !important;
    }

    .sidebar-toggle {
        display: block !important;
    }

    .card-dashboard .numero {
        font-size: 1.6rem;
    }

    .chart-bar-container {
        height: 140px;
        gap: 8px;
    }

    .chart-label {
        font-size: 9px;
        max-width: 50px;
    }
}

@media (min-width: 769px) {
    .sidebar-toggle { display: none !important; }
}
