/**
 * VECTOR Game v2.0 - Panel Styles
 * Side panels, controls, and additional UI components
 */

/* ============================================
   PANEL CARD VARIANTS
   ============================================ */

/* Collapsed state */
.panel-card.collapsed .panel-body {
    display: none;
}

.panel-card.collapsed .panel-header {
    cursor: pointer;
}

.panel-card.collapsed .panel-header::after {
    content: '▶';
    float: right;
    font-size: 0.625rem;
    color: var(--text-muted);
    transition: transform var(--transition-fast);
}

.panel-card .panel-header::after {
    content: '▼';
    float: right;
    font-size: 0.625rem;
    color: var(--text-muted);
}

/* ============================================
   TURN INFO PANEL SPECIFICS
   ============================================ */
#panel-turn .turn-number {
    font-variant-numeric: tabular-nums;
}

.current-player {
    transition: color var(--transition-normal);
}

.current-player.white-turn {
    color: var(--color-white);
}

.current-player.black-turn {
    color: var(--color-black);
}

/* ============================================
   AI CONFIG PANEL
   ============================================ */
.ai-config {
    transition: opacity var(--transition-normal),
                max-height var(--transition-normal);
    overflow: hidden;
}

.ai-config.disabled {
    opacity: 0.5;
    pointer-events: none;
}

/* AI Strength descriptions */
.strength-desc[data-level="1"]::after { content: ' - Beginner'; }
.strength-desc[data-level="2"]::after { content: ' - Casual'; }
.strength-desc[data-level="3"]::after { content: ' - Intermediate'; }
.strength-desc[data-level="4"]::after { content: ' - Advanced'; }
.strength-desc[data-level="5"]::after { content: ' - Expert'; }

/* ============================================
   VIEW OPTIONS PANEL
   ============================================ */
#panel-view .checkbox-label {
    padding: 4px 0;
    border-radius: var(--radius-sm);
    transition: background var(--transition-fast);
}

#panel-view .checkbox-label:hover {
    background: var(--surface-hover);
}

/* Custom checkbox styling */
.checkbox-label input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border: 2px solid var(--text-muted);
    border-radius: 4px;
    background: var(--surface-dark);
    cursor: pointer;
    position: relative;
    transition: all var(--transition-fast);
}

.checkbox-label input[type="checkbox"]:checked {
    background: var(--accent-blue);
    border-color: var(--accent-blue);
}

.checkbox-label input[type="checkbox"]:checked::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 0.75rem;
    font-weight: 700;
}

.checkbox-label input[type="checkbox"]:focus-visible {
    outline: 2px solid var(--accent-blue);
    outline-offset: 2px;
}

/* ============================================
   GAME LOG PANEL
   ============================================ */
.game-log {
    scrollbar-width: thin;
    scrollbar-color: var(--surface-hover) var(--surface-dark);
}

.log-entry {
    display: flex;
    gap: 8px;
    align-items: baseline;
}

.log-entry .move-number {
    color: var(--text-muted);
    min-width: 24px;
    font-size: 0.625rem;
}

.log-entry .move-text {
    flex: 1;
}

.log-entry .timestamp {
    font-size: 0.5rem;
    color: var(--text-muted);
}

/* Collapse indicator in log */
.log-entry .collapse-count {
    color: var(--accent-red);
    font-weight: 600;
}

/* ============================================
   MOVE HISTORY PANEL
   ============================================ */
.move-history {
    font-family: var(--font-mono);
}

.history-row {
    display: grid;
    grid-template-columns: 32px 1fr 1fr;
    gap: 8px;
    padding: 4px 0;
    border-bottom: var(--border-subtle);
}

.history-row:last-child {
    border-bottom: none;
}

.history-row .turn-num {
    color: var(--text-muted);
    font-size: 0.625rem;
}

.history-row .white-move,
.history-row .black-move {
    font-size: 0.75rem;
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 2px;
    transition: background var(--transition-fast);
}

.history-row .white-move:hover,
.history-row .black-move:hover {
    background: var(--surface-hover);
}

.history-row .white-move {
    color: var(--color-white);
}

.history-row .black-move {
    color: var(--color-black);
}

.history-row .white-move.active,
.history-row .black-move.active {
    background: var(--surface-active);
}

/* ============================================
   HISTORY CONTROLS
   ============================================ */
.history-controls {
    display: flex;
    justify-content: center;
    gap: 4px;
    padding-top: 8px;
    border-top: var(--border-subtle);
}

.history-controls .btn-icon {
    padding: 6px;
}

