/* ========================================
   Modal Components - DRY Refactored
   ======================================== */

/* ========================================
   1. BASE MODAL STYLES
   ======================================== */

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 9999;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.modal-content {
    background: var(--color-bg-tertiary);
    border-radius: var(--radius-xl);
    padding: 2rem;
    max-width: 600px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
    border: 1px solid var(--color-border-primary);
}

.modal-content h2 {
    margin: 0 0 1.5rem 0;
    color: var(--color-text-primary);
    text-align: center;
}

/* ========================================
   2. ANALYSIS MODAL (HTMX + Alpine.js)
   ======================================== */

.analysis-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
}

.modal-dialog {
    position: relative;
    z-index: 10001;
    background: var(--color-bg-tertiary);
    border-radius: var(--radius-xl);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--color-border-primary);
}

/* ========================================
   3. MODAL HEADER, BODY, FOOTER
   ======================================== */

.modal-dialog .modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--color-border-primary);
}

.modal-dialog .modal-header h2 {
    margin: 0 0 0.5rem 0;
    font-size: 1.5rem;
    color: var(--color-text-primary);
}

.modal-dialog .progress-text {
    margin: 0;
    color: var(--color-text-secondary);
    font-size: 0.9rem;
}

.modal-dialog .modal-body {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.modal-dialog .modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--color-border-primary);
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
}

.modal-dialog .modal-footer .btn {
    min-width: 100px;
}

/* ========================================
   4. CONSOLE CONTAINER (for logs)
   ======================================== */

.console-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--color-bg-secondary);
    margin: 1rem;
    border-radius: var(--radius-xl);
    overflow: hidden;
    border: 1px solid var(--color-border-primary);
}

.console-header {
    padding: 0.75rem 1rem;
    background: var(--color-accent-console);
    color: white;
    font-weight: 600;
    font-size: 0.9rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.console-title {
    color: var(--color-brand-primary);
    font-size: var(--text-body);
    font-weight: var(--font-semibold);
    line-height: var(--leading-tight);
}

.console-body {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    line-height: 1.6;
    max-height: 400px;
    background: var(--color-bg-dark);
    color: var(--color-text-secondary);
}

/* Console Scrollbar */
.console-body::-webkit-scrollbar {
    width: 8px;
}

.console-body::-webkit-scrollbar-track {
    background: var(--color-bg-secondary);
}

.console-body::-webkit-scrollbar-thumb {
    background: var(--color-border-secondary);
    border-radius: var(--radius-md);
}

.console-body::-webkit-scrollbar-thumb:hover {
    background: var(--color-border-light);
}

/* ========================================
   5. LOG ENTRIES
   ======================================== */

.log-entry {
    padding: 0.25rem 0;
    color: var(--color-text-secondary);
}

.log-entry.success {
    color: var(--color-success-light);
}

.log-entry.error {
    color: var(--color-error-light);
}

.log-entry.warning {
    color: var(--color-warning);
}

.log-timestamp {
    color: var(--color-text-subtle-dark);
    margin-right: 0.5rem;
    font-size: 0.8rem;
}

/* ========================================
   6. PROGRESS BAR
   ======================================== */

.progress-bar-container {
    width: 100%;
    height: 24px;
    background: var(--color-bg-secondary);
    border-radius: var(--radius-xl);
    overflow: hidden;
    margin-bottom: 1rem;
    border: 1px solid var(--color-border-primary);
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--color-brand-primary), #00a86b);
    transition: width var(--transition-normal);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 12px;
}

.progress-text {
    text-align: center;
    color: var(--color-text-secondary);
    margin: 0 0 1.5rem 0;
    font-size: var(--text-body);
}

/* ========================================
   7. VIDEO STATUS LIST
   ======================================== */

.video-status-list {
    max-height: 300px;
    overflow-y: auto;
    margin-bottom: 1.5rem;
    border: 1px solid var(--color-border-primary);
    border-radius: var(--radius-xl);
    padding: 1rem;
    background: var(--color-bg-secondary);
}

.status-item {
    padding: 0.5rem;
    margin-bottom: 0.5rem;
    border-radius: var(--radius-md);
    font-size: var(--text-small);
}

.status-item.waiting {
    background: var(--color-bg-darker);
    color: var(--color-text-secondary);
}

.status-item.processing {
    background: var(--color-accent-blue-muted);
    color: var(--color-accent-blue-bright);
    animation: pulse 1.5s ease-in-out infinite;
}

.status-item.success {
    background: var(--color-success-dark);
    color: var(--color-success-light);
}

.status-item.error {
    background: var(--color-error-dark);
    color: var(--color-error-light);
}

/* ========================================
   8. RESPONSIVE STYLES
   ======================================== */

@media (max-width: 768px) {
    .modal-dialog {
        width: 95%;
        max-height: 90vh;
    }

    .modal-dialog .modal-header h2 {
        font-size: 1.25rem;
    }

    .console-body {
        font-size: 0.75rem;
        padding: 0.75rem;
    }

    .modal-dialog .modal-footer {
        padding: 0.75rem 1rem;
        flex-wrap: wrap;
    }

    .modal-dialog .modal-footer .btn {
        flex: 1;
        min-width: auto;
    }
}

/* ========================================
   9. ANIMATIONS
   ======================================== */

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