/* 
 * Research Progress Modal - Modern Animated UI
 * Built for AdventureVanParts.com real-time research progress tracking
 */

/* Modal Overlay and Container */
.research-progress-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.research-progress-overlay.active {
    opacity: 1;
    visibility: visible;
}

.research-progress-modal {
    background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
    width: 100%;
    max-width: 1000px;
    max-height: 90vh;
    overflow: hidden;
    transform: scale(0.9) translateY(50px);
    transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    color: #f8fafc;
}

.research-progress-overlay.active .research-progress-modal {
    transform: scale(1) translateY(0);
}

/* Header Section */
.progress-modal-header {
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    padding: 25px 30px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    position: relative;
    overflow: hidden;
}

.progress-modal-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    animation: shimmer 3s infinite;
}

@keyframes shimmer {
    0% { left: -100%; }
    100% { left: 100%; }
}

.progress-modal-title {
    font-size: 24px;
    font-weight: 700;
    margin: 0 0 8px 0;
    display: flex;
    align-items: center;
    gap: 12px;
}

.progress-modal-title .icon {
    font-size: 28px;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.progress-modal-subtitle {
    font-size: 16px;
    opacity: 0.9;
    margin: 0;
}

.progress-close-btn {
    position: absolute;
    top: 25px;
    right: 30px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    color: #fff;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.progress-close-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: rotate(90deg);
}

/* Main Content Grid */
.progress-modal-content {
    display: grid;
    grid-template-columns: 1fr 350px;
    gap: 0;
    height: calc(90vh - 120px);
    min-height: 500px;
}

/* Left Panel - Progress and Controls */
.progress-main-panel {
    padding: 30px;
    display: flex;
    flex-direction: column;
    gap: 25px;
    overflow-y: auto;
}

/* Circular Progress Ring */
.progress-ring-container {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 20px 0;
}

.progress-ring {
    position: relative;
    width: 200px;
    height: 200px;
}

.progress-ring svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.progress-ring-bg {
    fill: none;
    stroke: rgba(255, 255, 255, 0.1);
    stroke-width: 8;
}

.progress-ring-fill {
    fill: none;
    stroke: #22c55e;
    stroke-width: 8;
    stroke-linecap: round;
    stroke-dasharray: 565.48; /* 2 * π * 90 */
    stroke-dashoffset: 565.48;
    transition: stroke-dashoffset 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    filter: drop-shadow(0 0 10px rgba(34, 197, 94, 0.5));
}

.progress-ring-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}

.progress-percentage {
    font-size: 36px;
    font-weight: 700;
    color: #22c55e;
    line-height: 1;
    text-shadow: 0 0 20px rgba(34, 197, 94, 0.3);
}

.progress-phase {
    font-size: 14px;
    color: #94a3b8;
    margin-top: 5px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Phase Indicators */
.phase-indicators {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
    margin: 20px 0;
}

.phase-indicator {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    flex: 1;
    position: relative;
}

.phase-indicator:not(:last-child)::after {
    content: '';
    position: absolute;
    top: 20px;
    right: -50%;
    width: 100%;
    height: 2px;
    background: rgba(255, 255, 255, 0.1);
    z-index: 1;
}

.phase-indicator.completed::after {
    background: #22c55e;
}

.phase-dot {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: all 0.3s ease;
    position: relative;
    z-index: 2;
}

.phase-indicator.active .phase-dot {
    background: #3b82f6;
    border-color: #3b82f6;
    color: #fff;
    animation: pulse-glow 2s infinite;
}

.phase-indicator.completed .phase-dot {
    background: #22c55e;
    border-color: #22c55e;
    color: #fff;
}

@keyframes pulse-glow {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.7);
    }
    50% {
        box-shadow: 0 0 0 10px rgba(59, 130, 246, 0);
    }
}

.phase-label {
    font-size: 12px;
    color: #94a3b8;
    text-align: center;
    line-height: 1.2;
}

.phase-indicator.active .phase-label {
    color: #3b82f6;
    font-weight: 600;
}

.phase-indicator.completed .phase-label {
    color: #22c55e;
}

/* Control Buttons */
.progress-controls {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: auto;
    padding-top: 20px;
}

