/* ============================================
   VOTING SYSTEM - PROFESSIONAL LIGHT THEME
   Bootstrap 5.2 Compatible
   ============================================ */

/* Variables */
:root {
    --voting-primary: #0d6efd;
    --voting-secondary: #6c757d;
    --voting-success: #198754;
    --voting-warning: #ffc107;
    --voting-light: #f8f9fa;
    --voting-border: #dee2e6;
    --voting-shadow: rgba(0, 0, 0, 0.08);
}

/* Container General */
.voting-container {
    max-width: 1400px;
    margin: 0 auto;
}

/* Header */
.voting-header {
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    padding: 2rem 1rem;
    border-radius: 12px;
    border: 1px solid var(--voting-border);
}

.voting-title {
    letter-spacing: -0.5px;
}

/* Stats Cards */
.stat-card {
    transition: all 0.3s ease;
    border-radius: 12px;
    background: #ffffff;
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px var(--voting-shadow) !important;
}

.stat-icon {
    width: 50px;
    height: 50px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(13, 110, 253, 0.1);
    border-radius: 12px;
}

.stat-value {
    font-size: 1.75rem;
    line-height: 1.2;
}

.stat-label {
    font-size: 0.875rem;
}

/* Voting Items Grid */
.voting-item {
    transition: all 0.3s ease;
    border-radius: 12px;
    overflow: hidden;
}

.voting-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 25px var(--voting-shadow);
    border-color: var(--voting-primary) !important;
}

.voting-rank {
    min-width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    font-weight: bold;
}

.voting-name {
    font-size: 0.95rem;
    line-height: 1.3;
}

.voting-reward {
    font-size: 0.875rem;
}



.voting-action .btn {
    padding: 0.625rem 1rem;
    font-weight: 600;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.voting-action .btn-primary {
    background: var(--voting-primary);
    border: none;
}

.voting-action .btn-primary:hover {
    background: #0b5ed7;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(13, 110, 253, 0.3);
}

.voting-action .btn-secondary {
    background: var(--voting-secondary);
    border: none;
}

/* Top Voters Table */
.top-voters-card {
    border-radius: 12px;
    overflow: hidden;
}

.table {
    margin-bottom: 0;
}

.table thead th {
    border-top: none;
    border-bottom: 2px solid var(--voting-border);
    font-weight: 600;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--voting-secondary);
    padding: 0.75rem 0.5rem;
}

.table tbody td {
    padding: 0.75rem 0.5rem;
    vertical-align: middle;
    border-bottom: 1px solid var(--voting-border);
}

.table tbody tr:hover {
    background-color: rgba(13, 110, 253, 0.03);
}

.table-warning {
    background-color: rgba(255, 193, 7, 0.15) !important;
}

.table-warning:hover {
    background-color: rgba(255, 193, 7, 0.25) !important;
}

/* Avatar Circle */
.avatar-circle {
    flex-shrink: 0;
}

/* Countdown */
.countdown {
    font-weight: 600;
    color: var(--voting-warning);
}

/* Hover Effects */
.hover-shadow {
    box-shadow: 0 2px 8px var(--voting-shadow);
}

.hover-shadow:hover {
    box-shadow: 0 8px 25px var(--voting-shadow);
}

/* Loading Modal */
#voteModal .modal-content {
    border-radius: 16px;
    border: none;
    box-shadow: 0 10px 40px rgba(0,0,0,0.15);
}

/* Responsive Adjustments */
@media (max-width: 991px) {
    .voting-grid .col-md-6 {
        max-width: 50%;
    }
    
    .stat-value {
        font-size: 1.5rem;
    }
    
    .stat-icon {
        width: 45px;
        height: 45px;
    }
}

@media (max-width: 768px) {
    .voting-header {
        padding: 1.5rem 1rem;
    }
    
    .voting-title {
        font-size: 1.5rem;
    }
    
    .stat-card {
        margin-bottom: 0.75rem;
    }
    
    .stat-value {
        font-size: 1.25rem;
    }
    
    .stat-label {
        font-size: 0.75rem;
    }
    
    .voting-grid .col-md-6 {
        max-width: 100%;
    }
    
    .voting-item .card-body {
        padding: 1rem;
    }
    
    .voting-image {
        margin: 0.5rem 0;
    }
    
    .voting-image img {
        max-height: 60px;
    }
}

