/**
 * global-lobby.css
 * Styles for the Global Lobby modal (room directory, chat, room cards).
 * Matches the existing GameX modern UI glass-panel aesthetic.
 */

/* ═══════════════════════════════════════════════════════════════════════════
   CONTAINER
   ═══════════════════════════════════════════════════════════════════════════ */

.gl-container {
    position: relative;
    background: rgba(15, 15, 20, 0.97);
    border: 1px solid rgba(0, 229, 255, 0.3);
    box-shadow:
        0 20px 60px rgba(0, 0, 0, 0.9),
        0 0 15px rgba(0, 229, 255, 0.1);
    backdrop-filter: blur(12px);
    border-radius: 16px;
    width: 90vw;
    max-width: 800px;
    height: 80vh;
    max-height: 600px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* ═══════════════════════════════════════════════════════════════════════════
   HEADER
   ═══════════════════════════════════════════════════════════════════════════ */

.gl-header {
    display: flex;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid rgba(0, 229, 255, 0.2);
    gap: 12px;
    flex-shrink: 0;
}

.gl-title {
    margin: 0;
    color: #00e5ff;
    font-family: 'Fredoka One', cursive;
    font-size: 20px;
    letter-spacing: 2px;
    text-transform: uppercase;
    flex-shrink: 0;
}

.gl-player-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
    font-family: 'Nunito', sans-serif;
    font-size: 12px;
}

.gl-badge-name {
    color: #fff;
    font-weight: bold;
}

.gl-badge-rank {
    font-size: 11px;
    font-weight: bold;
}

.gl-close-btn {
    background: none;
    border: none;
    color: #ff5555;
    font-size: 24px;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
    flex-shrink: 0;
    transition: transform 0.15s;
}

.gl-close-btn:hover {
    transform: scale(1.2);
}

/* ═══════════════════════════════════════════════════════════════════════════
   MOBILE TABS (hidden on desktop)
   ═══════════════════════════════════════════════════════════════════════════ */

.gl-tabs {
    display: none;
    /* Hidden on desktop */
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
}

.gl-tab {
    flex: 1;
    background: none;
    border: none;
    color: #888;
    padding: 10px;
    font-family: 'Nunito', sans-serif;
    font-size: 13px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1px;
    cursor: pointer;
    transition: all 0.2s;
    border-bottom: 2px solid transparent;
}

.gl-tab.active {
    color: #00e5ff;
    border-bottom-color: #00e5ff;
}

.gl-tab:hover:not(.active) {
    color: #ccc;
}

/* ═══════════════════════════════════════════════════════════════════════════
   BODY — Two-Column Desktop Layout
   ═══════════════════════════════════════════════════════════════════════════ */

.gl-body {
    display: flex;
    flex: 1;
    overflow: hidden;
    min-height: 0;
}

/* ═══════════════════════════════════════════════════════════════════════════
   ROOMS PANEL
   ═══════════════════════════════════════════════════════════════════════════ */

.gl-rooms-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    border-right: 1px solid rgba(0, 229, 255, 0.15);
    min-width: 0;
}

.gl-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    flex-shrink: 0;
}

.gl-panel-title {
    color: #888;
    font-family: 'Nunito', sans-serif;
    font-size: 11px;
    font-weight: bold;
    letter-spacing: 2px;
    text-transform: uppercase;
}

.gl-refresh-btn {
    background: none;
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #888;
    font-size: 16px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    transition: all 0.2s;
}

.gl-refresh-btn:hover {
    color: #00e5ff;
    border-color: rgba(0, 229, 255, 0.4);
}

