/**
 * PEGATRA v4.0 - Public Styles
 * Styles for public-facing pages (landing page, leaderboard)
 */

/* ============================================
   CSS VARIABLES
   ============================================ */
:root {
    --primary-color: #667eea;
    --primary-dark: #5a67d8;
    --secondary-color: #764ba2;
    --gold: #FFD700;
    --silver: #C0C0C0;
    --bronze: #CD7F32;
    --success: #22c55e;
    --warning: #f59e0b;
    --error: #ef4444;
    --text-dark: #1a1a2e;
    --text-light: #666;
    --bg-light: #f8f9fa;
    --border-color: #e0e0e0;
    --gradient-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 15px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 40px rgba(0,0,0,0.15);
}

/* ============================================
   LANDING PAGE - HERO SECTION
   ============================================ */
.hero-section {
    background: var(--gradient-primary);
    min-height: 60vh;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: white;
    padding: 60px 20px;
    position: relative;
    overflow: hidden;
}

.hero-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M30 0L60 30L30 60L0 30z' fill='%23ffffff' fill-opacity='0.05'/%3E%3C/svg%3E");
    opacity: 0.3;
}

.hero-content {
    position: relative;
    z-index: 1;
    max-width: 800px;
}

.hero-logo {
    width: 120px;
    height: 120px;
    margin-bottom: 30px;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.hero-title {
    font-size: 3.5rem;
    font-weight: 800;
    margin-bottom: 15px;
    text-shadow: 0 2px 10px rgba(0,0,0,0.2);
}

.hero-subtitle {
    font-size: 1.5rem;
    opacity: 0.9;
    margin-bottom: 40px;
    font-weight: 300;
}

.hero-buttons {
    display: flex;
    gap: 20px;
    justify-content: center;
    flex-wrap: wrap;
}

.btn-hero {
    padding: 15px 40px;
    border-radius: 50px;
    font-size: 16px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.btn-hero-primary {
    background: white;
    color: var(--primary-color);
}

.btn-hero-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 30px rgba(255,255,255,0.3);
}

.btn-hero-secondary {
    background: rgba(255,255,255,0.2);
    color: white;
    border: 2px solid rgba(255,255,255,0.5);
}

.btn-hero-secondary:hover {
    background: rgba(255,255,255,0.3);
    border-color: white;
}

/* ============================================
   LEADERBOARD PAGE
   ============================================ */
.leaderboard-page {
    min-height: 100vh;
    background: var(--bg-light);
}

.leaderboard-header {
    background: var(--gradient-primary);
    color: white;
    padding: 40px 20px;
    text-align: center;
}

.leaderboard-header h1 {
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 10px;
}

.leaderboard-header p {
    opacity: 0.9;
    font-size: 1.1rem;
}

.leaderboard-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 30px 20px;
}

/* Controls */
.leaderboard-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 30px;
    background: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: var(--shadow-md);
}

.filters {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    align-items: center;
}

.filter-select {
    padding: 10px 20px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    background: white;
    cursor: pointer;
    transition: border-color 0.3s ease;
    min-width: 150px;
}

.filter-select:focus {
    outline: none;
    border-color: var(--primary-color);
}

.refresh-controls {
    display: flex;
    align-items: center;
    gap: 15px;
}

.refresh-btn {
    padding: 10px 20px;
    background: var(--gradient-primary);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
}

.refresh-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.3);
}

.refresh-countdown {
    font-size: 13px;
    color: var(--text-light);
}

.auto-refresh-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-light);
}

/* Table */
.leaderboard-table-container {
    background: white;
    border-radius: 12px;
    box-shadow: var(--shadow-md);
    overflow: hidden;
}

.leaderboard-table {
    width: 100%;
    border-collapse: collapse;
}

.leaderboard-table th {
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    padding: 15px;
    text-align: left;
    font-weight: 600;
    color: var(--text-dark);
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    position: sticky;
    top: 0;
    z-index: 10;
}

.leaderboard-table td {
    padding: 15px;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

.leaderboard-table tbody tr {
    transition: background 0.2s ease;
}

.leaderboard-table tbody tr:hover {
    background: #f8f9fa;
}

/* Rank Styles */
.rank-cell {
    display: flex;
    align-items: center;
    gap: 10px;
}

.medal {
    font-size: 24px;
}

.rank-number {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-dark);
}

