/**
 * Race Replay Component Styles v2
 * Horizontal lanes, viewport scrolling, minimap
 */

.race-replay-wrapper {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    overflow: hidden;
    border-left: 4px solid #f59e0b;
}

.race-replay-header {
    padding: 12px 16px;
    background: linear-gradient(to right, #fef3c7, #fefce8);
    border-bottom: 1px solid #fde68a;
}

/* Viewport - clips the scrolling track */
.race-replay-viewport {
    position: relative;
    overflow: hidden;
    background: #f3f4f6;
    border-top: 1px solid #e5e7eb;
    border-bottom: 1px solid #e5e7eb;
}

.race-replay-track {
    position: relative;
    transition: transform 0.1s ease-out;
    padding: 10px 0;
}

.race-replay-svg {
    display: block;
}

/* Minimap */
.race-replay-minimap {
    padding: 8px 16px;
    background: #f9fafb;
    border-bottom: 1px solid #e5e7eb;
}

.minimap-track {
    position: relative;
    height: 20px;
    background: linear-gradient(to right, #1a1a1a 2px, #c9a66b 2px, #c9a66b calc(100% - 2px), #dc2626 calc(100% - 2px));
    border-radius: 4px;
    overflow: hidden;
}

.minimap-viewport {
    position: absolute;
    top: 0;
    height: 100%;
    background: rgba(59, 130, 246, 0.3);
    border: 2px solid #3b82f6;
    border-radius: 2px;
    transition: left 0.1s ease-out, width 0.1s ease-out;
}

.minimap-horses {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
}

.minimap-dot {
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 8px;
    height: 8px;
    border-radius: 50%;
    border: 1px solid white;
    box-shadow: 0 1px 2px rgba(0,0,0,0.3);
    transition: left 0.1s ease-out;
}

.minimap-labels {
    display: flex;
    justify-content: space-between;
    font-size: 9px;
    color: #9ca3af;
    margin-top: 4px;
    padding: 0 2px;
}

/* Horse list */
.race-replay-horses {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 12px 16px;
    background: white;
    border-bottom: 1px solid #e5e7eb;
    max-height: 120px;
    overflow-y: auto;
}

.horse-row {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
    font-size: 12px;
}

.horse-row:hover {
    background: #eff6ff;
    border-color: #bfdbfe;
}

.horse-row.selected {
    background: #dcfce7;
    border-color: #86efac;
}

.horse-silk {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
}

.horse-silk img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.horse-num {
    font-weight: 700;
    color: #374151;
    min-width: 20px;
}

.horse-name {
    color: #6b7280;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 120px;
}

/* Controls */
.race-replay-controls {
    padding: 12px 16px;
    background: white;
    border-top: 1px solid #e5e7eb;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

@media (min-width: 640px) {
    .race-replay-controls {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }
}

.replay-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 10px;
    border-radius: 8px;
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
    color: #374151;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.replay-btn:hover {
    background: #e5e7eb;
    border-color: #d1d5db;
}

.replay-btn-primary {
    background: #0A2540;
    border-color: #0A2540;
    color: white;
}

.replay-btn-primary:hover {
    background: #1a3a5c;
    border-color: #1a3a5c;
}

.replay-progress-container {
    flex: 1;
    position: relative;
    padding-top: 20px;
    min-width: 200px;
}

.replay-scrubber {
    width: 100%;
    height: 8px;
    border-radius: 4px;
    background: #e5e7eb;
    -webkit-appearance: none;
    appearance: none;
    cursor: pointer;
}

.replay-scrubber::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #0A2540;
    cursor: pointer;
    border: 3px solid white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    transition: transform 0.15s ease;
}

.replay-scrubber::-webkit-slider-thumb:hover {
    transform: scale(1.1);
}

.replay-scrubber::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #0A2540;
    cursor: pointer;
    border: 3px solid white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.replay-furlong-markers {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 16px;
    pointer-events: none;
}

.replay-marker {
    position: absolute;
    transform: translateX(-50%);
    font-size: 10px;
    color: #9ca3af;
    font-weight: 500;
}

.race-replay-legend {
    padding: 8px 16px;
    background: #fafafa;
    border-top: 1px solid #e5e7eb;
}

/* Real speed controls */
.real-speed-controls {
    padding: 10px 16px;
    background: linear-gradient(to right, #fef3c7, #fefce8);
    border-top: 1px solid #fde68a;
    display: none;
}

.real-speed-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 6px;
}

.real-speed-row:last-child {
    margin-bottom: 0;
}

.real-speed-row label {
    font-size: 12px;
    font-weight: 500;
    color: #92400e;
    min-width: 140px;
}

.real-speed-row label span {
    font-weight: 700;
    color: #78350f;
}

.real-speed-row input[type="range"] {
    flex: 1;
    height: 6px;
    -webkit-appearance: none;
    background: #fde68a;
    border-radius: 3px;
    outline: none;
}

.real-speed-row input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    background: #f59e0b;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid white;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.real-speed-row input[type="range"]::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background: #f59e0b;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid white;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

/* Loading state */
.race-replay-loading {
    padding: 32px;
    text-align: center;
    color: #6b7280;
    font-size: 14px;
}

.race-replay-loading::before {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #e5e7eb;
    border-top-color: #0A2540;
    border-radius: 50%;
    margin-right: 8px;
    vertical-align: middle;
    animation: replay-spin 0.8s linear infinite;
}

@keyframes replay-spin {
    to { transform: rotate(360deg); }
}

/* Error state */
.race-replay-error {
    padding: 32px;
    text-align: center;
}

/* Upgrade prompt */
.race-replay-upgrade {
    padding: 20px;
    background: linear-gradient(135deg, #fffbeb, #fef3c7);
    border-radius: 12px;
    border: 1px solid #fde68a;
}

/* Horse markers animation */
.horse-marker {
    transition: transform 0.05s ease-out;
}

/* Responsive adjustments */
@media (max-width: 640px) {
    .race-replay-viewport {
        min-height: 200px;
    }

    .race-replay-controls {
        padding: 8px 12px;
    }

    .replay-btn {
        min-width: 32px;
        height: 32px;
    }

    .horse-row {
        padding: 3px 8px;
        font-size: 11px;
    }

    .horse-name {
        max-width: 80px;
    }
}

/* View Toggle Buttons */
.replay-view-toggle {
    display: flex;
    gap: 4px;
    background: #f3f4f6;
    border-radius: 8px;
    padding: 3px;
}

.view-toggle-btn {
    padding: 6px 14px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: #6b7280;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
}

.view-toggle-btn:hover {
    color: #374151;
    background: #e5e7eb;
}

.view-toggle-btn.active {
    background: white;
    color: #0A2540;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Oval view container */
.oval-view-container {
    display: none;
}

.oval-view-container.active {
    display: block;
}

/* Classic view container */
.classic-view-container {
    display: block;
}

.classic-view-container.hidden {
    display: none;
}