.gl-rooms-list {
    flex: 1;
    overflow-y: auto;
    padding: 0 12px 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Scrollbar */
.gl-rooms-list::-webkit-scrollbar {
    width: 4px;
}

.gl-rooms-list::-webkit-scrollbar-thumb {
    background: rgba(0, 229, 255, 0.3);
    border-radius: 2px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   ROOM CARD
   ═══════════════════════════════════════════════════════════════════════════ */

.gl-room-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(0, 229, 255, 0.2);
    border-radius: 12px;
    padding: 14px 16px;
    transition: all 0.2s ease;
    cursor: default;
}

.gl-room-card:hover {
    background: rgba(0, 229, 255, 0.06);
    border-color: rgba(0, 229, 255, 0.5);
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

.gl-room-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.gl-host-badge {
    display: flex;
    align-items: center;
    gap: 6px;
}

.gl-host-icon {
    font-size: 14px;
}

.gl-host-name {
    color: #fff;
    font-family: 'Nunito', sans-serif;
    font-size: 14px;
    font-weight: bold;
    letter-spacing: 0.5px;
}

.gl-player-count {
    color: #00e5ff;
    font-family: 'Fredoka One', cursive;
    font-size: 16px;
    letter-spacing: 1px;
}

.gl-room-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.gl-mode-badge {
    padding: 3px 8px;
    border-radius: 10px;
    font-size: 10px;
    font-weight: bold;
    text-transform: uppercase;
    font-family: 'Nunito', sans-serif;
    letter-spacing: 0.5px;
}

.gl-mode-2p {
    background: rgba(0, 212, 255, 0.15);
    color: #00D4FF;
}

.gl-mode-3p {
    background: rgba(255, 152, 0, 0.15);
    color: #FF9800;
}

.gl-mode-4p {
    background: rgba(156, 39, 176, 0.15);
    color: #9C27B0;
}

.gl-status-badge {
    color: #4CAF50;
    font-size: 10px;
    font-weight: bold;
    letter-spacing: 1px;
    font-family: 'Nunito', sans-serif;
}

.gl-time-ago {
    color: #666;
    font-size: 10px;
    font-family: 'Nunito', sans-serif;
    margin-left: auto;
}

.gl-join-btn {
    background: rgba(76, 175, 80, 0.15);
    border: 1px solid #4CAF50;
    color: #4CAF50;
    padding: 7px 20px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: bold;
    font-family: 'Nunito', sans-serif;
    letter-spacing: 1px;
    cursor: pointer;
    transition: all 0.2s;
    float: right;
}

.gl-join-btn:hover {
    background: #4CAF50;
    color: #000;
    transform: scale(1.05);
}

/* ═══════════════════════════════════════════════════════════════════════════
   EMPTY STATE
   ═══════════════════════════════════════════════════════════════════════════ */

.gl-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    text-align: center;
    flex: 1;
    text-rendering: geometricPrecision;
    -webkit-font-smoothing: antialiased;
}

.gl-empty-icon {
    width: 56px;
    height: 56px;
    display: grid;
    place-items: center;
    margin-bottom: 12px;
}

.gl-empty-icon-emoji {
    font-size: 48px;
    line-height: 1;
}

.gl-empty-icon-svg {
    display: none;
    width: 52px;
    height: 52px;
    stroke: #00e5ff;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
    vector-effect: non-scaling-stroke;
}

.gl-empty-icon.use-svg-fallback .gl-empty-icon-emoji {
    display: none;
}

.gl-empty-icon.use-svg-fallback .gl-empty-icon-svg {
    display: block;
}

.gl-empty-state h3 {
    color: #e8fbff;
    font-family: 'Fredoka One', cursive;
    font-size: 18px;
    margin: 0 0 6px 0;
    letter-spacing: 0.4px;
}

.gl-empty-state p {
    color: #a6c9d2;
    font-family: 'Nunito', sans-serif;
    font-size: 14px;
    font-weight: 600;
    margin: 0;
}

/* ═══════════════════════════════════════════════════════════════════════════
   CHAT PANEL
   ═══════════════════════════════════════════════════════════════════════════ */

.gl-chat-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    --chat-font-size: 12px;
}

.gl-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-height: 0;
}

.gl-chat-messages::-webkit-scrollbar {
    width: 4px;
}

.gl-chat-messages::-webkit-scrollbar-thumb {
    background: rgba(0, 229, 255, 0.3);
    border-radius: 2px;
}

.gl-chat-message {
    background: rgba(255, 255, 255, 0.04);
    padding: 6px 10px;
    border-radius: 8px;
    font-family: 'Inter', 'Noto Sans', sans-serif;
    font-size: var(--chat-font-size);
    line-height: 1.4;
    word-break: break-word;
    border-left: 3px solid #00e5ff;
}

