/*
 * game-ui.css — unified visual language for the entertainment games.
 * Scope: lobby / game selector, chess room, Trix and Tarneeb tables.
 * Game logic and positioning from trix.css / chessboard.min.css stay intact.
 */

/* Shared tokens */
:root {
    --gop-gold: #d4af37;
    --gop-gold-soft: #f5d76e;
    --gop-panel: rgba(12, 14, 13, 0.92);
    --gop-line: rgba(212, 175, 55, 0.35);
}

/* =====================================================================
   1. Entertainment lobby / game selector
   ===================================================================== */
.entertainment-promo.alert-info {
    background: linear-gradient(90deg, rgba(212, 175, 55, 0.14), rgba(212, 175, 55, 0.03)) !important;
    border: 1px solid var(--gop-line) !important;
    color: #f2e8c9 !important;
}

.game-picker {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 22px;
}

.game-picker-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 18px;
    border-radius: 14px;
    border: 1px solid var(--gop-line);
    background: linear-gradient(135deg, rgba(212, 175, 55, 0.09), rgba(10, 12, 11, 0.6));
    color: #f5f0e2;
    text-decoration: none;
    transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}
.game-picker-card:hover,
.game-picker-card:focus {
    transform: translateY(-3px);
    border-color: var(--gop-gold);
    box-shadow: 0 10px 26px rgba(0, 0, 0, .45);
    color: #fff;
    text-decoration: none;
}
.game-picker-icon {
    flex: 0 0 52px;
    height: 52px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    font-size: 26px;
    color: var(--gop-gold-soft);
    background: rgba(0, 0, 0, .35);
    border: 1px solid var(--gop-line);
}
.game-picker-title {
    display: block;
    font-weight: 700;
    font-size: 1rem;
    color: var(--gop-gold-soft);
}
.game-picker-desc {
    display: block;
    font-size: .78rem;
    color: #a9a49a;
    margin-top: 2px;
    line-height: 1.4;
}

/* Create-room form: tidy 4-column grid */
form[action*="create_room"] .row.align-items-end {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px 16px;
    align-items: end;
}
form[action*="create_room"] .col-md-3 {
    width: auto;
    max-width: none;
    margin-bottom: 0 !important;
}
form[action*="create_room"] label {
    color: var(--gop-gold-soft);
    font-size: .78rem;
    font-weight: 700;
    letter-spacing: .2px;
    margin-bottom: 6px;
}
form[action*="create_room"] .form-control,
form[action*="create_room"] .input-group .form-control {
    height: 42px;
    background: #11151b !important;
    border: 1px solid var(--gop-line) !important;
    border-radius: 9px !important;
    color: #eee;
    padding: 8px 11px;
    box-shadow: none;
}
form[action*="create_room"] .form-control:focus {
    border-color: var(--gop-gold) !important;
    box-shadow: 0 0 0 3px rgba(212, 175, 55, .14);
}
form[action*="create_room"] .input-group-append .btn {
    height: 42px;
    border-radius: 0 9px 9px 0;
    border: 1px solid var(--gop-line);
    background: rgba(212, 175, 55, .08);
    color: var(--gop-gold-soft);
}
form[action*="create_room"] .badge.cursor-pointer {
    display: inline-block;
    padding: 5px 11px;
    margin: 2px 3px 0 0;
    border-radius: 999px;
    border: 1px solid var(--gop-line);
    background: rgba(0, 0, 0, .35);
    color: #d8cfae;
    cursor: pointer;
    transition: background .15s ease, color .15s ease;
}
form[action*="create_room"] .badge.cursor-pointer:hover {
    background: var(--gop-gold);
    color: #141414;
}
form[action*="create_room"] button[type="submit"] {
    height: 42px;
    border: 0;
    border-radius: 10px;
    background: linear-gradient(135deg, #d4af37, #f3d97c);
    color: #17150e;
    font-weight: 800;
    letter-spacing: .3px;
    box-shadow: 0 6px 18px rgba(212, 175, 55, .22);
    transition: transform .15s ease, box-shadow .15s ease;
}
form[action*="create_room"] button[type="submit"]:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 24px rgba(212, 175, 55, .32);
}
form[action*="create_room"] small#balance-display {
    display: block;
    margin-top: 6px;
    color: #9fd3de;
}

