/* ==========================================
   MARRALHINHA SPA - GAME STYLES
   ========================================== */

/* Room Screen (Waiting) */
.room-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

.room-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px 20px;
    background: var(--bg-dark);
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.room-title h2 {
    margin: 0;
}

.btn-back {
    background: rgba(255, 255, 255, 0.08);
    border: 2px solid rgba(255, 255, 255, 0.15);
    color: rgba(255, 255, 255, 0.75);
    padding: 8px 18px;
    border-radius: 10px;
    font-size: 0.95em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
    letter-spacing: 0.02em;
}

.btn-back:hover {
    background: rgba(255, 255, 255, 0.16);
    border-color: rgba(255, 255, 255, 0.35);
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
}

.room-main {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    overflow: hidden;
    position: relative;
}

.room-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 30px;
    gap: 25px;
    background: var(--bg-secondary);
    border-radius: 15px;
    max-width: 500px;
    width: 100%;
}

.room-code-box {
    text-align: center;
}

.room-code-box p {
    color: var(--text-muted);
    margin-bottom: 10px;
}

.code-display {
    display: flex;
    align-items: center;
    gap: 15px;
    background: var(--bg-dark);
    padding: 15px 25px;
    border-radius: 15px;
}

.code-text {
    font-family: 'Source Code Pro', monospace;
    font-size: 2.5em;
    font-weight: bold;
    color: var(--accent-yellow);
    letter-spacing: 5px;
}

.copy-btn {
    background: var(--bg-tertiary);
    border: none;
    padding: 10px 15px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1.2em;
    transition: all 0.2s;
}

.copy-btn:hover {
    background: var(--accent-blue);
}

.room-info {
    color: var(--text-muted);
}

/* Players Grid */
.players-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    max-width: 400px;
    width: 100%;
}

/* Team layout (modo 2v2) */
#room-team-layout {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
    max-width: 400px;
}

.team-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.team-label {
    font-size: 0.8em;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1px;
    opacity: 0.85;
}

