/* ===== DASHBOARD & ADMIN PANELS STYLES ===== */
:root {
    --dash-sidebar-width: 260px;
    --dash-bg: #f8fafc;
    --dash-card-bg: #ffffff;
    --dash-border: #e2e8f0;
    --dash-text: #1e293b;
    --dash-text-muted: #64748b;
}

body.dashboard-body {
    background-color: var(--dash-bg);
    color: var(--dash-text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.dash-header {
    background: var(--white);
    border-bottom: 1px solid var(--dash-border);
    padding: 16px 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.dash-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
}

.dash-brand img {
    height: 40px;
}

.dash-brand-title {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--primary);
}

.dash-user-menu {
    display: flex;
    align-items: center;
    gap: 18px;
}

.dash-user-badge {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--gray-100);
    padding: 6px 14px;
    border-radius: 30px;
    font-size: 0.9rem;
    font-weight: 600;
}

.dash-user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--primary);
    color: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
}

.btn-logout {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #dc2626;
    background: #fee2e2;
    padding: 8px 16px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.85rem;
    transition: var(--transition);
}

.btn-logout:hover {
    background: #fca5a5;
    color: #991b1b;
}

.dash-container {
    max-width: 1380px;
    margin: 30px auto;
    padding: 0 24px;
    width: 100%;
}

/* Tabs Navigation */
.dash-tabs {
    display: flex;
    gap: 8px;
    border-bottom: 2px solid var(--dash-border);
    margin-bottom: 30px;
}

.dash-tab {
    padding: 12px 20px;
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--dash-text-muted);
    border: none;
    background: none;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 8px;
}

.dash-tab:hover {
    color: var(--primary);
}

.dash-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* ===== KPI STATS CARDS ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 36px;
}

.stat-card {
    background: var(--white);
    border-radius: var(--radius-sm);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--dash-border);
    display: flex;
    align-items: center;
    gap: 18px;
}

.stat-icon {
    width: 52px;
    height: 52px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
}

.stat-icon.primary { background: #e0f2fe; color: #0284c7; }
.stat-icon.success { background: #dcfce7; color: #16a34a; }
.stat-icon.warning { background: #fef3c7; color: #d97706; }
.stat-icon.danger { background: #fee2e2; color: #dc2626; }
.stat-icon.purple { background: #f3e8ff; color: #9333ea; }

.stat-info {
    display: flex;
    flex-direction: column;
}

.stat-label {
    font-size: 0.85rem;
    color: var(--dash-text-muted);
    font-weight: 500;
    margin-bottom: 4px;
}

.stat-value {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--dash-text);
    line-height: 1.2;
}

.stat-sub {
    font-size: 0.78rem;
    color: var(--gray-500);
    margin-top: 4px;
}

/* Ranking / Comparison Bars */
.ranking-card {
    background: var(--white);
    border-radius: var(--radius-sm);
    padding: 28px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--dash-border);
    margin-bottom: 36px;
}

.ranking-item {
    margin-bottom: 18px;
}

.ranking-item:last-child {
    margin-bottom: 0;
}

.ranking-meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 6px;
}

.ranking-bar-bg {
    height: 10px;
    background: var(--gray-100);
    border-radius: 5px;
    overflow: hidden;
}

.ranking-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--primary-light));
    border-radius: 5px;
    transition: width 0.6s ease;
}

/* ===== FORM CONTAINER (EQUIVALENTE A FORMULARIO.PNG) ===== */
.form-container-wrapper {
    max-width: 720px;
    margin: 0 auto;
}

.form-header-banner {
    background: linear-gradient(135deg, var(--primary-dark), var(--primary));
    color: var(--white);
    padding: 28px;
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    border-top: 8px solid var(--primary-light);
}

.form-header-title {
    font-size: 1.6rem;
    font-weight: 700;
    margin-bottom: 6px;
}

.form-header-desc {
    font-size: 0.92rem;
    opacity: 0.9;
}

.form-card {
    background: var(--white);
    border: 1px solid var(--dash-border);
    border-radius: var(--radius-sm);
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-sm);
}

.form-card.required-card {
    border-left: 4px solid var(--primary);
}

.form-label {
    display: block;
    font-weight: 600;
    font-size: 1rem;
    color: var(--gray-900);
    margin-bottom: 8px;
}