.gl-chat-timestamp {
    color: #666;
    font-size: calc(var(--chat-font-size) - 2px);
    margin-right: 8px;
    font-family: 'Inter', 'Noto Sans', sans-serif;
    opacity: 0.8;
}

.gl-chat-sender {
    color: #00e5ff;
    font-weight: bold;
    margin-right: 6px;
    font-size: var(--chat-font-size);
}

.gl-chat-text {
    color: #ccc;
    font-size: var(--chat-font-size);
}

.gl-chat-input-row {
    display: flex;
    gap: 8px;
    padding: 10px 12px;
    border-top: 1px solid rgba(0, 229, 255, 0.15);
    flex-shrink: 0;
}

.gl-chat-input {
    flex: 1;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(0, 229, 255, 0.25);
    border-radius: 20px;
    padding: 8px 14px;
    color: #fff;
    font-family: 'Inter', 'Noto Sans', sans-serif;
    font-size: 12px;
    outline: none;
    transition: border-color 0.2s;
}

.gl-chat-input:focus {
    border-color: #00e5ff;
}

.gl-chat-input::placeholder {
    color: #555;
}

.gl-chat-send-btn {
    background: rgba(0, 229, 255, 0.15);
    border: 1px solid rgba(0, 229, 255, 0.3);
    color: #00e5ff;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.gl-chat-send-btn:hover {
    background: #00e5ff;
    color: #000;
}

/* ═══════════════════════════════════════════════════════════════════════════
   FOOTER
   ═══════════════════════════════════════════════════════════════════════════ */

.gl-footer {
    display: flex;
    gap: 12px;
    padding: 14px 20px;
    border-top: 1px solid rgba(0, 229, 255, 0.2);
    flex-shrink: 0;
}

.gl-create-btn {
    flex: 1;
    background: linear-gradient(135deg, #00e5ff, #00838f) !important;
    color: #000 !important;
    border: none !important;
    font-size: 13px !important;
    padding: 12px 16px !important;
}

.gl-create-btn:hover {
    box-shadow: 0 0 20px rgba(0, 229, 255, 0.4);
    transform: scale(1.02);
}

.gl-back-btn {
    flex-shrink: 0;
    padding: 10px 20px !important;
}

/* ═══════════════════════════════════════════════════════════════════════════
   MOBILE RESPONSIVE
   ═══════════════════════════════════════════════════════════════════════════ */

@media (max-width: 768px) {
    .gl-container {
        width: 95vw;
        height: 90vh;
        max-height: none;
        border-radius: 12px;
    }

    .gl-title {
        font-size: 16px;
    }

    .gl-tabs {
        display: flex;
        /* Show tabs on mobile */
    }

    .gl-body {
        flex-direction: column;
    }

    .gl-rooms-panel {
        flex: 1;
        border-right: none;
    }

    .gl-chat-panel {
        flex: 1;
    }

    /* Tab-based panel visibility on mobile */
    .gl-panel-hidden {
        display: none !important;
    }

    .gl-footer {
        flex-direction: column;
        gap: 8px;
        padding: 10px 16px;
    }

    .gl-room-card {
        padding: 12px;
    }

    .gl-player-badge {
        display: none;
        /* Hide on mobile for space */
    }
}

@media (max-width: 480px) {
    .gl-container {
        width: 100vw;
        height: 100vh;
        border-radius: 0;
        border: none;
    }

    .gl-header {
        padding: 12px 16px;
    }

    .gl-title {
        font-size: 14px;
    }
}

/* ═══════════════════════════════════════════════════════════════════
   PUBLIC ROOM CREATION — Player Picker, Confirmation, Start Match
   ═══════════════════════════════════════════════════════════════════ */

/* Player count picker in footer */
.gl-player-picker {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    justify-content: center;
}

.gl-pick-label {
    color: #00e5ff;
    font-size: 11px;
    font-weight: bold;
    letter-spacing: 1px;
    margin-right: 4px;
}

.gl-pick-btn {
    background: linear-gradient(135deg, rgba(0, 229, 255, 0.2), rgba(0, 131, 143, 0.2));
    border: 1px solid rgba(0, 229, 255, 0.5);
    color: #00e5ff;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
}

.gl-pick-btn:hover {
    background: linear-gradient(135deg, rgba(0, 229, 255, 0.4), rgba(0, 131, 143, 0.4));
    transform: scale(1.05);
    box-shadow: 0 0 12px rgba(0, 229, 255, 0.3);
}

.gl-pick-cancel {
    background: rgba(255, 60, 60, 0.15);
    border: 1px solid rgba(255, 60, 60, 0.4);
    color: #ff5252;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
}

.gl-pick-cancel:hover {
    background: rgba(255, 60, 60, 0.3);
}

/* Cancel room button */
.gl-cancel-room-btn {
    width: 100%;
    background: linear-gradient(135deg, rgba(255, 60, 60, 0.15), rgba(200, 40, 40, 0.15)) !important;
    border: 1px solid rgba(255, 60, 60, 0.4) !important;
    color: #ff5252 !important;
    padding: 12px;
    font-weight: bold;
    letter-spacing: 1px;
}

.gl-cancel-room-btn:hover {
    background: linear-gradient(135deg, rgba(255, 60, 60, 0.3), rgba(200, 40, 40, 0.3)) !important;
}

/* Host's own room card highlight */
.gl-my-room {
    border: 1px solid rgba(0, 229, 255, 0.6) !important;
    background: rgba(0, 229, 255, 0.08) !important;
    box-shadow: 0 0 15px rgba(0, 229, 255, 0.15), inset 0 0 20px rgba(0, 229, 255, 0.03);
}

.gl-my-room-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
}

