/* --- Game Review & Import Styles --- */

/* Review Layout */
.review-layout {
    height: 100%;
    display: flex;
    flex-direction: column;
}

/* .review-actions {} Removed empty rule */
/* .review-list-container {} Removed empty rule */

/* Tabs */
.review-tabs {
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 8px;
    margin-bottom: 16px;
}

.review-tab {
    background: none;
    border: none;
    color: var(--text-muted);
    font-weight: 500;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
}

.review-tab:hover {
    color: var(--text-main);
    background: var(--surface-hover);
}

.review-tab.active {
    color: var(--accent-primary);
    background: rgba(56, 189, 248, 0.1);
}

.review-stats {
    margin-left: auto;
    display: flex;
    gap: 16px;
    font-size: 0.9em;
    color: var(--text-muted);
}

.stat-item {
    display: flex;
    gap: 6px;
    align-items: center;
}

.stat-val {
    color: var(--text-main);
    font-weight: 600;
}

/* Review List */
.review-list-container {
    padding: 0;
}

.review-item {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 12px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.review-item:hover {
    border-color: var(--accent-primary);
    background: var(--surface-hover);
}

.review-item.active {
    background: rgba(56, 189, 248, 0.05);
    border-color: var(--accent-primary);
}

.ri-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 6px;
}

.ri-move {
    font-weight: 700;
    font-family: 'JetBrains Mono', monospace;
    color: var(--text-main);
}

.ri-eval {
    font-size: 0.85em;
    color: var(--text-muted);
}

.ri-reason {
    font-size: 0.9em;
    color: var(--text-secondary);
    line-height: 1.4;
}

/* Classification Colors */
.tag-mistake {
    color: var(--warning);
}

.tag-blunder {
    color: var(--danger);
}

.tag-inaccuracy {
    color: #facc15;
}

.tag-good {
    color: var(--success);
}

.tag-brilliant {
    color: #22d3ee;
}

/* Import Tab */
.import-header {
    border-bottom: 1px solid var(--border);
    padding-bottom: 16px;
}

.import-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.import-card:hover {
    background: var(--surface-hover);
    border-color: var(--text-muted);
}

.ic-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.ic-players {
    font-weight: 600;
    color: var(--text-main);
}

.ic-meta {
    font-size: 0.85em;
    color: var(--text-muted);
    display: flex;
    gap: 8px;
}

.ic-result {
    font-size: 0.85em;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 4px;
    background: var(--surface-hover);
}

.ic-result.win {
    color: var(--success);
    background: rgba(34, 197, 94, 0.1);
}

.ic-result.loss {
    color: var(--danger);
    background: rgba(239, 68, 68, 0.1);
}

.ic-result.draw {
    color: var(--text-muted);
}


/* --- New Enhancements: Summary & Progress --- */

/* Progress Overlay */
#review-progress-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(11, 17, 32, 0.85);
    /* Semi-transparent dark */
    backdrop-filter: blur(4px);
    z-index: 50;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

#review-progress-overlay.visible {
    opacity: 1;
    pointer-events: auto;
}

.progress-text {
    color: var(--text-main);
    font-weight: 500;
    font-size: 1.1em;
}

.progress-bar-track {
    width: 200px;
    height: 6px;
    background: var(--surface-hover);
    border-radius: 3px;
    overflow: hidden;
    position: relative;
}

.progress-bar-fill {
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    width: 30%;
    background: var(--accent-primary);
    border-radius: 3px;
    transition: width 0.2s linear;
}

@keyframes indeterminate-bar {
    0% {
        left: -30%;
        width: 30%;
    }

    50% {
        left: 20%;
        width: 60%;
    }

    100% {
        left: 100%;
        width: 30%;
    }
}

/* Game Summary Section */
.summary-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 0 0 20px 0;
    border-bottom: 1px solid var(--border);
    margin-bottom: 16px;
}

.summary-phases {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 12px;
}

.summary-card {
    background: var(--surface-light);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px;
}

.summary-card h4 {
    margin: 0 0 8px 0;
    font-size: 0.85em;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.05em;
}

.summary-card p {
    margin: 0;
    font-size: 0.9em;
    color: var(--text-secondary);
    line-height: 1.4;
}

.summary-feedback {
    display: grid;
    grid-template-columns: 1fr 1fr;
    /* Side by side feedback */
    gap: 12px;
}

.feedback-col h5 {
    margin: 0 0 8px 0;
    font-size: 0.9em;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 6px;
}

.feedback-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.feedback-list li {
    font-size: 0.9em;
    color: var(--text-secondary);
    margin-bottom: 6px;
    padding-left: 12px;
    position: relative;
    line-height: 1.4;
}

.feedback-list li::before {
    content: "•";
    position: absolute;
    left: 0;
    color: var(--text-muted);
}

/* Success/Constructive accents */
.feedback-good li::before {
    color: var(--success);
}

.feedback-fix li::before {
    color: var(--warning);
}

/* --- Restored Review Item Styles (Table-like) --- */
.review-item {
    background: transparent;
    border-bottom: 1px solid var(--border);
    margin: 0;
    border-radius: 0;
    cursor: pointer;
    transition: background 0.2s ease;
    overflow: hidden;
}

.review-item:hover {
    background: var(--surface-hover);
}