@media (max-width: 1200px) {
    form[action*="create_room"] .row.align-items-end { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .game-picker { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 700px) {
    form[action*="create_room"] .row.align-items-end { grid-template-columns: 1fr; }
    .game-picker { grid-template-columns: 1fr; }
}

/* =====================================================================
   2. Chess room
   ===================================================================== */
.chess-room .card-header.bg-primary {
    background: linear-gradient(90deg, #161a1e, #242018) !important;
    border-bottom: 2px solid var(--gop-gold) !important;
}
.chess-room #board {
    background: #101214;
    padding: 8px;
    border: 2px solid var(--gop-gold);
    border-radius: 12px;
    box-shadow: 0 14px 34px rgba(0, 0, 0, .55), inset 0 0 0 1px rgba(255, 255, 255, .04);
}
.chess-room #board img.piece {
    filter: drop-shadow(0 3px 2px rgba(0, 0, 0, .45));
}
.chess-room .card.bg-secondary,
.chess-room .card.bg-dark {
    border: 1px solid var(--gop-line) !important;
    border-radius: 12px;
}
.chess-room .card.bg-secondary .card-title {
    color: var(--gop-gold-soft) !important;
    border-bottom: 1px solid var(--gop-line);
    padding-bottom: 8px;
}
.chess-room .card-body .btn,
.chess-room #status,
.chess-room #turn-indicator {
    border-radius: 9px;
}
.chess-room .card-body .btn:not(.btn-danger) {
    border: 1px solid var(--gop-line);
    background: rgba(212, 175, 55, .08);
    color: var(--gop-gold-soft);
    font-weight: 600;
    transition: background .15s ease, color .15s ease;
}
.chess-room .card-body .btn:not(.btn-danger):hover {
    background: var(--gop-gold);
    color: #15130d;
}
.chess-room .card-body .btn-danger {
    border-radius: 9px;
}
.chess-room #chat-messages,
.chess-room #pgn {
    background: #0c0f12 !important;
    border: 1px solid rgba(255, 255, 255, .06);
    border-radius: 8px;
    color: #cfd8d3;
}
.chess-room .alert-info {
    background: rgba(212, 175, 55, .1);
    border: 1px solid var(--gop-line);
    color: var(--gop-gold-soft);
}

/* Left control panel — clear status + tidy stacked actions */
.chess-room .card.bg-secondary {
    background: linear-gradient(160deg, #1b2026, #12161b) !important;
}
.chess-room .card.bg-secondary .card-body {
    padding: 14px !important;
}
.chess-room #status {
    font-size: .86rem;
    color: #cfd8d3;
    margin-bottom: 10px;
}
.chess-room #turn-indicator {
    padding: 10px 12px;
    text-align: center;
    font-weight: 700;
    font-size: .85rem;
    letter-spacing: .2px;
    border-radius: 10px !important;
}
.chess-room #turn-indicator.alert-success {
    background: rgba(46, 168, 106, .14) !important;
    border: 1px solid rgba(46, 168, 106, .45) !important;
    color: #7ee2a8 !important;
}
.chess-room #turn-indicator.turning {
    animation: gop-turn-pulse 1.8s ease-in-out infinite;
}
@keyframes gop-turn-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(46, 168, 106, .28); }
    50% { box-shadow: 0 0 0 7px rgba(46, 168, 106, 0); }
}
.chess-room #turn-indicator.alert-secondary {
    background: rgba(255, 255, 255, .05) !important;
    border: 1px solid rgba(255, 255, 255, .12) !important;
    color: #b9c0bb !important;
}
.chess-room .card-body .btn:not(.entertainment-room-bar .btn) {
    display: block;
    width: 100%;
    margin: 0 0 8px;
}
.chess-room #sf-status,
.chess-room #sf-engine-status {
    font-size: .7rem;
    color: #93a39a;
    line-height: 1.4;
    max-height: 2.6em;
    overflow: hidden;
    margin: 0 0 8px !important;
}
.chess-room .card.bg-dark .card-header {
    background: rgba(212, 175, 55, .09) !important;
    border-bottom: 1px solid var(--gop-line);
    color: var(--gop-gold-soft);
}
.chess-room #chat-messages {
    min-height: 150px;
}
.chess-room #pgn {
    font-size: .78rem;
    line-height: 1.6;
    white-space: pre-wrap;
}

/* =====================================================================
   3. Trix & Tarneeb tables
   ===================================================================== */