.team-slots {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.player-slot {
    background: var(--bg-secondary);
    border-radius: 15px;
    padding: 20px;
    text-align: center;
    border: 3px solid var(--slot-color);
    transition: all 0.3s ease;
    position: relative;
    opacity: 0.4;
}

.player-slot.empty {
    border-style: dashed;
    opacity: 0.4;
}

.player-slot.filled {
    border-style: solid;
    opacity: 1;
    box-shadow: 0 0 20px color-mix(in srgb, var(--slot-color) 50%, transparent),
                0 0 40px color-mix(in srgb, var(--slot-color) 30%, transparent),
                inset 0 0 15px color-mix(in srgb, var(--slot-color) 15%, transparent);
    animation: slotGlow 2s ease-in-out infinite alternate;
}

@keyframes slotGlow {
    0% {
        box-shadow: 0 0 15px color-mix(in srgb, var(--slot-color) 40%, transparent),
                    0 0 30px color-mix(in srgb, var(--slot-color) 20%, transparent);
    }
    100% {
        box-shadow: 0 0 25px color-mix(in srgb, var(--slot-color) 60%, transparent),
                    0 0 50px color-mix(in srgb, var(--slot-color) 35%, transparent);
    }
}

.player-slot.me {
    box-shadow: 0 0 25px color-mix(in srgb, var(--slot-color) 70%, transparent),
                0 0 50px color-mix(in srgb, var(--slot-color) 45%, transparent),
                inset 0 0 20px color-mix(in srgb, var(--slot-color) 20%, transparent);
}

.slot-icon {
    font-size: 1.5em;
    color: var(--text-muted);
}

.slot-name {
    font-weight: bold;
    font-size: 1.1em;
}

.host-badge {
    position: absolute;
    top: -10px;
    right: -10px;
    font-size: 1.5em;
}

.room-status {
    color: var(--text-muted);
    font-size: 1.1em;
}

.btn-lg {
    padding: 18px 40px;
    font-size: 1.2em;
}

/* Game Screen */
.game-container {
    position: relative;
    width: 100vw;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

.game-info {
    position: absolute;
    top: 15px;
    left: 15px;
    background: rgba(0,0,0,0.6);
    padding: 10px 15px;
    border-radius: 10px;
    font-size: 0.9em;
    z-index: 100;
}

.game-info div {
    margin: 3px 0;
}

.game-buttons-top {
    position: absolute;
    top: 15px;
    right: 15px;
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    gap: 10px;
    z-index: 100;
}

.btn-icon {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    border: none;
    background: rgba(0,0,0,0.6);
    color: white;
    font-size: 1.3em;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-icon:hover {
    background: rgba(0,0,0,0.8);
    transform: scale(1.1);
}

.btn-icon.btn-exit {
    background: var(--accent-red);
}

.btn-icon.btn-exit:hover {
    background: #c0392b;
}

.btn-icon.btn-sos {
    background: #f1c40f;
}

.btn-icon.btn-sos:hover {
    background: #f39c12;
}

.btn-icon.btn-sos.requested {
    background: #7f8c8d;
    opacity: 0.6;
    cursor: not-allowed;
}

.spectator-count-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    font-size: 0.85em;
    padding: 0 12px;
    border-radius: 22px;
    white-space: nowrap;
    pointer-events: none;
    height: 45px;
    box-sizing: border-box;
}

.btn-icon.btn-refresh {
    background: rgba(52, 152, 219, 0.8);
}

.btn-icon.btn-refresh:hover {
    background: rgba(41, 128, 185, 0.9);
}

.btn-icon.btn-votekick {
    background: rgba(230, 126, 34, 0.85);
}

.btn-icon.btn-votekick:hover {
    background: rgba(211, 84, 0, 0.95);
}

/* Botão de chat no canto inferior esquerdo */
.btn-chat-toggle {
    position: absolute;
    bottom: 20px;
    left: 20px;
    width: 55px;
    height: 55px;
    border-radius: 50%;
    border: none;
    background: var(--accent-blue);
    color: white;
    font-size: 1.5em;
    cursor: pointer;
    z-index: 100;
    transition: all 0.2s;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
}

.btn-chat-toggle:hover {
    transform: scale(1.1);
    background: #2980b9;
}

.btn-chat-toggle.active {
    background: var(--accent-green);
}

/* Badge de novas mensagens */
.chat-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    min-width: 20px;
    height: 20px;
    background: var(--accent-red);
    border-radius: 10px;
    font-size: 0.6em;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
    animation: pulse 1s infinite;
}

.chat-badge.hidden {
    display: none;
}

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

/* Botão de Emojis (sempre visível) */
.btn-emoji-toggle {
    position: absolute;
    bottom: 85px;
    left: 20px;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    border: none;
    background: rgba(0,0,0,0.6);
    color: white;
    font-size: 1.3em;
    cursor: pointer;
    z-index: 100;
    transition: all 0.2s;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}

.btn-emoji-toggle:hover {
    transform: scale(1.1);
    background: rgba(0,0,0,0.8);
}

.btn-emoji-toggle.active {
    background: var(--accent-yellow);
}

/* Emojis de atalho */
.emoji-shortcuts {
    position: absolute;
    bottom: 140px;
    left: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    z-index: 100;
    transition: all 0.3s ease;
}

.emoji-shortcuts.hidden {
    opacity: 0;
    pointer-events: none;
    transform: translateY(20px);
}

.emoji-list {
    display: flex;
    flex-direction: column;
    gap: 5px;
    background: rgba(0,0,0,0.8);
    padding: 10px;
    border-radius: 15px;
}

.emoji-btn {
    width: 44px;
    height: 44px;
    border: none;
    background: rgba(255,255,255,0.1);
    border-radius: 12px;
    font-size: 1.5em;
    cursor: pointer;
    transition: all 0.2s;
}

.emoji-btn:hover {
    background: rgba(255,255,255,0.25);
    transform: scale(1.15);
}

.emoji-btn:active {
    transform: scale(0.95);
}

#gameCanvas {
    max-height: 98vh;
    max-width: 98vw;
    background-color: #d7ccc8;
    background-image: 
        repeating-linear-gradient(45deg, rgba(0,0,0,0.03) 0px, rgba(0,0,0,0.03) 2px, transparent 2px, transparent 16px),
        linear-gradient(to bottom right, #d7ccc8, #bcaaa4);
    border-radius: 15px;
    box-shadow: 0 0 30px rgba(0,0,0,0.5);
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

/* Game Chat */
.game-chat {
    position: absolute;
    bottom: 20px;
    left: 85px;
    width: 320px;
    height: 300px;
    background: rgba(0,0,0,0.9);
    border-radius: 15px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 100;
    transition: all 0.3s ease;
}

.game-chat.hidden {
    opacity: 0;
    pointer-events: none;
    transform: translateX(-20px);
}

.game-chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    background: rgba(255,255,255,0.1);
    font-weight: bold;
}

.btn-close-chat {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.2em;
    cursor: pointer;
    padding: 2px 8px;
    border-radius: 5px;
    transition: all 0.2s;
}

.btn-close-chat:hover {
    color: white;
    background: rgba(255,255,255,0.1);
}

.game-chat .chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
    font-size: 0.85em;
}