@media (max-width: 576px) {
    .voting-container {
        padding: 1rem;
    }
    
    .voting-header {
        padding: 1rem;
        margin-bottom: 1rem;
    }
    
    .voting-title {
        font-size: 1.25rem;
    }
    
    .stat-card .card-body {
        padding: 1rem 0.75rem;
    }
    
    .stat-icon {
        width: 40px;
        height: 40px;
        font-size: 1.25rem;
    }
    
    .stat-value {
        font-size: 1.125rem;
    }
    
    .voting-name {
        font-size: 0.875rem;
    }
    
    .voting-reward {
        font-size: 0.8125rem;
    }
    
    .voting-action .btn {
        padding: 0.5rem;
        font-size: 0.875rem;
    }
    
    /* Tabla Top Voters en móvil */
    .table-responsive {
        border-radius: 0 0 12px 12px;
    }
    
    .table thead th,
    .table tbody td {
        padding: 0.625rem 0.375rem;
        font-size: 0.8125rem;
    }
    
    .avatar-circle {
        width: 28px;
        height: 28px;
        font-size: 0.75rem;
    }
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.voting-item {
    animation: fadeIn 0.4s ease-out;
}

/* Badge Styles */
.badge {
    font-weight: 600;
    padding: 0.375em 0.65em;
}

/* Card Header */
.card-header {
    background: #ffffff;
    border-bottom: 2px solid var(--voting-border) !important;
}

/* Sticky Top Voters en desktop */
@media (min-width: 992px) {
    .sticky-top {
        max-height: calc(100vh - 40px);
        overflow-y: auto;
    }
    
    .sticky-top::-webkit-scrollbar {
        width: 6px;
    }
    
    .sticky-top::-webkit-scrollbar-track {
        background: var(--voting-light);
        border-radius: 3px;
    }
    
    .sticky-top::-webkit-scrollbar-thumb {
        background: var(--voting-border);
        border-radius: 3px;
    }
    
    .sticky-top::-webkit-scrollbar-thumb:hover {
        background: var(--voting-secondary);
    }
}

/* Utility Classes */
.text-truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Shadow Utilities */
.shadow-sm {
    box-shadow: 0 2px 8px var(--voting-shadow) !important;
}

/* Border Radius */
.rounded {
    border-radius: 12px !important;
}

/* Spacing */
.g-3 {
    --bs-gutter-x: 1rem;
    --bs-gutter-y: 1rem;
}

.g-4 {
    --bs-gutter-x: 1.5rem;
    --bs-gutter-y: 1.5rem;
}
/* ============================================
   🏆 TOP VOTERS SIDEBAR - STICKY CORREGIDO
   ============================================ */
.voting-sidebar-sticky {
    position: sticky;
    /* Ajusta este valor según la altura de tu navbar */
    top: 80px;
    z-index: 100;
    /* Limita la altura máxima para que no ocupe toda la pantalla */
    max-height: calc(100vh - 100px);
}

/* Scroll interno elegante cuando el contenido es largo */
.voting-sidebar-scroll {
    overflow-y: auto;
    max-height: calc(100vh - 180px);
}

/* Scrollbar personalizado para el sidebar */
.voting-sidebar-scroll::-webkit-scrollbar {
    width: 6px;
}

.voting-sidebar-scroll::-webkit-scrollbar-track {
    background: #f8f9fa;
    border-radius: 3px;
}

.voting-sidebar-scroll::-webkit-scrollbar-thumb {
    background: #0d6efd;
    border-radius: 3px;
}

.voting-sidebar-scroll::-webkit-scrollbar-thumb:hover {
    background: #0b5ed7;
}

/* Responsive: en móviles se comporta normal (no sticky) */
@media (max-width: 991px) {
    .voting-sidebar-sticky {
        position: static;
        max-height: none;
        margin-top: 2rem;
    }
    
    .voting-sidebar-scroll {
        max-height: none;
        overflow-y: visible;
    }
}

.voting-image img {
    max-height: 60px !important;
    width: 100%;
    object-fit: contain;
    padding: 8px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    transition: transform 0.3s ease;
}

.voting-item:hover .voting-image img {
    transform: scale(1.05);
}

@media (max-width: 768px) {
    .voting-image img {
        max-height: 60px !important;
    }
}