.progress-control-btn {
    padding: 12px 24px;
    border: 2px solid;
    border-radius: 12px;
    background: transparent;
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.progress-control-btn.pause {
    border-color: #f59e0b;
    color: #f59e0b;
}

.progress-control-btn.pause:hover {
    background: #f59e0b;
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(245, 158, 11, 0.3);
}

.progress-control-btn.resume {
    border-color: #22c55e;
    color: #22c55e;
}

.progress-control-btn.resume:hover {
    background: #22c55e;
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(34, 197, 94, 0.3);
}

.progress-control-btn.cancel {
    border-color: #ef4444;
    color: #ef4444;
}

.progress-control-btn.cancel:hover {
    background: #ef4444;
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(239, 68, 68, 0.3);
}

.progress-control-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

/* Right Panel - Stats and Logs */
.progress-side-panel {
    background: rgba(0, 0, 0, 0.2);
    border-left: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    flex-direction: column;
}

/* Statistics Section */
.progress-stats {
    padding: 25px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.progress-stats h3 {
    font-size: 18px;
    font-weight: 600;
    margin: 0 0 20px 0;
    color: #f8fafc;
    display: flex;
    align-items: center;
    gap: 8px;
}

.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.stat-item {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 15px;
    text-align: center;
    transition: all 0.2s ease;
}

.stat-item:hover {
    background: rgba(255, 255, 255, 0.08);
    transform: translateY(-2px);
}

.stat-value {
    font-size: 24px;
    font-weight: 700;
    color: #3b82f6;
    line-height: 1;
}

.stat-label {
    font-size: 12px;
    color: #94a3b8;
    margin-top: 5px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Success Rate Indicator */
.success-rate {
    grid-column: 1 / -1;
    margin-top: 10px;
}

.success-rate-bar {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    overflow: hidden;
    margin-top: 8px;
}

.success-rate-fill {
    height: 100%;
    background: linear-gradient(90deg, #22c55e, #16a34a);
    border-radius: 4px;
    transition: width 0.5s ease;
    position: relative;
}

.success-rate-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    animation: progress-shine 2s infinite;
}

@keyframes progress-shine {
    0% { left: -100%; }
    100% { left: 100%; }
}

/* Live Logs Section */
.progress-logs {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.progress-logs h3 {
    font-size: 18px;
    font-weight: 600;
    margin: 0;
    padding: 25px 25px 15px 25px;
    color: #f8fafc;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logs-container {
    flex: 1;
    overflow-y: auto;
    padding: 0 25px 25px 25px;
    scroll-behavior: smooth;
}

.log-entry {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    animation: logFadeIn 0.3s ease;
    opacity: 0;
    transform: translateX(20px);
    animation-fill-mode: forwards;
}

@keyframes logFadeIn {
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.log-timestamp {
    font-size: 11px;
    color: #64748b;
    min-width: 50px;
    font-family: monospace;
}

.log-level {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-top: 4px;
    flex-shrink: 0;
}

.log-level.info { background: #3b82f6; box-shadow: 0 0 10px rgba(59, 130, 246, 0.5); }
.log-level.success { background: #22c55e; box-shadow: 0 0 10px rgba(34, 197, 94, 0.5); }
.log-level.warning { background: #f59e0b; box-shadow: 0 0 10px rgba(245, 158, 11, 0.5); }
.log-level.error { background: #ef4444; box-shadow: 0 0 10px rgba(239, 68, 68, 0.5); }

.log-message {
    flex: 1;
    font-size: 13px;
    line-height: 1.4;
    color: #e2e8f0;
}

/* Auto-scroll indicator */
.logs-auto-scroll {
    position: sticky;
    bottom: 0;
    background: linear-gradient(to top, rgba(30, 41, 59, 0.9), transparent);
    padding: 10px 0;
    text-align: center;
}

.auto-scroll-btn {
    background: rgba(59, 130, 246, 0.2);
    border: 1px solid #3b82f6;
    border-radius: 20px;
    color: #3b82f6;
    padding: 5px 15px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.auto-scroll-btn:hover {
    background: #3b82f6;
    color: #fff;
}

/* Responsive Design */
@media (max-width: 768px) {
    .research-progress-modal {
        max-width: 95%;
        margin: 10px;
    }
    
    .progress-modal-content {
        grid-template-columns: 1fr;
        grid-template-rows: 1fr auto;
    }
    
    .progress-side-panel {
        max-height: 300px;
        border-left: none;
        border-top: 1px solid rgba(255, 255, 255, 0.1);
    }
    
    .progress-main-panel {
        padding: 20px;
    }
    
    .progress-ring {
        width: 150px;
        height: 150px;
    }
    
    .progress-percentage {
        font-size: 28px;
    }
    
    .phase-indicators {
        padding: 0 10px;
    }
    
    .phase-dot {
        width: 30px;
        height: 30px;
        font-size: 14px;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .progress-controls {
        flex-direction: column;
        gap: 10px;
    }
    
    .progress-control-btn {
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .progress-modal-header {
        padding: 20px;
    }
    
    .progress-modal-title {
        font-size: 20px;
    }
    
    .progress-close-btn {
        top: 20px;
        right: 20px;
        width: 35px;
        height: 35px;
    }
    
    .phase-indicators {
        flex-direction: column;
        gap: 15px;
    }
    
    .phase-indicator::after {
        display: none;
    }
}

/* Loading Animation */
.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s linear infinite;
}

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

/* Glow Effects */
.glow {
    filter: drop-shadow(0 0 10px currentColor);
}

.glow-pulse {
    animation: glow-pulse 2s infinite;
}

@keyframes glow-pulse {
    0%, 100% {
        filter: drop-shadow(0 0 5px currentColor);
    }
    50% {
        filter: drop-shadow(0 0 20px currentColor);
    }
}