.gl-your-room-badge {
    background: linear-gradient(135deg, #00e5ff, #00838f);
    color: #000;
    padding: 6px 16px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: bold;
    letter-spacing: 1px;
    text-align: center;
    flex: 1;
}

.gl-delete-room-btn {
    background: rgba(255, 60, 60, 0.15);
    color: #ff4444;
    border: 1px solid rgba(255, 60, 60, 0.3);
    border-radius: 6px;
    padding: 5px 10px;
    font-size: 13px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
    line-height: 1;
}

.gl-delete-room-btn:hover {
    background: rgba(255, 60, 60, 0.3);
    border-color: rgba(255, 60, 60, 0.6);
    color: #ff6666;
    transform: scale(1.1);
}

/* Full room badge */
.gl-full-badge {
    background: rgba(136, 136, 136, 0.2);
    color: #888;
    padding: 6px 16px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: bold;
    letter-spacing: 1px;
    text-align: center;
    display: block;
    margin-top: 8px;
}

/* ═══════════════════════════════════════════════════════════════════
   OVERLAY MODALS (Confirmation + Start Match)
   ═══════════════════════════════════════════════════════════════════ */

.gl-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    border-radius: 12px;
}

/* Confirmation card */
.gl-confirm-card {
    background: rgba(20, 20, 20, 0.95);
    border: 1px solid rgba(0, 229, 255, 0.4);
    border-radius: 12px;
    padding: 32px 40px;
    text-align: center;
    max-width: 340px;
    width: 90%;
}

.gl-confirm-icon {
    font-size: 36px;
    margin-bottom: 8px;
}

.gl-confirm-card h3 {
    color: #00e5ff;
    font-size: 16px;
    margin: 0 0 16px 0;
    letter-spacing: 2px;
}

.gl-confirm-code {
    font-family: 'Inter', 'Noto Sans', sans-serif;
    font-size: 28px;
    font-weight: bold;
    color: #00FFFF;
    letter-spacing: 4px;
    padding: 12px;
    background: rgba(0, 255, 255, 0.05);
    border: 1px solid rgba(0, 255, 255, 0.2);
    border-radius: 8px;
    margin-bottom: 12px;
}

.gl-confirm-card p {
    color: #aaa;
    font-size: 13px;
    margin: 4px 0;
}

.gl-confirm-hint {
    color: #888 !important;
    font-size: 11px !important;
    margin-top: 12px !important;
}

.gl-confirm-ok {
    margin-top: 20px;
    min-width: 120px;
}

/* Start Match card */
.gl-start-card {
    background: rgba(20, 20, 20, 0.95);
    border: 1px solid rgba(0, 255, 100, 0.4);
    border-radius: 12px;
    padding: 32px 40px;
    text-align: center;
    max-width: 340px;
    width: 90%;
    animation: gl-pulse-green 1.5s ease-in-out infinite;
}