.game-chat .chat-input-container {
    padding: 10px;
    border-top: 1px solid rgba(255,255,255,0.1);
}

.btn-xs {
    padding: 6px 12px;
    font-size: 0.85em;
}

/* Victory Overlay */
.victory-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.85);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

#confetti-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.victory-box {
    text-align: center;
    z-index: 1;
    animation: popIn 0.5s ease-out;
}

.trophy-icon {
    font-size: 5em;
    margin-bottom: 20px;
    animation: bounce 1s infinite;
}

.victory-title {
    font-size: 2.5em;
    color: #f1c40f;
    margin-bottom: 20px;
    text-shadow: 0 0 20px rgba(241, 196, 15, 0.5);
}

.victory-name {
    font-size: 3em;
    margin-bottom: 10px;
    text-shadow: 0 0 30px currentColor;
}

.victory-message {
    font-size: 1.3em;
    color: var(--text-secondary);
    margin-bottom: 30px;
}

/* Responsive */
@media (max-width: 600px) {
    .game-info {
        font-size: 0.8em;
        padding: 8px 12px;
    }
    
    .game-buttons {
        gap: 8px;
    }
    
    .btn-icon {
        width: 40px;
        height: 40px;
        font-size: 1.1em;
    }

    .spectator-count-badge {
        height: 40px;
        font-size: 0.78em;
        padding: 0 8px;
    }
    
    .game-chat {
        width: 250px;
        max-height: 200px;
    }
    
    .code-text {
        font-size: 2em;
    }
    
    .players-grid {
        gap: 10px;
    }
    
    .player-slot {
        padding: 15px;
    }
}

/* Mensagens de Moderador no Chat */
.chat-message.moderator {
    background: linear-gradient(135deg, rgba(243, 156, 18, 0.15), rgba(243, 156, 18, 0.05));
    border-left: 3px solid #f39c12;
    padding-left: 10px;
    margin: 5px 0;
    border-radius: 4px;
}

.chat-message.moderator .msg-author {
    font-weight: bold;
}

/* Auto-start countdown */
.auto-start-countdown {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    margin: 12px auto;
    animation: fadeIn 0.4s ease;
}

.auto-start-ring {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    border: 4px solid var(--accent-green, #27ae60);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6em;
    font-weight: bold;
    color: var(--accent-green, #27ae60);
    animation: pulse 1s ease-in-out infinite;
}

.auto-start-label {
    font-size: 0.85em;
    color: #aaa;
    text-align: center;
}

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

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