/* ==========================================
   MARRALHINHA SPA - LOBBY STYLES
   Redesenhado com base no estilo original
   ========================================== */

/* ==========================================
   VARIÁVEIS (compatibilidade)
   ========================================== */
:root {
    --bg-primary: #1a1a2e;
    --bg-secondary: #16213e;
    --bg-tertiary: rgba(0,0,0,0.15);
    --bg-dark: #0f3460;
    --accent-yellow: #f1c40f;
    --accent-green: #27ae60;
    --accent-blue: #3498db;
    --accent-red: #e74c3c;
    --accent-purple: #9b59b6;
    --text-primary: white;
    --text-secondary: #bdc3c7;
    --text-muted: #7f8c8d;
}

/* ==========================================
   LOBBY CONTAINER
   ========================================== */
.lobby-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
    background-color: var(--bg-primary);
    background-image: repeating-linear-gradient(45deg, rgba(0,0,0,0.03) 0px, rgba(0,0,0,0.03) 2px, transparent 2px, transparent 16px);
}

/* ==========================================
   HEADER - Reorganizado
   ========================================== */
.lobby-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px 20px;
    background: var(--bg-secondary);
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    flex-shrink: 0;
    flex-wrap: wrap;
    gap: 15px;
}

/* Lado Esquerdo - Logo e Stats */
.header-left {
    display: flex;
    align-items: center;
    gap: 20px;
}

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

