/* ==========================================================================
   HomeworkHero - Modern Import Progress Bar & Live Status System
   Aesthetic: Premium, dynamic, vibrant gradients, glassmorphism, micro-animations
   ========================================================================== */

/* Fullscreen / In-Modal Progress Overlay Backdrop */
.import-progress-overlay {
    position: fixed;
    inset: 0;
    z-index: 100050;
    background: rgba(15, 23, 42, 0.75);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.import-progress-overlay.is-active {
    display: flex;
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

/* Modal Inner Card */
.import-progress-card {
    background: #ffffff;
    width: 100%;
    max-width: 580px;
    border-radius: 20px;
    box-shadow: 0 25px 60px -15px rgba(15, 23, 42, 0.4), 0 0 0 1px rgba(226, 232, 240, 0.8);
    overflow: hidden;
    transform: translateY(16px) scale(0.97);
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

.import-progress-overlay.is-active .import-progress-card {
    transform: translateY(0) scale(1);
}

/* Header with Soft Themed Background */
.import-progress-header {
    background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 60%, #312e81 100%);
    padding: 22px 26px;
    color: #ffffff;
    display: flex;
    align-items: center;
    gap: 16px;
    position: relative;
}

.import-progress-icon-wrap {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.12);
    border: 1.5px solid rgba(255, 255, 255, 0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    position: relative;
    overflow: hidden;
}

.import-progress-icon-wrap.is-pulsing::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 14px;
    border: 2px solid #818cf8;
    animation: importPulseHalo 2s infinite ease-out;
}

@keyframes importPulseHalo {
    0% { transform: scale(1); opacity: 0.8; }
    100% { transform: scale(1.6); opacity: 0; }
}

.import-progress-title-box {
    flex: 1;
    min-width: 0;
}

.import-progress-title {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 800;
    letter-spacing: -0.01em;
    color: #ffffff;
    display: flex;
    align-items: center;
    gap: 8px;
}

.import-progress-subtitle {
    margin: 4px 0 0 0;
    font-size: 0.82rem;
    color: #c7d2fe;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.import-progress-close-x {
    position: absolute;
    top: 18px;
    right: 20px;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.22);
    color: #ffffff;
    font-size: 1.35rem;
    line-height: 1;
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.import-progress-close-x:hover {
    background: rgba(255, 255, 255, 0.28);
    transform: scale(1.06);
}

/* Main Body */
.import-progress-body {
    padding: 24px 26px;
    background: #ffffff;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

/* Details Pill */
.import-progress-meta-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    font-size: 0.8rem;
    color: #64748b;
}

.import-progress-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #f1f5f9;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 700;
    color: #334155;
    border: 1px solid #e2e8f0;
}

.import-progress-timer {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 0.8rem;
    font-weight: 700;
    color: #64748b;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

/* Progress Bar Component */
.import-bar-container {
    width: 100%;
}

.import-bar-track {
    width: 100%;
    height: 18px;
    background: #e2e8f0;
    border-radius: 999px;
    overflow: hidden;
    position: relative;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.08);
    border: 1px solid #cbd5e1;
}

.import-bar-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #4f46e5 0%, #7c3aed 40%, #06b6d4 80%, #10b981 100%);
    border-radius: 999px;
    position: relative;
    transition: width 0.35s cubic-bezier(0.4, 0, 0.2, 1), background 0.4s ease;
    box-shadow: 0 0 14px rgba(99, 102, 241, 0.4);
}

/* Animated Candy Stripe Overlay */
.import-bar-fill::after {
    content: '';
    position: absolute;
    inset: 0;
    background-image: repeating-linear-gradient(
        45deg,
        rgba(255, 255, 255, 0.22) 0,
        rgba(255, 255, 255, 0.22) 12px,
        transparent 12px,
        transparent 24px
    );
    background-size: 34px 34px;
    animation: importStripeSlide 1.2s linear infinite;
}

@keyframes importStripeSlide {
    0% { background-position: 0 0; }
    100% { background-position: 34px 0; }
}

/* Success State Fill */
.import-bar-fill.is-success {
    background: linear-gradient(90deg, #059669 0%, #10b981 50%, #34d399 100%) !important;
    box-shadow: 0 0 16px rgba(16, 185, 129, 0.45) !important;
}

/* Error State Fill */
.import-bar-fill.is-error {
    background: linear-gradient(90deg, #b91c1c 0%, #dc2626 50%, #ef4444 100%) !important;
    box-shadow: 0 0 16px rgba(239, 68, 68, 0.45) !important;
}

/* Percent & Status Label Row */
.import-bar-info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 8px;
    font-size: 0.88rem;
}

.import-stage-badge {
    font-weight: 800;
    color: #4338ca;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.import-pct-display {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-weight: 800;
    font-size: 1.1rem;
    color: #0f172a;
}

/* Step Pipeline Stepper */
.import-stepper {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
    margin-top: 4px;
}

.import-step-item {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 6px 8px;
    text-align: center;
    font-size: 0.72rem;
    font-weight: 700;
    color: #94a3b8;
    transition: all 0.25s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.import-step-item.is-done {
    background: #ecfdf5;
    border-color: #86efac;
    color: #065f46;
}

.import-step-item.is-active {
    background: #eef2ff;
    border-color: #a5b4fc;
    color: #4338ca;
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.15);
    animation: importActivePulse 1.8s infinite ease-in-out;
}

@keyframes importActivePulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.02); }
}

/* Dynamic Live Status Message Box */
.import-live-status-box {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 12px 14px;
    font-size: 0.84rem;
    color: #334155;
    line-height: 1.45;
    display: flex;
    align-items: center;
    gap: 10px;
}

.import-status-spinner {
    width: 20px;
    height: 20px;
    border: 2.5px solid #cbd5e1;
    border-top-color: #4f46e5;
    border-radius: 50%;
    animation: importSpin 0.8s linear infinite;
    flex-shrink: 0;
}

@keyframes importSpin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.import-status-text {
    flex: 1;
    font-weight: 600;
}

/* Error Alert Box */
.import-error-banner {
    display: none;
    background: #fef2f2;
    border: 1.5px solid #fca5a5;
    border-radius: 12px;
    padding: 12px 16px;
    color: #991b1b;
    font-size: 0.84rem;
    font-weight: 600;
    line-height: 1.4;
}

/* Success Banner */
.import-success-banner {
    display: none;
    background: #ecfdf5;
    border: 1.5px solid #6ee7b7;
    border-radius: 12px;
    padding: 12px 16px;
    color: #065f46;
    font-size: 0.88rem;
    font-weight: 700;
    text-align: center;
}

/* Footer Controls */
.import-progress-footer {
    padding: 14px 26px;
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 10px;
}

.import-progress-btn-cancel,
.import-progress-btn-retry {
    padding: 7px 16px;
    font-size: 0.85rem;
    font-weight: 700;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.import-progress-btn-cancel {
    background: #ffffff;
    border: 1px solid #cbd5e1;
    color: #475569;
}

.import-progress-btn-cancel:hover:not(:disabled) {
    background: #f1f5f9;
    color: #1e293b;
}

.import-progress-btn-retry {
    background: #4f46e5;
    border: 1px solid #4338ca;
    color: #ffffff;
}

.import-progress-btn-retry:hover {
    background: #4338ca;
}

.import-progress-btn-cancel:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Submitting Button Pulsing State */
button.import-btn-loading,
input[type="submit"].import-btn-loading {
    position: relative;
    pointer-events: none;
    opacity: 0.85;
}
