/* thai_checkers_style.css */
:root {
    --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --card-radius: 15px;
    --soft-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
    --dark-square: #764ba2;
    --light-square: #f8f9fa;
    --piece-p1: #dc3545; 
    --piece-p2: #0d6efd; 
    --theme-board-dark: #764ba2;
    --theme-board-light: #f8f9fa;
    --theme-board-border: #333333;
}

body { font-family: 'Sarabun', sans-serif; background-color: var(--bs-body-bg); }
.card-custom { border-radius: var(--card-radius); box-shadow: var(--soft-shadow); border: none; background-color: var(--bs-body-bg); }
.card-header-gradient { background: var(--primary-gradient); color: white; padding: 1.25rem; }
.btn-gradient { background: var(--primary-gradient); color: white; border-radius: 50px; border: none; transition: transform 0.2s, box-shadow 0.2s; }

.checkers-board {
    position: relative;
    display: grid; grid-template-columns: repeat(8, 1fr); grid-template-rows: repeat(8, 1fr);
    width: 100%; max-width: 600px; aspect-ratio: 1 / 1; margin: 0 auto;
    border: 4px solid var(--theme-board-border, #333); border-radius: 8px; box-shadow: 0 10px 20px rgba(0,0,0,0.2); 
    background-color: var(--theme-board-light, var(--light-square));
}

.square { display: flex; align-items: center; justify-content: center; position: relative; }
.square.dark { background-color: var(--theme-board-dark, var(--dark-square)) !important; }
.square.light { background-color: var(--theme-board-light, var(--light-square)) !important; }

[data-bs-theme="dark"] .square.dark { background-color: var(--theme-board-dark, #2b3035); }
[data-bs-theme="dark"] .square.light { background-color: var(--theme-board-light, #4a2f66); }

.square.highlight-move::after {
    content: ''; width: 35%; height: 35%; background-color: #28a745; border-radius: 50%; position: absolute; z-index: 5; cursor: pointer; box-shadow: 0 0 10px rgba(40, 167, 69, 0.8);
}
.square.highlight-capture::after {
    content: ''; width: 35%; height: 35%; background-color: #ffc107; border-radius: 50%; position: absolute; z-index: 5; cursor: pointer; box-shadow: 0 0 15px rgba(255, 193, 7, 0.9);
}
.square.selected { background-color: rgba(255, 193, 7, 0.4) !important; }

.square.last-move-highlight { 
    background-color: rgba(23, 162, 184, 0.4) !important; 
    box-shadow: inset 0 0 12px rgba(23, 162, 184, 0.6);
}
[data-bs-theme="dark"] .square.last-move-highlight { 
    background-color: rgba(23, 162, 184, 0.5) !important; 
    box-shadow: inset 0 0 12px rgba(23, 162, 184, 0.8);
}

@keyframes pulse-hint { 
    0% { box-shadow: 0 0 0 0 rgba(255, 0, 255, 0.7); } 
    70% { box-shadow: 0 0 0 18px rgba(255, 0, 255, 0); } 
    100% { box-shadow: 0 0 0 0 rgba(255, 0, 255, 0); } 
}
.square.highlight-hint::after {
    content: ''; width: 40%; height: 40%; background-color: #ff00ff; border-radius: 50%; position: absolute; z-index: 20;
    cursor: pointer; box-shadow: 0 0 20px rgba(255, 0, 255, 0.9);
    animation: pulse-hint 1.5s infinite;
}

.piece {
    width: 75%; height: 75%; border-radius: 50%; box-shadow: inset 0 -5px 5px rgba(0,0,0,0.3), 0 4px 6px rgba(0,0,0,0.4);
    display: flex; align-items: center; justify-content: center; font-size: 1.3rem; color: white; transition: transform 0.2s, box-shadow 0.2s; z-index: 10;
}
.piece.p1 { background-color: var(--piece-p1); border: 2px solid #b02a37; }
.piece.p2 { background-color: var(--piece-p2); border: 2px solid #0a58ca; }

@keyframes pulse-playable { 0% { box-shadow: 0 0 0 0 rgba(40, 167, 69, 0.6); } 70% { box-shadow: 0 0 0 12px rgba(40, 167, 69, 0); } 100% { box-shadow: 0 0 0 0 rgba(40, 167, 69, 0); } }
@keyframes pulse-must-capture { 0% { box-shadow: 0 0 0 0 rgba(255, 193, 7, 0.8); } 70% { box-shadow: 0 0 0 15px rgba(255, 193, 7, 0); } 100% { box-shadow: 0 0 0 0 rgba(255, 193, 7, 0); } }

.piece.playable { animation: pulse-playable 1.5s infinite; border: 2px solid #28a745 !important; cursor: pointer; }
.piece.playable.must-capture { animation: pulse-must-capture 1s infinite; border: 2px solid #ffc107 !important; cursor: pointer; }
.piece.disabled { cursor: not-allowed; }
.piece.playable:hover { transform: scale(1.1); }

.piece.playable.hint-piece {
    animation: pulse-hint 1.5s infinite !important;
    border: 3px solid #ff00ff !important;
    box-shadow: 0 0 15px rgba(255, 0, 255, 0.7), inset 0 -5px 5px rgba(0,0,0,0.3) !important;
}

.active-turn-card { transform: scale(1.05); box-shadow: 0 10px 25px rgba(0,0,0,0.15) !important; opacity: 1 !important; transition: all 0.3s ease; z-index: 10; }
.active-turn-card.p1 { border: 2px solid #dc3545 !important; }
.active-turn-card.p2 { border: 2px solid #0d6efd !important; }
.inactive-turn-card { opacity: 0.5 !important; transform: scale(0.95); transition: all 0.3s ease; border: 1px solid transparent !important; }

.blur-overlay {
    position: absolute; top: 0; left: 0; right: 0; bottom: 0; background: rgba(255,255,255,0.8); backdrop-filter: blur(4px);
    z-index: 100; display: flex; flex-direction: column; align-items: center; justify-content: center; border-radius: var(--card-radius);
}
[data-bs-theme="dark"] .blur-overlay { background: rgba(0,0,0,0.8); }

.terminal-box {
    background-color: #0d1117;
    color: #2ea043;
    font-family: 'Courier New', Courier, monospace;
    border-left: 4px solid #2ea043;
    font-size: 0.8rem;
    text-align: left;
    line-height: 1.4;
    height: 120px;
    overflow: hidden;
    display: flex !important;
    flex-direction: column;
}
.terminal-content {
    overflow-y: auto;
    flex-grow: 1;
    padding-right: 5px;
}
.terminal-content::-webkit-scrollbar { width: 5px; }
.terminal-content::-webkit-scrollbar-thumb { background: #2ea043; border-radius: 5px; }
.terminal-log-line { margin-bottom: 5px; border-bottom: 1px dashed rgba(46, 160, 67, 0.3); padding-bottom: 3px; }

@keyframes neon-blink {
    0%, 100% { opacity: 1; color: #ff00ff; text-shadow: 0 0 8px rgba(255, 0, 255, 0.8); }
    50% { opacity: 0.4; color: inherit; text-shadow: none; }
}
.glitch-char {
    display: inline-block;
    animation: neon-blink linear infinite;
}
[data-bs-theme="light"] .glitch-char {
    animation-name: color-blink-light;
}
@keyframes color-blink-light {
    0%, 100% { opacity: 1; color: #764ba2; text-shadow: 0 0 8px rgba(118, 75, 162, 0.6); }
    50% { opacity: 0.6; color: inherit; text-shadow: none; }
}
@keyframes dev-color-blink {
    0%, 100% { opacity: 1; color: var(--dev-blink, #E72020); text-shadow: 0 0 8px rgba(231, 32, 32, 0.55); }
    50% { opacity: 0.85; color: var(--dev-base, #223057); text-shadow: none; }
}
.dev-blink-char {
    display: inline-block;
    color: var(--dev-base, #223057);
    animation: dev-color-blink linear infinite;
}

.list-group-item-action { transition: background-color 0.2s; cursor: pointer; }
.square-number { position: absolute; top: 2px; right: 4px; font-size: 0.75rem; color: rgba(255, 255, 255, 0.4); font-weight: bold; pointer-events: none; z-index: 5; user-select: none; }

/* Theme Selector Styles */
.theme-card {
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.2s ease-in-out;
    position: relative;
    border-radius: 12px;
}
.theme-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0,0,0,0.12);
}
.theme-card.active {
    border-color: #0d6efd !important;
    background-color: rgba(13, 110, 253, 0.06) !important;
}
.theme-active-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    background-color: #0d6efd;
    color: white;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    box-shadow: 0 2px 5px rgba(0,0,0,0.3);
    z-index: 5;
}
.mini-board-preview {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: repeat(4, 1fr);
    width: 52px;
    height: 52px;
    border: 2px solid #333;
    border-radius: 6px;
    overflow: hidden;
    flex-shrink: 0;
}
.mini-piece-circle {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    box-shadow: inset 0 -3px 3px rgba(0,0,0,0.35), 0 3px 5px rgba(0,0,0,0.3);
    color: white;
    flex-shrink: 0;
    transition: transform 0.15s ease;
}
.mini-piece-circle:hover {
    transform: scale(1.1);
}

/* Enhanced Contrast & Glowing Outlines for Dark Mode */
[data-bs-theme="dark"] .checkers-board {
    border-color: var(--theme-board-border, #00f2fe) !important;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.8), 0 0 20px rgba(255, 255, 255, 0.08);
}
[data-bs-theme="dark"] .square.dark { 
    background-color: var(--theme-board-dark, #2b3035) !important; 
}
[data-bs-theme="dark"] .square.light { 
    background-color: var(--theme-board-light, #4a2f66) !important; 
}
[data-bs-theme="dark"] .piece {
    box-shadow: inset 0 -4px 6px rgba(0, 0, 0, 0.5), 0 0 10px rgba(255, 255, 255, 0.2), 0 4px 8px rgba(0, 0, 0, 0.9);
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.9));
}
[data-bs-theme="dark"] .square-number {
    color: rgba(255, 255, 255, 0.65);
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9);
}

/* Custom Shaped PNG Pieces (e.g. Bottle Caps ฝาเบียร์, Tokens, Shield) */
.piece.piece-custom-img {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    border-radius: 0 !important;
    display: flex;
    align-items: center;
    justify-content: center;
}
.piece-img-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}
.piece-img {
    width: 90%;
    height: 90%;
    object-fit: contain;
    filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.45));
    transition: transform 0.2s, filter 0.2s;
    user-select: none;
    -webkit-user-drag: none;
}
.piece.playable .piece-img {
    filter: drop-shadow(0 0 8px rgba(40, 167, 69, 0.85)) drop-shadow(0 4px 6px rgba(0, 0, 0, 0.45));
}
.piece.playable.must-capture .piece-img {
    filter: drop-shadow(0 0 10px rgba(255, 193, 7, 0.95)) drop-shadow(0 4px 6px rgba(0, 0, 0, 0.45));
}
.piece.playable.hint-piece .piece-img {
    filter: drop-shadow(0 0 14px rgba(255, 0, 255, 0.95)) drop-shadow(0 4px 6px rgba(0, 0, 0, 0.45));
}
.piece-img-crown {
    position: absolute;
    top: -8px;
    right: -4px;
    font-size: 1.25rem;
    color: #ffd700 !important;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.85));
    animation: bounce-crown 2s infinite ease-in-out;
    z-index: 15;
}
@keyframes bounce-crown {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-4px); }
}
[data-bs-theme="dark"] .piece.piece-custom-img .piece-img {
    filter: drop-shadow(0 0 6px rgba(255, 255, 255, 0.25)) drop-shadow(0 4px 8px rgba(0, 0, 0, 0.9));
}
.mini-piece-circle.mini-piece-custom {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    border-radius: 0 !important;
}

/* Admin Online Users Tooltip */
.admin-online-tooltip .tooltip-inner {
    max-width: 320px !important;
    text-align: left !important;
    padding: 10px 14px !important;
    background-color: rgba(20, 24, 33, 0.96) !important;
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.15) !important;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5) !important;
    border-radius: 10px !important;
    font-size: 0.82rem !important;
    line-height: 1.4 !important;
}
.admin-online-tooltip .tooltip-arrow::before {
    border-bottom-color: rgba(20, 24, 33, 0.96) !important;
}