.trix-table,
.tarneeb-table {
    max-width: 980px;
    height: min(650px, 74vh);
    border-width: 10px !important;
    border-color: #6b472f !important;
    border-radius: 26px !important;
    box-shadow: inset 0 0 90px rgba(0, 0, 0, .72), 0 18px 44px rgba(0, 0, 0, .5) !important;
}
.trix-table .game-info {
    top: 14px;
    left: 14px;
    min-width: 250px;
    max-width: 300px;
    background: var(--gop-panel) !important;
    border: 1px solid var(--gop-line);
    border-radius: 12px;
    padding: 12px 14px;
    font-size: 12px;
    line-height: 1.7;
    backdrop-filter: blur(6px);
    box-shadow: 0 8px 22px rgba(0, 0, 0, .4);
}
.trix-table .game-info table,
.tarneeb-table .game-info table {
    width: 100%;
    color: #e8e4d8;
}
.trix-table .game-info th,
.tarneeb-table .game-info th {
    color: var(--gop-gold-soft);
    font-weight: 700;
    border-bottom: 1px solid var(--gop-line);
    padding: 3px 6px;
}
.trix-table .game-info td,
.tarneeb-table .game-info td {
    padding: 3px 6px;
    border-bottom: 1px solid rgba(255, 255, 255, .05);
}
.trix-table .game-info .badge,
.tarneeb-table .game-info .badge {
    margin: 2px 3px 0 0;
    border: 1px solid rgba(255, 255, 255, .08);
}
.trix-table .player-name,
.tarneeb-table .player-name {
    background: rgba(6, 8, 7, .82) !important;
    border: 1px solid var(--gop-line);
    border-radius: 999px;
    padding: 3px 10px;
    font-size: 11px;
    color: var(--gop-gold-soft);
    white-space: nowrap;
}
.trix-table .player-avatar {
    border-radius: 50%;
    border: 2px solid var(--gop-gold);
    box-shadow: 0 0 16px rgba(212, 175, 55, .28);
}
.trix-card {
    width: 76px !important;
    height: 108px !important;
    margin-left: -42px !important;
    border-radius: 8px !important;
    border: 1px solid rgba(0, 0, 0, .35) !important;
    box-shadow: -2px 3px 8px rgba(0, 0, 0, .38) !important;
}
.trix-card:hover {
    transform: translateY(-22px) scale(1.06) !important;
    box-shadow: 0 16px 30px rgba(0, 0, 0, .5) !important;
}
.trix-card-back {
    border-radius: 8px;
    border: 1px solid var(--gop-line);
}

/* Contract selection panel */
.contract-selector {
    background: var(--gop-panel) !important;
    border: 2px solid var(--gop-gold) !important;
    border-radius: 16px !important;
    padding: 22px 26px !important;
    box-shadow: 0 18px 40px rgba(0, 0, 0, .55);
    min-width: 340px;
}
.contract-selector .btn-group-vertical {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}
.contract-selector .contract-btn {
    margin: 0 !important;
    border-radius: 9px !important;
    font-weight: 700;
    padding: 10px 12px;
    border: 1px solid rgba(255, 255, 255, .08);
}
.contract-selector .btn-danger {
    background: linear-gradient(135deg, #7a1f2b, #a52a3a);
}
.contract-selector .btn-success {
    background: linear-gradient(135deg, #1f7a4d, #2ea86a);
}

/* Bidding / doubling panels (Tarneeb + Trix) */
.action-panel {
    background: var(--gop-panel) !important;
    border: 2px solid var(--gop-gold) !important;
    border-radius: 16px !important;
    box-shadow: 0 16px 38px rgba(0, 0, 0, .55);
    backdrop-filter: blur(6px);
    padding: 18px 22px !important;
    min-width: 340px;
}
.action-panel h5 {
    color: var(--gop-gold-soft) !important;
    border-bottom: 1px solid var(--gop-line);
    padding-bottom: 8px;
}
.action-panel .form-control {
    background: #11151b !important;
    border: 1px solid var(--gop-line) !important;
    border-radius: 8px !important;
    color: #eee;
}
.action-panel .btn {
    border-radius: 9px;
    font-weight: 700;
    padding: 8px 16px;
    border: 1px solid rgba(255, 255, 255, .08);
}
.action-panel .btn-primary {
    background: linear-gradient(135deg, #d4af37, #f3d97c) !important;
    color: #17150e !important;
    border-color: transparent !important;
}
.action-panel .btn-warning,
.action-panel .btn-danger {
    background: rgba(0, 0, 0, .35) !important;
    color: var(--gop-gold-soft) !important;
    border-color: var(--gop-line) !important;
}
.action-panel .btn:hover {
    filter: brightness(1.12);
}

/* Game room top bars */
.entertainment-room-bar.border-warning,
.entertainment-room-bar.border-primary {
    border-bottom: 2px solid var(--gop-gold) !important;
    background: linear-gradient(90deg, #121518, #1d1a12) !important;
}
.entertainment-room-bar .badge {
    border: 1px solid rgba(255, 255, 255, .08);
}
.entertainment-room-bar .btn-success {
    background: linear-gradient(135deg, #d4af37, #f3d97c) !important;
    color: #17150e !important;
    border: 0 !important;
    font-weight: 700;
}
.entertainment-room-bar .btn-danger {
    border-radius: 8px;
}

@media (max-width: 900px) {
    .contract-selector,
    .action-panel { min-width: 0; width: 92%; }
    .trix-table .game-info { min-width: 0; max-width: 60%; font-size: 11px; }
}
