/**
 * @file playonline.css
 * @description Page-specific styles for MCHESS Play Online Arena & Matchmaking Lobby.
 */

.lobby-card {
    background: rgba(30, 41, 59, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 20px;
    backdrop-filter: blur(8px);
    margin-bottom: 16px;
    box-sizing: border-box;
    width: 100%;
}

/* Match Arena Card & Player Identity (Light & Dark Theme Compliant) */
.game-meta-card {
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 16px 20px;
    margin-bottom: 16px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04);
    transition: background 0.25s ease, border-color 0.25s ease;
}

.game-meta-card .player-box {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    font-size: 15px;
    color: #0f172a;
}

.game-meta-card .player-name {
    color: #0f172a;
    font-weight: 700;
    font-size: 15px;
    letter-spacing: 0.2px;
}

/* Dark Theme Overrides for Match Arena */
[data-theme="dark"] .game-meta-card,
body.dark-theme .game-meta-card,
html[data-theme="dark"] .game-meta-card {
    background: #0f172a !important;
    border-color: rgba(255, 255, 255, 0.12) !important;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4) !important;
}

[data-theme="dark"] .game-meta-card .player-box,
body.dark-theme .game-meta-card .player-box,
html[data-theme="dark"] .game-meta-card .player-box,
[data-theme="dark"] .game-meta-card .player-name,
body.dark-theme .game-meta-card .player-name,
html[data-theme="dark"] .game-meta-card .player-name {
    color: #f8fafc !important;
}

.lobby-grid-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 16px;
    margin-bottom: 16px;
    width: 100%;
}

.lobby-input-row {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.club-links-container {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.club-chip-btn {
    background: #0f172a;
    border: 1px solid rgba(56, 189, 248, 0.3);
    color: #f8fafc;
    padding: 9px 16px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
}

.club-chip-btn:hover {
    background: #1e293b;
    color: #38bdf8;
    border-color: #38bdf8;
    box-shadow: 0 4px 12px rgba(56, 189, 248, 0.3);
}

.lobby-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 12px;
    background: #0f172a;
    border-radius: 8px;
    overflow: hidden;
    color: #f8fafc;
}

.lobby-table th,
.lobby-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.lobby-table th {
    background: #1e293b;
    color: #94a3b8;
    font-weight: 600;
    font-size: 13px;
}

.lobby-table tr:hover {
    background: rgba(255, 255, 255, 0.03);
}

.setting-input {
    background: #0f172a;
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #f8fafc;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 13px;
    outline: none;
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.75);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
}

.modal-card {
    background: #1e293b;
    border: 1px solid rgba(56, 189, 248, 0.4);
    border-radius: 14px;
    padding: 26px;
    max-width: 440px;
    width: 90%;
    text-align: center;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
    animation: popIn 0.25s ease-out;
}

@keyframes popIn {
    from {
        transform: scale(0.9);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

.btn-action-ctrl {
    background: #1e293b;
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #cbd5e1;
    padding: 8px 14px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-action-ctrl:hover {
    background: #2563eb;
    color: #fff;
    border-color: #3b82f6;
}

/* Tap-to-Move Visual Highlights */
.square-selected {
    box-shadow: inset 0 0 14px 4px #facc15 !important;
}

.dest-highlight {
    position: relative;
    cursor: pointer !important;
}

.dest-highlight::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 26%;
    height: 26%;
    background: rgba(34, 197, 94, 0.7);
    border-radius: 50%;
    pointer-events: none;
    box-shadow: 0 0 8px rgba(34, 197, 94, 0.9);
    z-index: 10;
}

.dest-highlight.dest-capture::after {
    width: 80%;
    height: 80%;
    background: transparent;
    border: 3.5px solid rgba(239, 68, 68, 0.85);
    border-radius: 50%;
    box-shadow: 0 0 8px rgba(239, 68, 68, 0.8);
}

/* Fluid Mobile Responsiveness */
@media (max-width: 640px) {
    .lobby-card {
        padding: 16px 14px;
        margin-bottom: 14px;
    }

    .lobby-grid-row {
        grid-template-columns: 1fr;
        gap: 14px;
        margin-bottom: 14px;
    }

    .lobby-input-row {
        flex-direction: column;
        align-items: stretch !important;
        gap: 10px;
    }

    .lobby-input-row .setting-input,
    .lobby-input-row button,
    .lobby-input-row .btn-action {
        width: 100% !important;
        min-height: 44px;
        box-sizing: border-box;
        display: flex;
        align-items: center;
        justify-content: center;
        text-align: center;
    }

    .club-bar-inner {
        flex-direction: column;
        align-items: flex-start !important;
        gap: 12px !important;
    }

    .club-links-container {
        flex-direction: column;
        align-items: stretch !important;
        width: 100%;
        gap: 8px !important;
    }

    .club-chip-btn {
        width: 100% !important;
        min-height: 44px;
        box-sizing: border-box;
        justify-content: center;
        text-align: center;
    }

    .lobby-table th,
    .lobby-table td {
        padding: 10px 8px;
        font-size: 12px;
    }

    /* Mobile Match Arena Optimization */
    .mchess-board-shell {
        width: 100% !important;
        max-width: 100% !important;
        padding: 0 !important;
        margin: 0 auto !important;
    }

    .board-layout {
        grid-template-columns: 1fr !important;
        gap: 14px !important;
    }

    .game-meta-card {
        padding: 10px 12px !important;
        margin-bottom: 10px !important;
        border-radius: 8px !important;
    }

    .game-meta-card .player-box {
        font-size: 13.5px !important;
        gap: 6px !important;
    }

    .game-meta-card .tech-pill {
        font-size: 13px !important;
        padding: 4px 8px !important;
    }

    #p2pStatusBanner {
        padding: 8px 12px !important;
        font-size: 13px !important;
        margin-bottom: 10px !important;
    }

    .board-wrapper {
        width: 100% !important;
        max-width: 100% !important;
        border: none !important;
        outline: none !important;
        box-shadow: none !important;
        border-radius: 0 !important;
        background: transparent !important;
        margin: 0 auto !important;
    }

    .controls-bar {
        gap: 6px !important;
        margin-top: 10px !important;
    }

    .btn-action-ctrl {
        min-height: 40px !important;
        padding: 6px 10px !important;
        font-size: 13px !important;
        flex: 1 1 auto !important;
    }
}