.rank-gold {
    background: linear-gradient(135deg, #fff9e6, #fff3cd) !important;
}

.rank-gold .rank-number {
    color: #b8860b;
}

.rank-silver {
    background: linear-gradient(135deg, #f8f9fa, #e9ecef) !important;
}

.rank-silver .rank-number {
    color: #6c757d;
}

.rank-bronze {
    background: linear-gradient(135deg, #fff5f0, #ffe8dc) !important;
}

.rank-bronze .rank-number {
    color: #CD7F32;
}

/* Team Cell */
.team-cell .team-name {
    font-weight: 600;
    color: var(--text-dark);
    font-size: 15px;
}

.team-cell .team-meta {
    font-size: 12px;
    color: var(--text-light);
    margin-top: 3px;
}

/* Institution Cell */
.institution-cell {
    font-size: 14px;
    color: var(--text-dark);
}

/* Badge Cells */
.gender-badge, .age-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.gender-badge.gender-male {
    background: #e3f2fd;
    color: #1976d2;
}

.gender-badge.gender-female {
    background: #fce4ec;
    color: #c2185b;
}

.gender-badge.gender-mixed {
    background: #f3e5f5;
    color: #7b1fa2;
}

.age-badge {
    background: #fff3cd;
    color: #856404;
}

/* Score Cell */
.score-cell {
    text-align: center;
}

.score-value {
    font-size: 20px;
    font-weight: 700;
    color: var(--primary-color);
    display: block;
}

.score-range {
    font-size: 11px;
    color: var(--text-light);
    display: block;
    margin-top: 2px;
}

.no-score {
    font-size: 13px;
    color: #999;
    font-style: italic;
}

/* Judge Count */
.judge-count-cell {
    text-align: center;
}

.judge-count {
    background: var(--bg-light);
    padding: 5px 15px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-light);
}

.empty-state i {
    font-size: 48px;
    color: #ddd;
    margin-bottom: 15px;
    display: block;
}

.empty-state p {
    font-size: 16px;
}

/* Loading Indicator */
.loading-indicator {
    display: none;
    justify-content: center;
    align-items: center;
    padding: 40px;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Last Updated */
.last-updated {
    text-align: center;
    padding: 15px;
    font-size: 13px;
    color: var(--text-light);
    border-top: 1px solid var(--border-color);
}

/* Competition Info */
.competition-info {
    display: flex;
    gap: 20px;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 20px;
    font-size: 14px;
    color: white;
}

.competition-info span {
    display: flex;
    align-items: center;
    gap: 5px;
}

/* ============================================
   FOOTER
   ============================================ */
.public-footer {
    background: var(--text-dark);
    color: white;
    padding: 40px 20px;
    text-align: center;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
}

.footer-logo {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 15px;
}

.footer-text {
    opacity: 0.7;
    font-size: 14px;
    margin-bottom: 20px;
}

.footer-links {
    display: flex;
    gap: 30px;
    justify-content: center;
}

.footer-links a {
    color: white;
    text-decoration: none;
    opacity: 0.7;
    transition: opacity 0.3s ease;
}

.footer-links a:hover {
    opacity: 1;
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */
@media (max-width: 768px) {
    .hero-title {
        font-size: 2.5rem;
    }
    
    .hero-subtitle {
        font-size: 1.2rem;
    }
    
    .leaderboard-header h1 {
        font-size: 1.8rem;
    }
    
    .leaderboard-controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .filters {
        flex-direction: column;
    }
    
    .filter-select {
        width: 100%;
    }
    
    .refresh-controls {
        justify-content: center;
    }
    
    .leaderboard-table-container {
        overflow-x: auto;
    }
    
    .leaderboard-table {
        min-width: 700px;
    }
}

@media (max-width: 480px) {
    .hero-title {
        font-size: 2rem;
    }
    
    .hero-buttons {
        flex-direction: column;
    }
    
    .btn-hero {
        width: 100%;
        justify-content: center;
    }
}