.form-label .req {
    color: #dc2626;
    margin-left: 2px;
}

.form-sublabel {
    font-size: 0.85rem;
    color: var(--gray-500);
    margin-bottom: 12px;
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    border-radius: 8px;
    border: 1px solid var(--gray-300);
    font-size: 0.95rem;
    outline: none;
    transition: var(--transition);
    background: var(--white);
}

.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(34,142,204,0.15);
}

textarea.form-control {
    min-height: 110px;
    resize: vertical;
}

.file-dropzone {
    display: block;
    width: 100%;
    border: 2px dashed var(--gray-300);
    border-radius: 8px;
    padding: 28px 24px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    background: var(--gray-50);
}

.file-dropzone:hover {
    border-color: var(--primary);
    background: var(--primary-ultra-light);
}

.btn-primary {
    background: var(--primary);
    color: var(--white);
    padding: 12px 28px;
    border-radius: 8px;
    border: none;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(34,142,204,0.3);
}

/* ===== TABLES STYLING ===== */
.table-responsive {
    overflow-x: auto;
    background: var(--white);
    border-radius: var(--radius-sm);
    border: 1px solid var(--dash-border);
    box-shadow: var(--shadow-sm);
}

.table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.9rem;
}

.table th {
    background: var(--gray-100);
    padding: 14px 18px;
    font-weight: 700;
    color: var(--gray-700);
    border-bottom: 1px solid var(--dash-border);
    white-space: nowrap;
}

.table td {
    padding: 14px 18px;
    border-bottom: 1px solid var(--gray-100);
    color: var(--gray-800);
    vertical-align: middle;
}

.table tr:hover {
    background: var(--gray-50);
}

.badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 600;
    display: inline-block;
}

.badge-primary { background: #e0f2fe; color: #0369a1; }
.badge-success { background: #dcfce7; color: #15803d; }
.badge-purple { background: #f3e8ff; color: #7e22ce; }

.actions-cell {
    display: flex;
    gap: 8px;
}

.btn-icon {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    border: 1px solid var(--gray-300);
    background: var(--white);
    color: var(--gray-700);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
}

.btn-icon:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-ultra-light);
}

.btn-icon.danger:hover {
    border-color: #ef4444;
    color: #ef4444;
    background: #fee2e2;
}

/* Modals */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
}

.modal-backdrop.active {
    opacity: 1;
    visibility: visible;
}

.modal-box {
    background: var(--white);
    border-radius: var(--radius);
    max-width: 650px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    padding: 28px;
    box-shadow: var(--shadow-lg);
    transform: scale(0.95);
    transition: var(--transition);
}

.modal-backdrop.active .modal-box {
    transform: scale(1);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--gray-200);
    padding-bottom: 14px;
}

.modal-title {
    font-size: 1.25rem;
    font-weight: 700;
}

.btn-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--gray-500);
}

/* ===== USER RANKING & STACKED BAR CHART STYLES ===== */
.rank-position-badge {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 0.85rem;
    flex-shrink: 0;
}
.rank-pos-1 { background: #fef08a; color: #854d0e; border: 1px solid #fde047; }
.rank-pos-2 { background: #e2e8f0; color: #334155; border: 1px solid #cbd5e1; }
.rank-pos-3 { background: #ffedd5; color: #9a3412; border: 1px solid #fed7aa; }
.rank-pos-other { background: #f1f5f9; color: #64748b; border: 1px solid #e2e8f0; }

.user-ranking-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-radius: 10px;
    background: #ffffff;
    border: 1px solid #f1f5f9;
    margin-bottom: 10px;
    transition: all 0.2s ease;
}
.user-ranking-item:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
    transform: translateY(-1px);
}

.stacked-chart-container {
    background: #18181b;
    border-radius: 12px;
    padding: 24px;
    color: #f4f4f5;
    position: relative;
    overflow-x: auto;
    border: 1px solid #27272a;
}
.stacked-chart-container text {
    font-family: inherit;
}

.chart-tooltip {
    position: absolute;
    padding: 8px 12px;
    background: rgba(9, 9, 11, 0.92);
    color: #ffffff;
    border: 1px solid #3f3f46;
    border-radius: 8px;
    font-size: 0.78rem;
    pointer-events: none;
    z-index: 1000;
    white-space: nowrap;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
    display: none;
    backdrop-filter: blur(4px);
}