.review-item.active {
    background: rgba(56, 189, 248, 0.1);
    border-left: 3px solid var(--accent-primary);
}

/* Flex Row for the Move Header */
.review-header-row {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    gap: 12px;
}

.review-move-idx {
    color: var(--text-dim);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.9rem;
    width: 24px;
}

.review-move-san {
    color: var(--text-main);
    font-weight: 700;
    font-size: 1rem;
    min-width: 40px;
}

.review-glyph {
    font-size: 1.2rem;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
}

.glyph-brilliant {
    color: #22d3ee;
}

.glyph-great {
    color: #34d399;
}

.glyph-best {
    color: #a3e635;
}

.glyph-good {
    color: #cbd5e1;
}

.glyph-inaccuracy {
    color: #fbbf24;
}

.glyph-mistake {
    color: #f97316;
}

.glyph-blunder {
    color: #ef4444;
}

.review-content {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.review-msg {
    color: var(--text-muted);
    font-size: 0.9rem;
    line-height: 1.4;
}

.review-score {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
    color: var(--text-dim);
    background: rgba(255, 255, 255, 0.05);
    padding: 4px 8px;
    border-radius: 4px;
}

/* Dropdown / Structured Comm Grid */
.comm-grid {
    display: none;
    grid-template-columns: 1fr 1fr;
    gap: 1px;
    background: var(--glass-border);
    border-top: 1px solid var(--glass-border);
}

.review-item.active .comm-grid {
    display: grid;
}

.comm-box {
    background: rgba(15, 23, 42, 0.4);
    padding: 12px 16px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.comm-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-dim);
    font-weight: 600;
}

.comm-text {
    font-size: 0.9rem;
    color: var(--text-muted);
    line-height: 1.4;
}

/* Arrow Layer (SVG Overlay) */
.arrow-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 20;
    pointer-events: none;
}

/* --- Evaluation Bar --- */
.board-wrapper.with-eval-bar {
    flex-direction: row;
    aspect-ratio: auto;
    gap: 12px;
    align-items: stretch;
}

/* Ensure the container maintains aspect ratio logic implicitly or explicitly */
.board-wrapper.with-eval-bar .board-container {
    flex: 0 1 auto;
    /* let it shrink/grow but keep 1:1 */
    width: auto;
    height: auto;
    aspect-ratio: 1 / 1;
}

.eval-bar-container {
    width: 24px;
    background-color: #262421;
    /* Dark/Black side */
    border-radius: 4px;
    overflow: hidden;
    position: relative;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    border: 1px solid var(--glass-border);
    flex-shrink: 0;
}

.eval-bar-fill {
    width: 100%;
    background-color: #ffffff;
    /* White side */
    position: absolute;
    top: 0;
    left: 0;
    transition: height 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    height: 50%;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.1);
}

.eval-score {
    position: absolute;
    width: 100%;
    text-align: center;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.65rem;
    font-weight: 800;
    color: #0f172a;
    z-index: 10;
    line-height: 1;
    bottom: 4px;
}

/* --- New Import List Table Styles (Chess.com-like) --- */
.import-list-container {
    display: flex;
    flex-direction: column;
}

.import-row {
    display: grid;
    grid-template-columns: 60px 1fr 100px 80px 60px 110px auto;
    align-items: center;
    padding: 8px 16px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: background 0.1s ease;
    gap: 12px;
}

.import-row:hover {
    background: var(--surface-hover);
}

/* Column 1: Time Control / Icon */
.col-time {
    display: flex;
    flex-direction: column;
    align-items: center;
    color: var(--text-muted);
    font-size: 0.75rem;
    gap: 2px;
}

.col-time svg,
.col-time i {
    font-size: 1.2rem;
    color: var(--text-secondary);
}

/* Column 2: Players */
.col-players {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.player-info {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.9rem;
    color: var(--text-main);
}

.player-info .rating {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.player-info .flag {
    font-size: 1em;
    /* Emoji flag size */
}

.player-info .marker {
    width: 10px;
    height: 10px;
    border-radius: 2px;
    margin-right: 4px;
}

.marker.white {
    background: #E2E8F0;
    border: 1px solid #94A3B8;
}

.marker.black {
    background: #1E293B;
    border: 1px solid #475569;
}


/* Column 3: Result */
.col-result {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    color: var(--text-main);
    justify-content: flex-end;
    /* Align right mostly */
}

.result-box {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    color: #fff;
    font-size: 14px;
    font-weight: 700;
}

.res-win {
    background-color: #81b64c;
}

/* Green */
.res-loss {
    background-color: #fa5853;
}

/* Red */
.res-draw {
    background-color: #a3a3a3;
}

/* Grey */


/* Column 4: Accuracy */
.col-accuracy {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
    text-align: right;
    color: var(--text-secondary);
    display: flex;
    flex-direction: column;
    gap: 2px;
}

/* Column 5: Moves */
.col-moves {
    text-align: center;
    font-size: 0.9rem;
    color: var(--text-muted);
}

/* Column 6: Date */
.col-date {
    text-align: right;
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Column 7: Checkbox (Action) */
.col-action {
    display: flex;
    justify-content: flex-end;
}

.import-checkbox {
    width: 16px;
    height: 16px;
    border: 1px solid var(--text-muted);
    border-radius: 2px;
    cursor: pointer;
}