/* ============================================
   AWARE POLL EVENT - Styles
   Diseño Moderno y Responsivo
   ============================================ */

:root {
    /* Colores principales */
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --secondary: #8b5cf6;
    --accent: #ec4899;

    /* Colores de estado */
    --success: #10b981;
    --warning: #f59e0b;
    --error: #ef4444;

    /* Medallas */
    --gold: #ffd700;
    --silver: #c0c0c0;
    --bronze: #cd7f32;

    /* Fondos */
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-card: rgba(30, 41, 59, 0.8);

    /* Texto */
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;

    /* Efectos */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
    --glow-gold: 0 0 20px rgba(255, 215, 0, 0.3);
    --glow-silver: 0 0 15px rgba(192, 192, 192, 0.2);

    /* Transiciones */
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Reset y Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: linear-gradient(135deg, var(--bg-primary) 0%, #1e1b4b 50%, var(--bg-primary) 100%);
    background-attachment: fixed;
    min-height: 100vh;
    color: var(--text-primary);
    line-height: 1.6;
}

/* Container Principal */
.app-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    animation: fadeIn 0.6s ease-out;
}

/* Header */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    background: var(--bg-card);
    border-radius: 16px;
    backdrop-filter: blur(10px);
    margin-bottom: 24px;
    box-shadow: var(--shadow-md);
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    width: 40px;
    height: 40px;
    color: var(--primary);
    filter: drop-shadow(0 0 8px var(--primary));
}

.logo h1 {
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Connection Status */
.connection-status {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: var(--bg-secondary);
    border-radius: 20px;
    font-size: 0.875rem;
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--warning);
    animation: pulse 2s infinite;
}

.status-dot.connected {
    background: var(--success);
    box-shadow: 0 0 10px var(--success);
    animation: none;
}

.status-dot.error {
    background: var(--error);
    animation: none;
}

/* Stats Bar */
.stats-bar {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    background: var(--bg-card);
    border-radius: 12px;
    backdrop-filter: blur(10px);
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.stat-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.stat-icon {
    font-size: 1.5rem;
}

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

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Filter Section */
.filter-section {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
    padding: 16px;
    background: var(--bg-card);
    border-radius: 12px;
}

.filter-section label {
    color: var(--text-secondary);
    font-weight: 500;
}

#grupoFilter {
    flex: 1;
    max-width: 300px;
    padding: 10px 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--text-muted);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 0.875rem;
    cursor: pointer;
    transition: var(--transition);
}

#grupoFilter:hover {
    border-color: var(--primary);
}

#grupoFilter:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

/* Loading State */
.loading-state {
    text-align: center;
    padding: 60px 20px;
}

.spinner {
    width: 50px;
    height: 50px;
    margin: 0 auto 20px;
    border: 4px solid var(--bg-secondary);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Error State */
.error-state {
    text-align: center;
    padding: 60px 20px;
}

.error-icon {
    font-size: 3rem;
    margin-bottom: 16px;
}

.error-state h3 {
    font-size: 1.5rem;
    margin-bottom: 8px;
    color: var(--error);
}

.error-state p {
    color: var(--text-secondary);
    margin-bottom: 20px;
}

.retry-btn {
    padding: 12px 24px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.retry-btn:hover {
    background: var(--primary-dark);
    transform: scale(1.05);
}

/* Leaderboard */
.leaderboard {
    animation: fadeInUp 0.5s ease-out;
}

.leaderboard-title {
    text-align: center;
    font-size: 1.75rem;
    margin-bottom: 24px;
    color: var(--text-primary);
}

.leaderboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

/* Leaderboard Card */
.leaderboard-card {
    position: relative;
    padding: 24px;
    background: var(--bg-card);
    border-radius: 16px;
    backdrop-filter: blur(10px);
    box-shadow: var(--shadow-md);
    transition: var(--transition);
    overflow: hidden;
}

.leaderboard-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
}

.leaderboard-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

/* Top 3 Styles */
.leaderboard-card.rank-1 {
    border: 2px solid var(--gold);
    box-shadow: var(--glow-gold), var(--shadow-lg);
}

.leaderboard-card.rank-1::before {
    background: linear-gradient(90deg, var(--gold), #fff700);
}

.leaderboard-card.rank-2 {
    border: 2px solid var(--silver);
    box-shadow: var(--glow-silver), var(--shadow-lg);
}

.leaderboard-card.rank-2::before {
    background: linear-gradient(90deg, var(--silver), #e8e8e8);
}

.leaderboard-card.rank-3 {
    border: 2px solid var(--bronze);
}

.leaderboard-card.rank-3::before {
    background: linear-gradient(90deg, var(--bronze), #daa06d);
}

/* Card Header */
.card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.rank-badge {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-secondary);
    border-radius: 50%;
    font-weight: 700;
    font-size: 1.125rem;
}

.rank-1 .rank-badge {
    background: linear-gradient(135deg, var(--gold), #fff700);
    color: var(--bg-primary);
}

.rank-2 .rank-badge {
    background: linear-gradient(135deg, var(--silver), #e8e8e8);
    color: var(--bg-primary);
}

.rank-3 .rank-badge {
    background: linear-gradient(135deg, var(--bronze), #daa06d);
    color: var(--bg-primary);
}

/* Card Content */
.card-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    font-weight: 600;
}

.card-info {
    flex: 1;
}

.card-name {
    font-weight: 600;
    font-size: 1rem;
    margin-bottom: 4px;
}

.card-group {
    font-size: 0.75rem;
    color: var(--text-secondary);
    padding: 2px 8px;
    background: var(--bg-secondary);
    border-radius: 4px;
    display: inline-block;
}

/* Card Stats */
.card-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.stat-box {
    text-align: center;
    padding: 12px;
    background: var(--bg-secondary);
    border-radius: 8px;
}

.stat-box-label {
    font-size: 0.625rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.stat-box-value {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--primary);
}

.rank-1 .stat-box-value {
    color: var(--gold);
}

/* Footer */
.app-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    margin-top: 24px;
    color: var(--text-muted);
    font-size: 0.75rem;
}

.auto-refresh {
    display: flex;
    align-items: center;
    gap: 6px;
}

.auto-refresh strong {
    color: var(--success);
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .app-header {
        flex-direction: column;
        gap: 16px;
        text-align: center;
    }

    .logo h1 {
        font-size: 1.25rem;
    }

    .stats-bar {
        grid-template-columns: 1fr;
    }

    .filter-section {
        flex-direction: column;
        align-items: stretch;
    }

    #grupoFilter {
        max-width: none;
    }

    .leaderboard-grid {
        grid-template-columns: 1fr;
    }

    .app-footer {
        flex-direction: column;
        gap: 12px;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .app-container {
        padding: 12px;
    }

    .logo h1 {
        font-size: 1rem;
    }

    .stat-value {
        font-size: 1.25rem;
    }

    .leaderboard-title {
        font-size: 1.25rem;
    }
}
