/* Sidebar */
.sidebar-col {
    background-color: #2c3e50;
    min-height: 100vh;
    padding: 0;
}

.sidebar {
    padding: 0;
}

.sidebar-title {
    color: #ecf0f1;
    padding: 1.2rem 1rem 0.5rem 1rem;
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.sidebar-divider {
    border-color: #3d5166;
    margin: 0.5rem 1rem 0.5rem 1rem;
}

.sidebar .nav-link {
    color: #bdc3c7;
    padding: 0.55rem 1rem;
    border-radius: 0;
    font-size: 0.9rem;
    transition: background-color 0.15s, color 0.15s;
}

.sidebar .nav-link:hover {
    color: #ecf0f1;
    background-color: #34495e;
}

.sidebar .nav-link.active {
    color: #fff;
    background-color: #18bc9c;
}

/* Main content */
.main-content {
    padding: 2rem 2.5rem;
}

/* Upload area */
.upload-area {
    border: 2px dashed #ced4da;
    border-radius: 6px;
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    color: #6c757d;
    background-color: #f8f9fa;
    transition: border-color 0.15s, background-color 0.15s;
}

.upload-area:hover {
    border-color: #18bc9c;
    background-color: #f0faf8;
    color: #2c3e50;
}

/* Card section headers */
.section-card {
    margin-bottom: 1.5rem;
    box-shadow: 0 1px 4px rgba(0,0,0,0.07);
}

/* DataTable improvements */
.dash-table-container .dash-spreadsheet-container .dash-spreadsheet-inner th {
    background-color: #f8f9fa;
    font-weight: 600;
}

/* Metric boxes */
.metric-box {
    background-color: #f8f9fa;
    border-left: 4px solid #18bc9c;
    padding: 1rem 1.25rem;
    border-radius: 0 4px 4px 0;
    margin-bottom: 0.75rem;
}

.metric-value {
    font-size: 2rem;
    font-weight: 700;
    color: #2c3e50;
    line-height: 1;
}

.metric-label {
    color: #6c757d;
    font-size: 0.85rem;
    margin-top: 0.25rem;
}

/* Combo requirement list */
.req-item {
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 0.5rem 0.75rem;
    margin-bottom: 0.4rem;
}

.combo-item {
    border: 1px solid #dee2e6;
    border-radius: 6px;
    padding: 0.75rem 1rem;
    margin-bottom: 0.6rem;
    background-color: #fff;
}

/* Card RAG — image grid */
.rag-card-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.rag-card-wrapper {
    flex: 0 0 auto;
}

.rag-card-img {
    width: 100px;
    height: auto;
    border-radius: 4px;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.12);
}

.rag-card-img:hover {
    transform: scale(1.08);
    box-shadow: 0 4px 12px rgba(24,188,156,0.35);
}

.rag-card-tooltip .tooltip-inner {
    max-width: 320px;
    text-align: left;
    font-size: 0.82rem;
    line-height: 1.4;
}

/* Card Viewer */
.viewer-card-img {
    max-width: 100%;
    max-height: 600px;
    border-radius: 6px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.15);
}

.viewer-card-desc {
    white-space: pre-wrap;
    font-size: 0.92rem;
    line-height: 1.6;
    color: #34495e;
}

.viewer-artwork-img {
    max-width: 100%;
    max-height: 500px;
    border-radius: 6px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.15);
}

.viewer-artwork-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    justify-content: center;
}

.viewer-thumb-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    margin-top: 12px;
}

.viewer-card-thumb {
    width: 80px;
    height: auto;
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.12);
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
}

.viewer-card-thumb:hover {
    transform: scale(1.1);
    box-shadow: 0 3px 10px rgba(24,188,156,0.35);
}

/* ── Replay Viewer ────────────────────────────────── */
.rv-container {
    background: #1a1a2e;
    border-radius: 8px;
    padding: 1rem 1.2rem;
    max-height: 65vh;
    overflow-y: auto;
    font-family: 'Consolas', 'Courier New', monospace;
    font-size: 0.82rem;
    line-height: 1.5;
}

.rv-block > div {
    padding: 1px 0;
    white-space: pre-wrap;
    word-break: break-word;
}

.rv-p0    { color: #64b5f6; }   /* player 0 — blue  */
.rv-p1    { color: #ef9a9a; }   /* player 1 — red   */
.rv-msg   { color: #9e9e9e; font-style: italic; }  /* engine messages  */
.rv-action{ color: #a5d6a7; font-weight: 600; }   /* Player N chose   */
.rv-other { color: #e0e0e0; }

.rv-turn-label {
    font-size: 0.9rem;
    font-weight: 600;
    color: #555;
    min-width: 120px;
    text-align: center;
}

/* ── Visual Replay Viewer ────────────────────────────────────────────────── */

/* Hand strips above/below board */
.vr-hand-section {
    background: #111d2b;
    border-radius: 6px;
    padding: 6px 10px;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 90px;
    overflow-x: auto;
    flex-wrap: nowrap;
}

.vr-player-label {
    font-size: 10px;
    color: #7f8c8d;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
    min-width: 38px;
    flex-shrink: 0;
}

.vr-hand-card {
    width: 56px;
    height: 80px;
    object-fit: cover;
    border-radius: 3px;
    border: 1px solid #2c3e50;
    flex-shrink: 0;
}

/* Board container */
.vr-board-container {
    background: #0d1a27;
    border-radius: 8px;
    padding: 8px 10px;
    margin-bottom: 4px;
    overflow-x: auto;
}

/* Board grid: 4 rows, each row is a flex row of 9 equal-width cells */
.vr-board-grid {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 520px;
}

/* EMZ center row is visually distinct */
.vr-row-emz {
    opacity: 0.85;
}

/* Each row: 9 equal cells in a flex row */
.vr-row {
    display: flex;
    flex-direction: row;
    gap: 3px;
}

/* Every cell in a row is the same width */
.vr-row > * {
    flex: 1 1 0;
    min-width: 0;
}

/* Card zone: fixed aspect ratio, dark background */
.vr-zone {
    aspect-ratio: 59 / 86;
    border: 1px solid #1e3048;
    border-radius: 3px;
    background: #0a1520;
    overflow: hidden;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Empty zone (dashed border, no card) */
.vr-zone-empty {
    border: 1px dashed #1a2e42;
    background: transparent;
}

/* Invisible spacer — same size as a zone but transparent */
.vr-zone-spacer {
    border: none;
    background: transparent;
}

/* Pile cell: label on top, card back in middle, count at bottom */
.vr-pile-cell {
    aspect-ratio: 59 / 86;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    background: #071018;
    border: 1px solid #152535;
    border-radius: 3px;
    padding: 1px 0;
    overflow: hidden;
    position: relative;
}

.vr-pile-cell .vr-zone {
    width: 100%;
    flex: 1;
    border: none;
    border-radius: 0;
    aspect-ratio: unset;
}

.vr-pile-lbl {
    font-size: 7px;
    color: #4a6480;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    line-height: 1;
    z-index: 1;
}

.vr-pile-cnt {
    font-size: 8px;
    color: #7f8c8d;
    font-weight: 600;
    line-height: 1;
}

/* Slot label (M1, S2, EMZ, FZ…) inside empty zones */
.vr-slot-lbl {
    font-size: 7px;
    color: #2a4460;
    text-align: center;
}

/* DEF / facedown badge */
.vr-badge {
    position: absolute;
    bottom: 1px;
    right: 1px;
    background: rgba(0,0,0,0.80);
    color: #bbb;
    font-size: 6px;
    padding: 0 2px;
    border-radius: 2px;
    pointer-events: none;
    z-index: 2;
}