@keyframes gl-pulse-green {

    0%,
    100% {
        box-shadow: 0 0 15px rgba(0, 255, 100, 0.1);
    }

    50% {
        box-shadow: 0 0 25px rgba(0, 255, 100, 0.3);
    }
}

.gl-start-card h3 {
    color: #00FF64;
    font-size: 18px;
    margin: 0 0 8px 0;
    letter-spacing: 2px;
}

.gl-start-card p {
    color: #aaa;
    font-size: 13px;
    margin: 0 0 20px 0;
}

.gl-start-btn {
    background: linear-gradient(135deg, #00FF64, #00CC50) !important;
    color: #000 !important;
    border: none !important;
    padding: 14px 40px !important;
    font-size: 16px !important;
    font-weight: bold;
    letter-spacing: 2px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.gl-start-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 0 20px rgba(0, 255, 100, 0.4);
}

/* ═══════════════════════════════════════════════════════════════════════════
   QUICK CHAT PHRASES — Accordion Categories
   ═══════════════════════════════════════════════════════════════════════════ */

.gl-quick-chat-container {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.gl-quick-chat-container::-webkit-scrollbar {
    width: 4px;
}

.gl-quick-chat-container::-webkit-scrollbar-thumb {
    background: rgba(0, 229, 255, 0.3);
    border-radius: 2px;
}

.gl-chat-category {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(0, 229, 255, 0.2);
    border-radius: 8px;
    flex-shrink: 0;
}

.gl-category-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    cursor: pointer;
    transition: background 0.2s;
    user-select: none;
}

.gl-category-header:hover {
    background: rgba(0, 229, 255, 0.08);
}

.gl-category-title {
    color: #00e5ff;
    font-family: 'Nunito', sans-serif;
    font-size: 12px;
    font-weight: bold;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.gl-category-toggle {
    color: #888;
    font-size: 12px;
    transition: transform 0.2s;
    flex-shrink: 0;
    margin-left: 8px;
}

.gl-chat-category.open .gl-category-toggle {
    transform: rotate(180deg);
}

.gl-phrase-grid {
    display: none;
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
    padding: 8px 10px 10px;
    border-top: 1px solid rgba(0, 229, 255, 0.1);
}

.gl-chat-category.open .gl-phrase-grid {
    display: grid;
}

.gl-phrase-btn {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(0, 229, 255, 0.15);
    border-radius: 6px;
    padding: 6px 8px;
    color: #ccc;
    font-family: 'Nunito', sans-serif;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.gl-phrase-btn:hover {
    background: rgba(0, 229, 255, 0.15);
    border-color: rgba(0, 229, 255, 0.4);
    color: #fff;
    transform: translateY(-1px);
}

.gl-phrase-btn:active {
    transform: scale(0.98);
}

/* ═══════════════════════════════════════════════════════════════════════════
   FONT SIZE TOGGLE BUTTON
   ═══════════════════════════════════════════════════════════════════════════ */

.gl-font-toggle-btn {
    background: none;
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #888;
    font-size: 12px;
    font-weight: bold;
    cursor: pointer;
    padding: 3px 8px;
    border-radius: 6px;
    transition: all 0.2s;
    font-family: 'Nunito', sans-serif;
    margin-left: 8px;
}

.gl-font-toggle-btn:hover {
    color: #00e5ff;
    border-color: rgba(0, 229, 255, 0.4);
}

.gl-font-toggle-btn.active {
    color: #00e5ff;
    border-color: rgba(0, 229, 255, 0.5);
    background: rgba(0, 229, 255, 0.1);
}

/* Mobile: 2 columns */
@media (max-width: 768px) {
    .gl-phrase-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .gl-phrase-btn {
        font-size: 10px;
        padding: 5px 6px;
    }

    /* Chat panel layout on mobile */
    .gl-chat-panel {
        min-height: 0;
        overflow: hidden;
    }

    .gl-chat-messages {
        flex: 0 0 40%;
        min-height: 100px;
        max-height: 40%;
    }

    .gl-quick-chat-container {
        flex: 1;
        min-height: 0;
        border-top: 1px solid rgba(0, 229, 255, 0.15);
    }
}
