/* ========================================
   STAGE5: Replay Player Modal
   ======================================== */

.replay-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(10px);
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.replay-modal.active {
    display: flex;
}

.replay-modal-content {
    background: var(--glass-bg);
    border-radius: 20px;
    border: 1px solid var(--glass-border);
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
    max-width: 800px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
}

/* Header */
.replay-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.replay-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.2em;
    font-weight: bold;
    color: #DFAC6D;
}

.replay-icon {
    color: #10b981;
}

.replay-close-btn {
    background: none;
    border: none;
    color: #888;
    font-size: 1.8em;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    transition: color 0.2s;
}

.replay-close-btn:hover {
    color: #ef4444;
}

/* Body */
.replay-body {
    display: grid;
    grid-template-columns: 1fr 180px;
    gap: 20px;
    padding: 25px;
}

/* Puzzle Container */
.replay-puzzle-container {
    position: relative;
    width: 100%;
    padding-bottom: 100%;
    background: rgba(0, 0, 0, 0.4);
    border-radius: 12px;
    overflow: hidden;
    border: 2px solid rgba(255, 255, 255, 0.1);
}

.replay-puzzle-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: transform 0.05s linear;
}

/* Loading State */
.replay-loading {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 15px;
    color: #888;
}

.replay-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top-color: #DFAC6D;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* No Puzzle / Error State */
.replay-no-puzzle,
.replay-error {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: #888;
    padding: 20px;
}

.replay-error .error-icon {
    font-size: 3em;
    color: #ef4444;
    margin-bottom: 10px;
}

/* Rotation Display */
.replay-rotation-display {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.replay-ring-data {
    background: rgba(255, 255, 255, 0.05);
    padding: 12px;
    border-radius: 8px;
    text-align: center;
    border-left: 3px solid;
}

.replay-ring-data.ring1 { border-left-color: #9b59b6; }
.replay-ring-data.ring2 { border-left-color: #e74c3c; }
.replay-ring-data.ring3 { border-left-color: #f39c12; }

.replay-ring-data .ring-label {
    display: block;
    font-size: 0.75em;
    color: #888;
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.replay-ring-data .ring-value {
    display: block;
    font-size: 1.4em;
    font-weight: bold;
    font-family: monospace;
    color: #fff;
}

.replay-ring-data .ring-value::after {
    content: '\00B0'; /* degree symbol */
    font-size: 0.7em;
    opacity: 0.7;
}

/* Controls */
.replay-controls {
    padding: 20px 25px;
    background: rgba(0, 0, 0, 0.2);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

/* Progress / Seek Bar */
.replay-progress-container {
    margin-bottom: 15px;
}

.replay-seek-bar {
    width: 100%;
    height: 8px;
    -webkit-appearance: none;
    appearance: none;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    outline: none;
    cursor: pointer;
}

.replay-seek-bar::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    background: #DFAC6D;
    border-radius: 50%;
    cursor: pointer;
    transition: transform 0.2s;
}

.replay-seek-bar::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.replay-seek-bar::-moz-range-thumb {
    width: 18px;
    height: 18px;
    background: #DFAC6D;
    border-radius: 50%;
    cursor: pointer;
    border: none;
}

.replay-time-display {
    display: flex;
    justify-content: center;
    gap: 5px;
    margin-top: 8px;
    font-family: monospace;
    font-size: 0.9em;
    color: #888;
}

.replay-time-separator {
    opacity: 0.5;
}

/* Buttons */
.replay-buttons {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
}

.replay-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    padding: 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 1em;
    display: flex;
    align-items: center;
    justify-content: center;
}

.replay-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.3);
}

.replay-play-btn {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    font-size: 1.5em;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    border-color: transparent;
}

.replay-play-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 20px rgba(16, 185, 129, 0.3);
}

.replay-step-btn {
    width: 44px;
    height: 44px;
    font-size: 0.8em;
}

/* Speed Controls */
.replay-speed-controls {
    display: flex;
    gap: 4px;
    margin-left: 20px;
    padding-left: 20px;
    border-left: 1px solid rgba(255, 255, 255, 0.1);
}

.replay-speed-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #888;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85em;
    font-weight: 600;
    transition: all 0.2s;
}

.replay-speed-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.replay-speed-btn.active {
    background: rgba(223, 172, 109, 0.2);
    border-color: #DFAC6D;
    color: #DFAC6D;
}

/* Info */
.replay-info {
    margin-left: auto;
    padding-left: 20px;
    border-left: 1px solid rgba(255, 255, 255, 0.1);
}

.replay-point-count {
    font-size: 0.8em;
    color: #888;
    font-family: monospace;
}

/* Session Info */
.replay-session-info {
    padding: 15px 25px 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.replay-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 15px;
}

.replay-info-item {
    text-align: center;
}

.replay-info-label {
    display: block;
    font-size: 0.7em;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 4px;
}

.replay-info-value {
    display: block;
    font-size: 0.95em;
    font-weight: 600;
    color: #fff;
}

/* Outcome colors in replay info */
.replay-info-value.outcome-solved {
    color: #10b981;
}

.replay-info-value.outcome-skipped {
    color: #f59e0b;
}

.replay-info-value.outcome-timeout,
.replay-info-value.outcome-background_timeout {
    color: #ef4444;
}

.replay-info-value.outcome-abandoned {
    color: #6b7280;
}

/* ========================================
   STAGE5: History Card Play Button Active
   ======================================== */

.history-action-btn.play-btn {
    /* Enable hover styles since it's no longer disabled */
}

.history-action-btn.play-btn:hover {
    background: rgba(16, 185, 129, 0.2);
    border-color: rgba(16, 185, 129, 0.5);
    color: #10b981;
}

/* ========================================
   STAGE5: Responsive Adjustments
   ======================================== */

@media (max-width: 768px) {
    .replay-modal-content {
        max-width: 100%;
        max-height: 100vh;
        border-radius: 0;
    }
    
    .replay-body {
        grid-template-columns: 1fr;
    }
    
    .replay-rotation-display {
        flex-direction: row;
        justify-content: space-around;
    }
    
    .replay-ring-data {
        flex: 1;
        max-width: 100px;
    }
    
    .replay-buttons {
        flex-wrap: wrap;
    }
    
    .replay-speed-controls {
        margin-left: 0;
        padding-left: 0;
        border-left: none;
        margin-top: 10px;
        width: 100%;
        justify-content: center;
    }
    
    .replay-info {
        margin-left: 0;
        padding-left: 0;
        border-left: none;
        width: 100%;
        text-align: center;
        margin-top: 10px;
    }
}

@media (max-width: 480px) {
    .replay-header {
        padding: 15px 20px;
    }
    
    .replay-title {
        font-size: 1em;
    }
    
    .replay-body {
        padding: 15px;
    }
    
    .replay-controls {
        padding: 15px;
    }
    
    .replay-play-btn {
        width: 50px;
        height: 50px;
        font-size: 1.3em;
    }
    
    .replay-step-btn {
        width: 38px;
        height: 38px;
    }
}
