﻿/* =========================
   MATCH PAGE
========================= */

.match-page {
    padding: 20px 0 50px;
}

.match-header {
    margin-bottom: 30px;
}

    .match-header h1 {
        font-size: 3rem;
        font-weight: 800;
        color: #111827;
    }

/* ADMIN PANEL */

.match-admin-panel {
    background: #fff;
    border-radius: 24px;
    padding: 24px;
    margin-bottom: 30px;
    border: 1px solid #e5e7eb;
    box-shadow: 0 8px 20px rgba(0,0,0,.06);
}

.manual-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
}

/* LIST */

.match-card-list {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

/* CARD */

.match-card {
    background: #fff;
    border-radius: 26px;
    padding: 22px 26px;
    border: 1px solid #e5e7eb;
    box-shadow: 0 8px 24px rgba(0,0,0,.06);
    display: grid;
    grid-template-columns: 80px 1fr 150px 1fr 165px;
    align-items: center;
    column-gap: 20px;
    min-height: 140px;
}

/* QUEUE */

.match-queue {
    width: 62px;
    height: 62px;
    border-radius: 18px;
    background: #0f172a;
    color: #fff;
    font-size: 1.8rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* TEAM */

.match-team {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.player-photos {
    display: flex;
    justify-content: center;
    gap: 12px;
}

    .player-photos a {
        text-decoration: none;
    }

    .player-photos img {
        width: 64px;
        height: 64px;
        border-radius: 50%;
        object-fit: cover;
        border: 3px solid #fff;
        box-shadow: 0 8px 18px rgba(0,0,0,.14);
        background: #f3f4f6;
        transition: .2s;
    }

        .player-photos img:hover {
            transform: scale(1.06);
        }

.team-name {
    font-size: 1.2rem;
    font-weight: 800;
    color: #0f172a;
    text-align: center;
    line-height: 1.2;
}

/* CENTER */

.match-center {
    text-align: center;
    justify-self: center;
}

.match-vs {
    font-size: 2.8rem;
    font-weight: 900;
    color: #0f172a;
    line-height: 1;
}

.match-status {
    margin-top: 10px;
}

    .match-status .badge {
        font-size: .9rem;
        padding: 7px 13px;
        border-radius: 12px;
    }

/* ADMIN BUTTONS */

.match-admin-buttons {
    border-left: 1px dashed #d1d5db;
    padding-left: 22px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 160px;
    flex-shrink: 0;
    justify-content: center;
}

    .match-admin-buttons form {
        width: 100%;
    }

        .match-admin-buttons .btn,
        .match-admin-buttons form button {
            width: 100%;
            height: 46px;
            border-radius: 12px;
            font-size: .95rem;
            font-weight: 700;
            padding: 0 10px;
            display: flex;
            align-items: center;
            justify-content: center;
        }

/* POPUP */

.popup-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.45);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.popup-card {
    width: 380px;
    background: #fff;
    border-radius: 24px;
    padding: 25px;
    box-shadow: 0 20px 50px rgba(0,0,0,.25);
}

    .popup-card h4 {
        font-weight: 800;
        margin-bottom: 20px;
    }

/* RESPONSIVE */

@media (max-width: 768px) {

    html,
    body {
        overflow-x: hidden;
    }

    .match-page {
        padding: 18px 0 40px;
    }

    .match-header h1 {
        font-size: 2rem;
        line-height: 1.2;
        margin-bottom: 18px;
    }

    .match-admin-panel {
        border-radius: 22px;
        padding: 18px;
        margin-bottom: 24px;
    }

    .manual-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

        .manual-grid label {
            font-size: .85rem;
        }

        .manual-grid input {
            height: 42px;
            font-size: .85rem;
        }

    .match-card-list {
        gap: 18px;
    }

    .match-card {
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
        overflow: hidden;
        display: grid;
        grid-template-columns: 54px 1fr 76px 1fr;
        column-gap: 10px;
        row-gap: 14px;
        align-items: center;
        padding: 18px 14px;
        border-radius: 22px;
        min-height: auto;
    }

    .match-queue {
        width: 48px;
        height: 48px;
        border-radius: 14px;
        font-size: 1.35rem;
        grid-column: 1;
        grid-row: 1;
        justify-self: center;
    }

    .match-team {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        min-width: 0;
        gap: 7px;
    }

    .player-photos {
        display: flex;
        justify-content: center;
        gap: 6px;
        min-width: 0;
    }

        .player-photos img {
            width: 42px;
            height: 42px;
            border-radius: 50%;
            border-width: 2px;
            object-fit: cover;
            box-shadow: 0 5px 12px rgba(0,0,0,.14);
        }

    .team-name {
        max-width: 100%;
        font-size: .85rem;
        font-weight: 800;
        line-height: 1.15;
        text-align: center;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .match-center {
        grid-column: 3;
        grid-row: 1;
        text-align: center;
        justify-self: center;
        align-self: center;
        width: auto;
        min-width: 0;
    }

    .match-vs {
        font-size: 1.8rem;
        font-weight: 900;
        line-height: 1;
    }

    .match-status {
        margin-top: 7px;
    }

        .match-status .badge {
            font-size: .72rem;
            padding: 5px 9px;
            border-radius: 999px;
            white-space: nowrap;
        }

    .match-admin-buttons {
        grid-column: 1 / -1;
        grid-row: 2;
        width: 100%;
        border-left: none;
        border-top: 1px dashed #d1d5db;
        padding-left: 0;
        padding-top: 14px;
        margin-top: 2px;
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
    }

        .match-admin-buttons form {
            width: 100%;
        }

            .match-admin-buttons .btn,
            .match-admin-buttons form button {
                width: 100%;
                height: 42px;
                border-radius: 12px;
                font-size: .78rem;
                font-weight: 800;
                padding: 0 6px;
                display: flex;
                align-items: center;
                justify-content: center;
                white-space: nowrap;
            }
}

.match-create-card {
    background: #fff;
    border-radius: 26px;
    padding: 30px;
    margin-bottom: 34px;
    box-shadow: 0 16px 40px rgba(15, 23, 42, .08);
    border: 1px solid #e5e7eb;
}

.match-top-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 26px;
}

.match-action-btn {
    min-width: 190px;
    height: 48px;
    border-radius: 9px;
    font-weight: 800;
}

.match-form-title {
    font-size: 1.75rem;
    font-weight: 900;
    margin-bottom: 20px;
    color: #111827;
}

.match-form-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 18px;
    margin-bottom: 20px;
}

    .match-form-grid label {
        font-weight: 800;
        margin-bottom: 7px;
    }

    .match-form-grid .form-control {
        height: 48px;
        border-radius: 10px;
    }

.match-submit-btn {
    height: 48px;
    padding: 0 24px;
    border-radius: 9px;
    font-weight: 900;
}

@media (max-width: 992px) {
    .match-form-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 576px) {
    .match-create-card {
        padding: 22px;
        border-radius: 22px;
    }

    .match-top-actions {
        flex-direction: column;
    }

    .match-action-btn {
        width: 100%;
    }

    .match-form-grid {
        grid-template-columns: 1fr;
    }

    .match-submit-btn {
        width: 100%;
    }
}

.waiting-dropdown {
    position: absolute;
    top: 20px;
    right: 30px;
    z-index: 20;
}

.waiting-toggle {
    border: none;
    background: #1f2428;
    color: white;
    padding: 14px 22px;
    border-radius: 12px;
    font-weight: 900;
}

.waiting-list-box {
    display: none;
    position: absolute;
    right: 0;
    top: 58px;
    width: 260px;
    background: white;
    border-radius: 16px;
    padding: 14px;
    box-shadow: 0 12px 30px rgba(0,0,0,.16);
}

    .waiting-list-box.show {
        display: block;
    }

.waiting-item {
    padding: 9px 6px;
    border-bottom: 1px solid #eee;
    font-weight: 700;
}

    .waiting-item:last-child {
        border-bottom: none;
    }

.waiting-empty {
    color: #6b7280;
    font-weight: 700;
}

.match-create-card {
    position: relative;
}

.waiting-dropdown {
    position: absolute;
    top: 26px;
    right: 32px;
    z-index: 50;
}

.waiting-toggle {
    border: none;
    background: #1f2428;
    color: #fff;
    min-width: 190px;
    height: 52px;
    padding: 0 22px;
    border-radius: 15px;
    font-weight: 900;
    box-shadow: 0 10px 22px rgba(15, 23, 42, .16);
}

.waiting-list-box {
    display: none;
    position: absolute;
    top: 62px;
    right: 0;
    width: 260px;
    background: #fff;
    border-radius: 18px;
    padding: 12px;
    box-shadow: 0 18px 40px rgba(15, 23, 42, .18);
    border: 1px solid #e5e7eb;
}

    .waiting-list-box.show {
        display: block;
    }

.waiting-item {
    padding: 10px 12px;
    border-bottom: 1px solid #f1f1f1;
    font-weight: 800;
}

    .waiting-item:last-child {
        border-bottom: none;
    }

.waiting-empty {
    padding: 10px;
    color: #6b7280;
    font-weight: 800;
}

@media (max-width: 768px) {
    .waiting-dropdown {
        position: static;
        margin-bottom: 18px;
    }

    .waiting-toggle {
        width: 100%;
    }

    .waiting-list-box {
        position: static;
        width: 100%;
        margin-top: 10px;
    }
}

.waiting-click {
    width: 100%;
    border: none;
    background: transparent;
    text-align: left;
    cursor: pointer;
    padding: 10px;
}

    .waiting-click:hover {
        background: #f3f4f6;
        border-radius: 10px;
    }

.waiting-time {
    display: block;
    font-size: 12px;
    color: #777;
    margin-top: 4px;
}

.waiting-click {
    width: 100%;
    border: none;
    background: none;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 10px;
}

    .waiting-click:hover {
        background: #f3f4f6;
        border-radius: 10px;
    }

.waiting-name {
    font-size: 15px;
    font-weight: 600;
    color: #111827;
}

.waiting-time {
    font-size: 12px;
    color: #6b7280;
    font-weight: 500;
}

.match-submit-btn {
    margin-top: 22px;
}

.team-power {
    position: absolute;
    top: 14px;
    right: 24px;
    font-size: 13px; /* ไม่ใหญ่ */
    font-weight: 600; /* ไม่หนาเกิน */
    color: #222;
    display: flex;
    gap: 10px;
}

.match-card{
    position:relative;
}

/* พลังทีม */
.match-power{
    position:absolute;

    top:18px;
    right:200px;     

    display:flex;
    align-items:center;
    gap:10px;

    font-size:13px;
    font-weight:700;
    color:#111827;

    user-select:none;
}

.match-power .divider{
    color:#9ca3af;
    font-weight:500;
}