/* css/co-tuong.css */
.chess-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px 10px;
}

.chess-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 20px;
}

.chess-status {
    font-size: 1.1rem;
    font-weight: bold;
    color: #e2e8f0;
    background: rgba(255, 255, 255, 0.1);
    padding: 8px 16px;
    border-radius: 20px;
}

.bot-selection {
    display: block;
}

.bot-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin-bottom: 30px;
    width: 100%;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
}

@media (min-width: 768px) {
    .bot-grid {
        grid-template-columns: repeat(4, 1fr);
        max-width: 800px;
    }
}

.bot-card {
    background: rgba(30, 41, 59, 0.8);
    border: 2px solid transparent;
    border-radius: 12px;
    padding: 15px 10px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.bot-card:hover {
    transform: translateY(-3px);
    border-color: #3b82f6;
    background: rgba(30, 41, 59, 1);
}

.bot-card.situ-card:hover { border-color: #22c55e; }
.bot-card.tutai-card:hover { border-color: #3b82f6; }
.bot-card.bangnhan-card:hover { border-color: #f97316; }
.bot-card.trangnguyen-card:hover { border-color: #eab308; }

.bot-title {
    font-weight: 700;
    color: #f8fafc;
    font-size: 1rem;
}

.bot-desc {
    font-size: 0.85rem;
    color: #94a3b8;
}

.chess-layout {
    display: flex;
    gap: 20px;
    align-items: stretch;
    justify-content: center;
}

.board-area {
    flex: 1;
    max-width: 470px;
    width: 100%;
    min-width: 320px;
    margin: 0 auto;
}
.ct-player-info {
    display: flex;
    justify-content: center;
    gap: 40px;
    margin: 0 auto 10px;
    width: max-content;
    background: rgba(15, 23, 42, 0.8);
    padding: 10px 20px;
    border-radius: 20px;
}

.ct-player-card {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    color: #94a3b8;
    padding: 8px 16px;
    border-radius: 12px;
    white-space: nowrap;
    position: relative;
    background: rgba(255, 255, 255, 0.05);
    transition: all 0.3s;
}

.ct-player-card.active {
    color: #f8fafc;
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}

.ct-player-card.active::after {
    content: "";
    position: absolute;
    inset: -1px;
    border-radius: 12px;
    border: 2px solid #6366f1;
    animation: ctCardPulse 2s infinite;
}

@keyframes ctCardPulse {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.02); opacity: 0.8; }
    100% { transform: scale(1); opacity: 1; }
}



.xiangqiboard {
    position: relative;
    width: 100%;
    aspect-ratio: 9 / 10; 
    container-type: inline-size;
    background-image: url('../images/xiangqi_board.svg');
    background-size: 100% 100%;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    user-select: none;
}

/* Các giao điểm (intersections) trên bàn cờ */
.intersection {
    position: absolute;
    width: 11.11%; /* 100% / 9 */
    height: 10%;   /* 100% / 10 */
    /* Để click được dễ dàng, div intersection sẽ bao quanh điểm giao */
    transform: translate(-50%, -50%);
    cursor: pointer;
    z-index: 10;
}

.intersection.selected::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 80%;
    height: 80%;
    transform: translate(-50%, -50%);
    border: 2px dashed #ff0000;
    border-radius: 50%;
    pointer-events: none;
}

.intersection.valid-move::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 25%;
    height: 25%;
    transform: translate(-50%, -50%);
    background-color: rgba(34, 197, 94, 0.8);
    border-radius: 50%;
    pointer-events: none;
}

.intersection.valid-capture::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 80%;
    height: 80%;
    transform: translate(-50%, -50%);
    border: 3px solid rgba(239, 68, 68, 0.8);
    border-radius: 50%;
    pointer-events: none;
}

.intersection.last-move::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 85%;
    height: 85%;
    transform: translate(-50%, -50%);
    background-color: rgba(234, 179, 8, 0.4);
    border-radius: 50%;
    pointer-events: none;
    z-index: 30;
}

/* Quân cờ Cổ Điển */
.xiangqi-piece {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 85%;
    height: 85%;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    background-color: #e5cd9f; /* Màu gỗ */
    box-shadow: 0 4px 6px rgba(0,0,0,0.5), inset 0 0 10px rgba(139,69,19,0.5);
    border: 2px solid #8b4513;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: clamp(14px, 5cqw, 36px);
    line-height: 1;
    font-weight: bold;
    font-family: "Kaiti", "STKaiti", "KaiTi_GB2312", serif;
    pointer-events: none; /* Để click xuyên qua xuống intersection */
    z-index: 20;
    overflow: hidden;
    transition: transform 0.25s ease-in-out, top 0.25s ease-in-out, left 0.25s ease-in-out;
}

/* Nếu thêm hiệu ứng trượt */
.xiangqi-piece.sliding {
    z-index: 30;
}

/* Quân cờ Trắng (Thực ra là Đỏ) */
.piece-r {
    color: #cc0000;
    text-shadow: 1px 1px 0px rgba(255,255,255,0.5);
}

/* Quân cờ Đen */
.piece-b {
    color: #000000;
    text-shadow: 1px 1px 0px rgba(255,255,255,0.5);
}

/* Sidebar hiển thị quân đã ăn */
.captured-sidebar {
    width: 120px;
    background: rgba(15, 23, 42, 0.8);
    border-radius: 12px;
    padding: 15px;
    display: none;
    flex-direction: column;
}

@media (min-width: 768px) {
    .captured-sidebar {
        display: flex;
    }
}

.sidebar-title {
    font-size: 0.9rem;
    font-weight: 700;
    color: #94a3b8;
    margin-bottom: 15px;
    text-align: center;
    text-transform: uppercase;
}

.captured-list {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    justify-content: center;
}

.captured-piece-mini {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background-color: #e5cd9f;
    border: 1px solid #8b4513;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 14px;
    font-weight: bold;
    font-family: "Kaiti", "STKaiti", serif;
}

/* Responsive */
@media (max-width: 768px) {
    .chess-layout {
        flex-direction: column;
        align-items: center;
    }
    .captured-sidebar {
        display: none;
    }
    .captured-mobile-btn {
        display: block;
        width: 100%;
        max-width: 600px;
        margin: 0 auto 10px auto;
        padding: 10px;
        background: rgba(30, 41, 59, 0.8);
        border: none;
        border-radius: 8px;
        color: #f8fafc;
        font-weight: 600;
        cursor: pointer;
    }
    .xiangqi-piece {
        font-size: clamp(14px, 5vw, 24px);
    }
}

/* ========================================================= */
/* BUTTON STYLES                                             */
/* ========================================================= */
.chess-btn {
    padding: 12px 24px;
    font-size: 16px;
    font-weight: 800;
    font-family: 'Nunito', sans-serif;
    color: white;
    background: linear-gradient(135deg, #3498db, #2980b9);
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 15px rgba(52, 152, 219, 0.4);
    text-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

.chess-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(52, 152, 219, 0.6);
    background: linear-gradient(135deg, #2980b9, #3498db);
}

.chess-btn:active {
    transform: translateY(1px);
    box-shadow: 0 2px 10px rgba(52, 152, 219, 0.4);
}

.chess-btn.danger {
    background: linear-gradient(135deg, #6366f1, #4f46e5);
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
}

.chess-btn.danger:hover {
    background: linear-gradient(135deg, #4f46e5, #6366f1);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.6);
}

.chess-btn.danger:active {
    box-shadow: 0 2px 10px rgba(99, 102, 241, 0.4);
}