.lobby-logo h1 {
    margin: 0;
    font-size: 1.5em;
    color: var(--accent-yellow);
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.header-stats {
    display: flex;
    gap: 10px;
}

.stat-badge {
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.85em;
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 6px;
}

.stat-badge.online {
    background: var(--accent-green);
    color: white;
}

.stat-badge.rooms {
    background: var(--accent-blue);
    color: white;
}

.online-dot {
    width: 8px;
    height: 8px;
    background: white;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

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

/* Lado Direito - Menu, Perfil, Nome */
.header-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

/* Lado Direito - Nome, Perfil e Logout */
.header-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

.lobby-header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.lobby-header-actions .btn {
    padding: 8px 14px;
    font-size: 0.9em;
}

.player-info-header {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-secondary);
}

.player-info-header strong {
    color: var(--accent-yellow);
}

.btn-profile-small {
    background: rgba(255,255,255,0.1);
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.1em;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-profile-small:hover {
    background: rgba(255,255,255,0.2);
    transform: scale(1.1);
}

.btn-logout-header {
    background: rgba(231, 76, 60, 0.2);
    border: 2px solid rgba(231, 76, 60, 0.4);
    color: #e74c3c;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    font-size: 1.2em;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-logout-header:hover {
    background: rgba(231, 76, 60, 0.4);
    border-color: #e74c3c;
    transform: scale(1.05);
}

/* ==========================================
   MAIN CONTENT
   ========================================== */
.lobby-content {
    flex: 1;
    display: flex;
    gap: 20px;
    padding: 20px;
    overflow: hidden;
    min-height: 0;
}

/* ==========================================
   PANELS
   ========================================== */
.lobby-panel {
    background: var(--bg-secondary);
    border-radius: 15px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    min-height: 0;
}

.rooms-panel {
    flex: 1;
    min-width: 300px;
}

.chat-panel {
    width: 380px;
    min-width: 320px;
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px 20px;
    background: rgba(0,0,0,0.2);
    border-bottom: 1px solid rgba(255,255,255,0.05);
    flex-shrink: 0;
}

.panel-header h3 {
    margin: 0;
    font-size: 1.1em;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ==========================================
   FILTROS DE SALAS - Em linha
   ========================================== */
.rooms-filters {
    padding: 12px 15px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.rooms-search {
    flex: 1;
    min-width: 150px;
}

.rooms-search .input-sm {
    width: 100%;
}

.capacity-filters {
    display: flex;
    gap: 6px;
}

.filter-btn {
    padding: 8px 14px;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 0.85em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.filter-btn:hover {
    background: rgba(255,255,255,0.12);
    border-color: rgba(255,255,255,0.2);
}

.filter-btn.active {
    background: var(--accent-blue);
    border-color: var(--accent-blue);
    color: white;
}

.input-sm {
    padding: 10px 14px;
    font-size: 0.9em;
    background: var(--bg-tertiary);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 8px;
    color: var(--text-primary);
}

.input-sm::placeholder {
    color: var(--text-muted);
}

.input-sm:focus {
    outline: none;
    border-color: var(--accent-blue);
}

/* ==========================================
   LISTA DE SALAS
   ========================================== */
.rooms-list {
    flex: 1;
    overflow-y: auto;
    padding: 10px 15px;
    min-height: 0;
}

.no-rooms {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
}

.no-rooms .icon {
    font-size: 3em;
    display: block;
    margin-bottom: 15px;
}

.room-card {
    background: var(--bg-tertiary);
    border-radius: 10px;
    padding: 12px 15px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: all 0.2s;
}

.room-card:hover {
    background: rgba(255,255,255,0.1);
}

.room-card.full {
    opacity: 0.6;
}

.room-card.playing {
    border-left: 3px solid var(--accent-yellow);
}

.room-card.team-mode {
    border-left: 3px solid #9b59b6;
}

.room-card.team-mode.playing {
    border-left: 3px solid #9b59b6;
}

.room-team-badge {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    background: rgba(155, 89, 182, 0.15);
    border: 1px solid rgba(155, 89, 182, 0.35);
    color: #c39bd3;
    border-radius: 10px;
    padding: 2px 8px;
    font-size: 0.72em;
    font-weight: 700;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.room-info {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.room-info-line1,
.room-info-line2 {
    display: contents;
}

.room-code {
    font-family: 'Courier New', monospace;
    font-weight: bold;
    font-size: 1.2em;
    color: var(--accent-yellow);
    letter-spacing: 2px;
}

.room-players {
    color: var(--text-secondary);
    font-size: 0.9em;
    display: flex;
    align-items: center;
    gap: 5px;
}

.room-status {
    font-size: 0.8em;
    padding: 3px 10px;
    border-radius: 10px;
    font-weight: bold;
}

.room-status.waiting { 
    background: rgba(46, 204, 113, 0.2);
    color: #2ecc71; 
}

.room-status.deciding { 
    background: rgba(241, 196, 15, 0.2);
    color: #f1c40f; 
}

.room-status.playing { 
    background: rgba(52, 152, 219, 0.2);
    color: #3498db; 
}

.room-locked {
    color: var(--accent-yellow);
    font-size: 1em;
}

.room-actions {
    display: flex;
    gap: 8px;
}

/* ==========================================
   TABS DO PAINEL DIREITO
   ========================================== */
.panel-tabs {
    display: flex;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    flex-shrink: 0;
}

.tab-btn {
    flex: 1;
    padding: 12px 15px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 0.95em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
    border-bottom: 3px solid transparent;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.tab-btn:hover {
    color: var(--text-secondary);
    background: rgba(255,255,255,0.05);
}

.tab-btn.active {
    color: var(--accent-blue);
    border-bottom-color: var(--accent-blue);
}

.tab-count {
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.8em;
    font-weight: normal;
    line-height: 1.4;
}

.tab-count:not(:empty) {
    background: rgba(255,255,255,0.15);
}

.tab-content {
    display: none;
    flex: 1;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
}

.tab-content.active {
    display: flex;
}


/* ==========================================
   MENSAGENS FIXADAS
   ========================================== */
.pinned-messages {
    background: rgba(241, 196, 15, 0.1);
    border-bottom: 1px solid rgba(241, 196, 15, 0.3);
    padding: 10px 15px;
    max-height: 175px;
    overflow-y: auto;
    flex-shrink: 0;
}

.pinned-message {
    background: rgba(241, 196, 15, 0.15);
    border-left: 3px solid #f1c40f;
    padding: 8px 12px;
    margin-bottom: 6px;
    border-radius: 0 6px 6px 0;
    font-size: 0.9em;
    display: flex;
    align-items: center;
    gap: 8px;
}

.pinned-message:last-child {
    margin-bottom: 0;
}

.pinned-icon {
    color: #f1c40f;
}

.pinned-text {
    color: #ecf0f1;
}

/* ==========================================
   CHAT
   ========================================== */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 0;
}

.chat-message {
    font-size: 0.9em;
    line-height: 1.4;
}

.chat-message.system {
    color: var(--text-muted);
    font-style: italic;
    text-align: center;
}

.msg-author {
    font-weight: bold;
    margin-right: 5px;
}

.msg-text {
    word-break: break-word;
}

.msg-timestamp {
    display: block;
    font-size: 0.75em;
    color: var(--text-muted);
    margin-bottom: 1px;
    opacity: 0.7;
}

.chat-input-container {
    display: flex;
    gap: 10px;
    padding: 15px;
    border-top: 1px solid rgba(255,255,255,0.1);
    flex-shrink: 0;
}

.chat-input-container .input {
    flex: 1;
}

/* ==========================================
   LISTA DE JOGADORES - Com pesquisa e ranking
   ========================================== */
.players-filters {
    padding: 10px 15px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    display: flex;
    gap: 10px;
    align-items: center;
    flex-shrink: 0;
}

.players-search {
    flex: 1;
}

.players-search .input-sm {
    width: 100%;
}

.sort-select {
    padding: 8px 12px;
    background: var(--bg-tertiary);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 0.85em;
    cursor: pointer;
}

.sort-select:focus {
    outline: none;
    border-color: var(--accent-blue);
}

.players-list {
    flex: 1;
    overflow-y: auto;
    padding: 10px 15px;
    min-height: 0;
}

.no-players {
    text-align: center;
    color: var(--text-muted);
    padding: 30px;
}

.no-players .icon {
    font-size: 2.5em;
    display: block;
    margin-bottom: 10px;
}

.player-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    background: rgba(255,255,255,0.05);
    border-radius: 8px;
    margin-bottom: 8px;
    transition: all 0.2s;
}

.player-item:hover {
    background: rgba(255,255,255,0.1);
}

.player-item.is-me {
    border: 1px solid var(--accent-yellow);
    background: rgba(241, 196, 15, 0.1);
}

.player-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2em;
    background: var(--accent-blue);
    color: white;
    font-weight: bold;
    flex-shrink: 0;
}

.player-details {
    flex: 1;
    min-width: 0;
}

.player-name {
    font-weight: bold;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.player-item.is-me .player-name::after {
    content: ' (Tu)';
    color: var(--accent-yellow);
    font-weight: normal;
    font-size: 0.85em;
}

.player-rank {
    font-size: 0.8em;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 5px;
}

.player-elo {
    color: var(--accent-yellow);
    font-weight: bold;
}

.player-status {
    font-size: 0.75em;
    padding: 3px 8px;
    border-radius: 10px;
    background: rgba(255,255,255,0.1);
    color: var(--text-muted);
    flex-shrink: 0;
}

.player-status.in-lobby {
    background: rgba(46, 204, 113, 0.2);
    color: #2ecc71;
}

.player-status.in-room {
    background: rgba(241, 196, 15, 0.2);
    color: #f1c40f;
}

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

.modal-overlay.visible {
    display: flex;
}

.modal-box {
    background: var(--bg-secondary);
    border-radius: 15px;
    padding: 25px;
    max-width: 420px;
    width: 90%;
    animation: popIn 0.3s ease-out;
    box-shadow: 0 15px 50px rgba(0,0,0,0.5);
}

@keyframes popIn {
    from {
        transform: scale(0.9) translateY(-20px);
        opacity: 0;
    }
    to {
        transform: scale(1) translateY(0);
        opacity: 1;
    }
}

.modal-box h3 {
    margin: 0 0 20px 0;
    text-align: center;
    color: var(--accent-yellow);
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 10px;
    color: var(--text-secondary);
}

/* Color Selector */
.color-selector {
    display: flex;
    gap: 15px;
    justify-content: center;
}

.color-option {
    width: 55px;
    height: 55px;
    border-radius: 50%;
    cursor: pointer;
    border: 3px solid transparent;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.color-option:hover:not(.taken) {
    transform: scale(1.1);
    box-shadow: 0 0 15px rgba(255,255,255,0.3);
}

.color-option.selected {
    border-color: white;
    box-shadow: 0 0 20px rgba(255,255,255,0.6);
    transform: scale(1.05);
}

.color-option.taken {
    opacity: 0.35;
    cursor: not-allowed;
    filter: grayscale(40%);
}

.color-option.taken::after {
    content: '✗';
    position: absolute;
    font-size: 1.6em;
    color: white;
    text-shadow: 0 2px 4px rgba(0,0,0,0.8);
}

/* Player Count Selector */
.player-count-selector {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.count-btn {
    width: 50px;
    height: 50px;
    border-radius: 10px;
    border: 2px solid rgba(255,255,255,0.2);
    background: transparent;
    color: var(--text-secondary);
    font-size: 1.2em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
}

.count-btn:hover {
    border-color: var(--accent-blue);
    color: white;
}

.count-btn.active {
    background: var(--accent-blue);
    border-color: var(--accent-blue);
    color: white;
}

/* Password Input */
.password-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.password-input-wrapper .input {
    flex: 1;
    padding-right: 45px;
}

.password-toggle {
    position: absolute;
    right: 8px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.1em;
    padding: 5px 8px;
    opacity: 0.6;
    transition: opacity 0.2s;
}

.password-toggle:hover {
    opacity: 1;
}

.modal-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 25px;
}

/* ==========================================
   BUTTONS
   ========================================== */
.btn-sm {
    padding: 8px 15px;
    font-size: 0.9em;
}

/* ==========================================
   RESPONSIVE
   ========================================== */
@media (max-width: 900px) {
    .lobby-content {
        flex-direction: column;
        overflow-y: auto;
    }

    .chat-panel {
        width: 100%;
        min-height: 1050px;
    }

    .rooms-panel {
        min-height: 450px;
    }

    .rooms-list {
        max-height: 860px;
    }


    /* Header: logo centrado na linha 1; stats à esquerda e acções à direita na linha 2 */
    .lobby-header {
        display: grid;
        grid-template-columns: 1fr auto;
        gap: 6px 12px;
        align-items: center;
    }

    /* Dissolve o contentor intermédio — logo e stats passam a ser itens directos do grid */
    .header-left {
        display: contents;
    }

    /* Linha 1: nome do jogo centrado */
    .lobby-logo {
        grid-column: 1 / -1;
        grid-row: 1;
        justify-content: center;
    }

    /* Linha 2, coluna esquerda: contadores alinhados à esquerda */
    .header-stats {
        grid-column: 1;
        grid-row: 2;
        justify-content: flex-start;
        flex-wrap: wrap;
        gap: 8px;
    }

    /* Linha 2, coluna direita: restante conteúdo alinhado à direita */
    .header-right {
        grid-column: 2;
        grid-row: 2;
        align-self: center;
    }
}

@media (max-width: 700px) {
    /* Header: 3 linhas, todas centradas */
    .lobby-header {
        display: grid;
        grid-template-columns: 1fr;
        gap: 10px;
        padding: 12px 15px;
    }

    /* Dissolve o contentor intermédio */
    .header-left {
        display: contents;
    }

    /* Linha 1: nome do jogo centrado */
    .lobby-logo {
        grid-column: 1;
        grid-row: 1;
        justify-content: center;
    }

    .lobby-logo h1 {
        font-size: 1.3em;
    }

    /* Linha 2: contadores centrados */
    .header-stats {
        grid-column: 1;
        grid-row: 2;
        justify-content: center;
        flex-wrap: wrap;
        gap: 8px;
    }

    /* Linha 3: acções/nome centrados */
    .header-right {
        grid-column: 1;
        grid-row: 3;
        justify-content: center;
        padding-top: 8px;
        border-top: 1px solid rgba(255, 255, 255, 0.1);
    }

    /* Título "Salas" em linha separada dos botões de acção */
    .panel-header {
        flex-wrap: wrap;
        gap: 10px;
    }

    .panel-header h3 {
        width: 100%;
        justify-content: center;
    }

    .rooms-filters {
        flex-direction: column;
    }

    .rooms-search {
        width: 100%;
    }

    .capacity-filters {
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 500px) {
    .lobby-header {
        padding: 10px 12px;
    }
    
    .lobby-logo h1 {
        font-size: 1.1em;
    }
    
    .stat-badge {
        padding: 5px 10px;
        font-size: 0.8em;
    }
    
    .player-info-header span {
        font-size: 0.9em;
    }
    
    .lobby-content {
        padding: 10px;
        gap: 10px;
    }
    
    .room-card {
        flex-direction: column;
        gap: 10px;
        align-items: stretch;
    }

    .room-info {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }

    .room-info-line1,
    .room-info-line2 {
        display: flex;
        align-items: center;
        gap: 10px;
    }

    .room-actions {
        justify-content: stretch;
    }

    .room-actions .btn {
        flex: 1;
    }
}

/* ==========================================
   SCROLLBAR
   ========================================== */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(0,0,0,0.1);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: var(--text-muted);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #95a5a6;
}

/* ==========================================
   TOP 10 RANKING
   ========================================== */
.top10-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.top10-header h3 {
    margin: 0;
    font-size: 1em;
    color: var(--text-primary);
}

.btn-refresh {
    background: rgba(255,255,255,0.1);
    border: none;
    padding: 6px 10px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9em;
    transition: all 0.2s;
}

.btn-refresh:hover {
    background: rgba(255,255,255,0.2);
    transform: rotate(180deg);
}

.top10-list {
    padding: 10px;
    overflow-y: auto;
    max-height: calc(100% - 50px);
}

.top10-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    color: var(--text-muted);
}

.top10-loading .spinner {
    width: 30px;
    height: 30px;
    border: 3px solid rgba(255,255,255,0.1);
    border-top-color: var(--accent-gold);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 10px;
}

.top10-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: rgba(255,255,255,0.03);
    border-radius: 10px;
    margin-bottom: 8px;
    transition: all 0.2s;
}

.top10-item:hover {
    background: rgba(255,255,255,0.08);
}

.top10-item.is-me {
    background: rgba(52, 152, 219, 0.15);
    border: 1px solid rgba(52, 152, 219, 0.3);
}

.top10-position {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1em;
    border-radius: 8px;
    flex-shrink: 0;
}

.top10-position.gold {
    background: linear-gradient(135deg, #f1c40f, #f39c12);
    color: #1a1a2e;
    box-shadow: 0 2px 10px rgba(241, 196, 15, 0.3);
}

.top10-position.silver {
    background: linear-gradient(135deg, #bdc3c7, #95a5a6);
    color: #1a1a2e;
}

.top10-position.bronze {
    background: linear-gradient(135deg, #e67e22, #d35400);
    color: white;
}

.top10-position.normal {
    background: rgba(255,255,255,0.1);
    color: var(--text-secondary);
}

.top10-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1.1em;
    color: white;
    flex-shrink: 0;
}

.top10-info {
    flex: 1;
    min-width: 0;
}

.top10-name {
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.top10-stats {
    display: flex;
    gap: 10px;
    font-size: 0.8em;
    color: var(--text-muted);
    margin-top: 2px;
}

.top10-elo {
    font-weight: bold;
    font-size: 1.1em;
    color: var(--accent-gold);
    flex-shrink: 0;
}

.top10-empty {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
}

.top10-empty .icon {
    font-size: 2.5em;
    margin-bottom: 10px;
    display: block;
}

/* Ajuste para 3 tabs */
.panel-tabs {
    display: flex;
}

.panel-tabs .tab-btn {
    flex: 1;
    padding: 10px 8px;
    font-size: 0.85em;
}

/* 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;
}

/* ==========================================
   MATCHMAKING & CONVITES
   ========================================== */

/* Botões do header do painel de salas */
.panel-header-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

/* Barra de Status Matchmaking (fixa no fundo) */
.matchmaking-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(90deg, #1a1a2e, #2c3e50);
    border-top: 2px solid #f39c12;
    padding: 10px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    z-index: 500;
    color: white;
    gap: 12px;
}

.matchmaking-bar-content {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.95em;
}

.matchmaking-spinner {
    animation: spin 1.5s linear infinite;
    display: inline-block;
}

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

/* Seletor de nível (modal matchmaking) */
.level-selector {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.level-btn {
    padding: 10px 16px;
    border: 2px solid #2c3e50;
    border-radius: 8px;
    background: transparent;
    color: #bdc3c7;
    cursor: pointer;
    text-align: left;
    font-size: 0.9em;
    transition: all 0.2s;
    width: 100%;
}

.level-btn:hover {
    border-color: #7f8c8d;
    color: white;
}

.level-btn.active {
    border-color: var(--accent-green, #27ae60);
    background: rgba(39, 174, 96, 0.15);
    color: white;
}

/* Seletor de modo de jogo (modal matchmaking) */
.mode-selector {
    display: flex;
    gap: 10px;
}

.mode-btn {
    flex: 1;
    padding: 10px 12px;
    border: 2px solid #2c3e50;
    border-radius: 8px;
    background: transparent;
    color: #bdc3c7;
    cursor: pointer;
    font-size: 0.9em;
    transition: all 0.2s;
}

.mode-btn:hover {
    border-color: #7f8c8d;
    color: white;
}

.mode-btn.active {
    border-color: var(--accent-blue, #2980b9);
    background: rgba(41, 128, 185, 0.15);
    color: white;
}

/* === Modal Entrar Sala: Badge e Seletor de Equipas === */
.join-team-badge-wrap {
    text-align: center;
    margin-bottom: 10px;
}

.join-team-badge-pill {
    display: inline-block;
    background: rgba(241,196,15,0.10);
    border: 1px solid rgba(241,196,15,0.35);
    color: var(--accent-yellow);
    border-radius: 20px;
    padding: 5px 16px;
    font-size: 0.82em;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.team-slot-selector {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
}

.team-slot-card {
    border-radius: 10px;
    padding: 12px 16px;
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.07);
}

.team-slot-a {
    border-left: 3px solid #3498DB;
}

.team-slot-b {
    border-left: 3px solid #2ABB68;
}

.team-slot-header {
    font-size: 0.72em;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    font-weight: 700;
    margin-bottom: 10px;
}

.team-slot-a .team-slot-header {
    color: #3498DB;
}

.team-slot-b .team-slot-header {
    color: #2ABB68;
}

.team-slot-row {
    display: flex;
    gap: 24px;
    justify-content: center;
}

.team-slot-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.team-slot-name {
    font-size: 0.75em;
    color: var(--text-secondary);
    font-weight: 500;
}

.team-vs-divider {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-muted);
    font-size: 0.72em;
    font-weight: 700;
    letter-spacing: 2px;
}

.team-vs-divider::before,
.team-vs-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: rgba(255,255,255,0.08);
}

/* Botão de Convite (sala de espera) */
.btn-invite {
    background: linear-gradient(135deg, #8e44ad, #6c3483);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 10px 20px;
    font-size: 0.9em;
    font-weight: bold;
    cursor: pointer;
    margin-top: 12px;
    width: 100%;
    transition: all 0.2s;
}

.btn-invite:hover {
    background: linear-gradient(135deg, #9b59b6, #7d3c98);
    transform: translateY(-1px);
}

/* Contadores de convites restantes */
.invite-stats {
    display: flex;
    gap: 12px;
    margin-top: 8px;
    flex-wrap: wrap;
    justify-content: center;
}

.invite-stat {
    font-size: 0.8em;
    color: #bdc3c7;
    background: rgba(255,255,255,0.06);
    border-radius: 6px;
    padding: 4px 10px;
    white-space: nowrap;
}

/* ==========================================
   LOBBY DE CONVIDADOS
   ========================================== */
.guest-banner {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    background: var(--bg-secondary);
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    flex-shrink: 0;
    border-bottom: 2px solid rgba(149, 165, 166, 0.2);
}

/* ==========================================
   BANNER DE REJOIN DE PARTIDA EM CURSO
   ========================================== */

.rejoin-banner {
    display: flex;
    align-items: center;
    gap: 12px;
    background: linear-gradient(135deg, rgba(52, 152, 219, 0.2), rgba(41, 128, 185, 0.1));
    border: 1px solid rgba(52, 152, 219, 0.4);
    border-radius: 10px;
    padding: 12px 16px;
    margin: 0 0 12px 0;
    animation: fadeIn 0.3s ease;
}

.rejoin-banner-text {
    flex: 1;
    font-size: 0.95em;
    color: #fff;
}

.rejoin-banner-btn {
    background: #3498db;
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 8px 16px;
    font-size: 0.9em;
    cursor: pointer;
    white-space: nowrap;
    font-weight: bold;
}

.rejoin-banner-btn:hover {
    background: #2980b9;
}

.rejoin-banner-close {
    background: transparent;
    border: none;
    color: #aaa;
    font-size: 1.1em;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
}

.rejoin-banner-close:hover {
    background: rgba(255,255,255,0.1);
    color: #fff;
}