.history-controls .btn-icon:disabled {
    opacity: 0.3;
}

/* ============================================
   PIECE INFO DISPLAY
   ============================================ */
.piece-info-display {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--surface-dark);
    border-radius: var(--radius-sm);
    margin-bottom: 12px;
}

.piece-info-display .piece-mini {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    font-size: 1.5rem;
}

.piece-info-display .piece-mini.white {
    background: var(--color-white-bg);
    border: 1px solid var(--color-white);
    color: var(--color-white);
}

.piece-info-display .piece-mini.black {
    background: var(--color-black-bg);
    border: 1px solid var(--color-black);
    color: var(--color-black);
}

.piece-info-display .piece-details {
    flex: 1;
}

.piece-info-display .piece-name {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.875rem;
}

.piece-info-display .piece-position {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
}

/* ============================================
   STATS DISPLAY
   ============================================ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.stat-item {
    background: var(--surface-dark);
    padding: 12px;
    border-radius: var(--radius-sm);
    text-align: center;
}

.stat-item .stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

.stat-item .stat-label {
    font-size: 0.625rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.stat-item.white .stat-value {
    color: var(--color-white);
}

.stat-item.black .stat-value {
    color: var(--color-black);
}

/* ============================================
   ACTION BUTTONS
   ============================================ */
.action-buttons {
    display: flex;
    gap: 8px;
    margin-top: 16px;
}

.action-buttons .btn {
    flex: 1;
}

/* ============================================
   TOGGLE SWITCH (alternative to checkbox)
   ============================================ */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--surface-light);
    transition: var(--transition-fast);
    border-radius: 24px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: var(--text-secondary);
    transition: var(--transition-fast);
    border-radius: 50%;
}

.toggle-switch input:checked + .toggle-slider {
    background-color: var(--accent-blue);
}

.toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(20px);
    background-color: white;
}

/* ============================================
   TOOLTIP
   ============================================ */
.tooltip {
    position: relative;
}

.tooltip::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    padding: 6px 10px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 0.75rem;
    border-radius: var(--radius-sm);
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--transition-fast),
                visibility var(--transition-fast);
    z-index: 100;
    box-shadow: var(--shadow-md);
}

.tooltip:hover::after {
    opacity: 1;
    visibility: visible;
}

/* ============================================
   PROGRESS INDICATOR
   ============================================ */
.progress-bar {
    height: 4px;
    background: var(--surface-light);
    border-radius: 2px;
    overflow: hidden;
}

.progress-bar .progress-fill {
    height: 100%;
    background: var(--accent-blue);
    transition: width var(--transition-normal);
}

/* ============================================
   BADGES
   ============================================ */
.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 2px 8px;
    font-size: 0.625rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-radius: 4px;
}

.badge-white {
    background: var(--color-white-bg);
    color: var(--color-white);
}

.badge-black {
    background: var(--color-black-bg);
    color: var(--color-black);
}

.badge-success {
    background: rgba(74, 222, 128, 0.2);
    color: var(--color-win);
}

.badge-warning {
    background: rgba(251, 191, 36, 0.2);
    color: var(--color-warning);
}

.badge-info {
    background: rgba(96, 165, 250, 0.2);
    color: var(--color-info);
}

/* ============================================
   EMPTY STATE
   ============================================ */
.empty-state {
    text-align: center;
    padding: 24px;
    color: var(--text-muted);
}

.empty-state .empty-icon {
    font-size: 2rem;
    margin-bottom: 8px;
    opacity: 0.5;
}

.empty-state .empty-text {
    font-size: 0.875rem;
}

/* ============================================
   LOADING STATE
   ============================================ */
.loading-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px;
    gap: 12px;
}

.loading-state .loading-text {
    font-size: 0.875rem;
    color: var(--text-muted);
}

/* ============================================
   RESPONSIVE PANELS
   ============================================ */
@media (max-width: 1199px) {
    .control-panel {
        flex-direction: row;
        flex-wrap: wrap;
        max-height: none;
        border-right: none;
        border-bottom: var(--border-subtle);
    }
    
    .panel-card {
        flex: 1 1 calc(50% - 8px);
        min-width: 280px;
    }
}

@media (max-width: 768px) {
    .control-panel {
        padding: 12px;
        gap: 12px;
    }
    
    .panel-card {
        flex: 1 1 100%;
    }
}

@media (max-width: 480px) {
    .panel-header h3 {
        font-size: 0.625rem;
    }
    
    .panel-body {
        padding: 12px;
    }
    
    .turn-number {
        font-size: 1.5rem;
    }
}