/**
 * BINGO PRO V2 - Estilos para Painel TV
 * Otimizado para telas grandes, projetores e TVs
 * Design de alto contraste para acessibilidade (idosos)
 */

/* ========================================
   VARIÁVEIS E TEMA
======================================== */
:root {
    /* Cores Principais */
    --color-primary: #03a9f4;
    --color-secondary: #00bcd4;
    --color-success: #4caf50;
    --color-warning: #ff9800;
    --color-danger: #f44336;
    --color-gold: #ffd700;

    /* Cores de Fundo */
    --bg-dark: #1a1a2e;
    --bg-panel: #16213e;
    --bg-card: #0f1624;
    --bg-hover: #1e3a5f;

    /* Cores de Texto */
    --text-primary: #ffffff;
    --text-secondary: #b0bec5;
    --text-muted: #78909c;

    /* Bordas e Sombras */
    --border-radius: 12px;
    --box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    --glow-shadow: 0 0 20px rgba(3, 169, 244, 0.6);

    /* Fonte Gigante para TV */
    --font-huge: clamp(80px, 10vw, 150px);
    --font-xxl: clamp(40px, 5vw, 80px);
    --font-xl: clamp(28px, 3vw, 48px);
    --font-lg: clamp(20px, 2vw, 32px);
    --font-md: clamp(16px, 1.5vw, 24px);
    --font-sm: clamp(14px, 1.2vw, 18px);
}

/* ========================================
   RESET E BASE
======================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body.tv-mode {
    font-family: 'Segoe UI', 'Roboto', 'Arial', sans-serif;
    background: linear-gradient(135deg, var(--bg-dark) 0%, #0a0e27 100%);
    color: var(--text-primary);
    overflow: hidden;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ========================================
   HEADER
======================================== */
.tv-header {
    background: linear-gradient(90deg, var(--bg-panel) 0%, var(--bg-dark) 100%);
    border-bottom: 4px solid var(--color-primary);
    padding: 1.5rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.7);
    position: relative;
    z-index: 100;
}

.logo-container {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
}

.logo-container h1 {
    font-size: var(--font-xl);
    font-weight: 900;
    color: var(--color-primary);
    text-shadow: 0 0 20px rgba(3, 169, 244, 0.8);
    letter-spacing: 2px;
}

.logo-container .versao {
    font-size: var(--font-sm);
    color: var(--text-secondary);
    font-weight: 400;
}

.game-info {
    display: flex;
    gap: 2rem;
}

.info-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.5rem 1.5rem;
    background: var(--bg-card);
    border-radius: var(--border-radius);
    border: 2px solid rgba(255, 255, 255, 0.1);
}

.info-box .label {
    font-size: var(--font-sm);
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
}

.info-box .value {
    font-size: var(--font-lg);
    font-weight: 700;
    color: var(--text-primary);
    margin-top: 0.25rem;
}

.premio-box {
    background: linear-gradient(135deg, var(--color-gold) 0%, #ff8c00 100%);
    border: none;
    box-shadow: 0 4px 15px rgba(255, 215, 0, 0.4);
}

.premio-box .label {
    color: #2c1810;
}

.premio-box .premio-valor {
    color: #1a0000;
    font-size: var(--font-xl);
}

.controls {
    display: flex;
    gap: 1rem;
}

.btn-control {
    background: var(--bg-card);
    border: 2px solid var(--color-primary);
    border-radius: 50%;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 24px;
}

.btn-control:hover {
    background: var(--color-primary);
    transform: scale(1.1);
    box-shadow: var(--glow-shadow);
}

.btn-control.active {
    background: var(--color-success);
    border-color: var(--color-success);
}

/* ========================================
   LAYOUT PRINCIPAL (GRID 3 COLUNAS)
======================================== */
.tv-main {
    flex: 1;
    display: grid;
    grid-template-columns: 25% 50% 25%;
    gap: 1.5rem;
    padding: 1.5rem;
    height: calc(100vh - 120px);
    overflow: hidden;
}

.panel {
    background: var(--bg-panel);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    box-shadow: var(--box-shadow);
    display: flex;
    flex-direction: column;
    border: 2px solid rgba(255, 255, 255, 0.05);
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid rgba(255, 255, 255, 0.1);
}

.panel-header h2 {
    font-size: var(--font-lg);
    color: var(--color-primary);
    font-weight: 700;
}

.panel-header .badge {
    background: var(--color-primary);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: var(--font-sm);
    font-weight: 600;
}

/* ========================================
   RANKING (COLUNA ESQUERDA)
======================================== */
.ranking-list {
    flex: 1;
    overflow-y: auto;
    padding-right: 0.5rem;
}

.ranking-list::-webkit-scrollbar {
    width: 6px;
}

.ranking-list::-webkit-scrollbar-track {
    background: var(--bg-card);
    border-radius: 10px;
}

.ranking-list::-webkit-scrollbar-thumb {
    background: var(--color-primary);
    border-radius: 10px;
}

.ranking-item {
    background: var(--bg-card);
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 0.75rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s ease;
    border-left: 4px solid transparent;
}

.ranking-item:hover {
    background: var(--bg-hover);
    transform: translateX(5px);
}

.ranking-item.hot {
    border-left-color: var(--color-danger);
    animation: pulse 1.5s infinite;
}

.ranking-item .player-info {
    flex: 1;
}

.ranking-item .player-name {
    font-size: var(--font-md);
    font-weight: 600;
    color: var(--text-primary);
}

.ranking-item .player-code {
    font-size: var(--font-sm);
    color: var(--text-muted);
}

.ranking-item .remaining {
    background: var(--color-warning);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-size: var(--font-lg);
    font-weight: 700;
    min-width: 50px;
    text-align: center;
}

.ranking-item.hot .remaining {
    background: var(--color-danger);
    animation: blink 1s infinite;
}

@keyframes blink {
    0%, 50%, 100% { opacity: 1; }
    25%, 75% { opacity: 0.5; }
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.02); }
}

.empty-state {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: var(--font-md);
}

/* ========================================
   PAINEL CENTRAL - GLOBO E BOLA
======================================== */
.main-panel {
    position: relative;
    justify-content: space-between;
}

.globe-container {
    width: 100%;
    height: 40%;
    position: relative;
    border-radius: var(--border-radius);
    overflow: hidden;
    background: radial-gradient(circle, rgba(3, 169, 244, 0.1) 0%, transparent 70%);
}

#globe-canvas {
    width: 100%;
    height: 100%;
}

.ball-display {
    text-align: center;
    padding: 2rem;
}

.ball-label {
    font-size: var(--font-md);
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 1rem;
}

.ball-number {
    margin: 0 auto;
    width: 280px;
    height: 280px;
    background: radial-gradient(circle at 30% 30%, #ffffff, #e3f2fd);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow:
        0 10px 40px rgba(0, 0, 0, 0.5),
        inset -5px -5px 20px rgba(0, 0, 0, 0.2),
        inset 5px 5px 20px rgba(255, 255, 255, 0.5);
    animation: ballPop 0.5s ease;
    position: relative;
}

.ball-number::before {
    content: '';
    position: absolute;
    top: 20%;
    left: 20%;
    width: 40%;
    height: 40%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.8), transparent);
    border-radius: 50%;
    filter: blur(15px);
}

.ball-number .number {
    font-size: var(--font-huge);
    font-weight: 900;
    color: #1a237e;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
    z-index: 1;
}

@keyframes ballPop {
    0% { transform: scale(0); opacity: 0; }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); opacity: 1; }
}

.ball-description {
    margin-top: 1.5rem;
    font-size: var(--font-xl);
    color: var(--color-primary);
    font-weight: 600;
    text-transform: uppercase;
}

.game-status {
    text-align: center;
    padding: 1rem;
    background: var(--bg-card);
    border-radius: var(--border-radius);
}

.game-status .status-text {
    font-size: var(--font-lg);
    color: var(--text-primary);
    font-weight: 600;
}

/* ========================================
   PRÊMIOS E TABULEIRO (COLUNA DIREITA)
======================================== */
.prizes-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 2rem;
}

.prize-card {
    background: var(--bg-card);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    text-align: center;
    border: 2px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
}

.prize-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4);
}

.prize-card.quina {
    border-color: var(--color-warning);
}

.prize-card.bingo {
    border-color: var(--color-gold);
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.1), var(--bg-card));
}

.prize-icon {
    font-size: 48px;
    margin-bottom: 0.5rem;
}

.prize-name {
    font-size: var(--font-md);
    color: var(--text-secondary);
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.prize-amount {
    font-size: var(--font-xl);
    color: var(--color-gold);
    font-weight: 700;
}

.board-container {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.board-title {
    font-size: var(--font-md);
    color: var(--text-secondary);
    text-align: center;
    margin-bottom: 1rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.board-grid {
    display: grid;
    grid-template-columns: repeat(10, 1fr);
    gap: 4px;
    flex: 1;
}

.board-number {
    background: var(--bg-card);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--font-sm);
    color: var(--text-muted);
    font-weight: 600;
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: all 0.3s ease;
}

.board-number.drawn {
    background: var(--color-success);
    color: white;
    font-weight: 700;
    border-color: var(--color-success);
    animation: drawNumber 0.5s ease;
}

@keyframes drawNumber {
    0% { transform: scale(0); opacity: 0; }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); opacity: 1; }
}

/* ========================================
   MODAL DE VENCEDOR
======================================== */
.winner-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    animation: fadeIn 0.5s ease;
}

.winner-modal.show {
    display: flex;
}

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

.winner-content {
    text-align: center;
    padding: 3rem;
    position: relative;
}

.winner-animation {
    position: relative;
    margin-bottom: 2rem;
}

.trophy {
    font-size: 200px;
    animation: bounce 1s infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-30px); }
}

.winner-title {
    font-size: var(--font-huge);
    color: var(--color-gold);
    font-weight: 900;
    text-shadow: 0 0 40px rgba(255, 215, 0, 0.8);
    margin-bottom: 1rem;
    animation: glow 2s infinite alternate;
}

@keyframes glow {
    from { text-shadow: 0 0 20px rgba(255, 215, 0, 0.5); }
    to { text-shadow: 0 0 60px rgba(255, 215, 0, 1); }
}

.winner-message {
    font-size: var(--font-xl);
    color: var(--text-primary);
    margin-bottom: 1.5rem;
}

.winner-prize {
    font-size: var(--font-xxl);
    color: var(--color-gold);
    font-weight: 700;
}

/* Confetti Animation */
.confetti {
    position: absolute;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

/* ========================================
   RESPONSIVO (Para telas menores)
======================================== */
@media (max-width: 1400px) {
    .tv-main {
        grid-template-columns: 30% 40% 30%;
    }
}

@media (max-width: 1024px) {
    .tv-main {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr auto;
    }

    .ranking-panel, .prizes-panel {
        display: none;
    }
}
