/* Modal backdrop for template-based modals */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: flex-start;
    overflow-y: auto;
    padding: 20px 0;
    z-index: 1000;
    animation: fadeIn 0.3s ease-out;
}

.modal-content {
    background-color: var(--bg-white);
    padding: 30px;
    border-radius: var(--border-radius-md);
    max-width: 500px;
    width: 90%;
    box-shadow: var(--shadow-md);
    animation: slideIn 0.3s ease-out;
}

.modal-content h3 {
    margin-top: 0;
    margin-bottom: 20px;
    color: var(--text-dark);
}

@keyframes slideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Original modal-overlay styles */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal {
    background: var(--bg-white);
    border-radius: var(--border-radius-md);
    box-shadow: var(--shadow-lg);
    width: auto;
    min-width: 320px;
    max-width: 100vw;
    max-height: 100vh;
    animation: fadeIn 0.3s ease-out;
    transform: translateY(-50px);
    overflow: hidden;
}

    .modal header {
        background: var(--brand-primary);
        color: var(--bg-white);
        font-weight: bold;
        padding: 12px 16px;
        border-top-left-radius: var(--border-radius-md);
        border-top-right-radius: var(--border-radius-md);
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }

.modal-body {
    padding: 20px;
    max-height: 70vh;
    overflow-y: auto;
}

.modal footer {
    padding: 12px 16px;
    text-align: right;
    border-top: 1px solid var(--border-light);
    background-color: var(--gray-light);
}

.modal button {
    padding: 8px 16px;
    border: none;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    margin-left: 8px;
    font-size: 14px;
    transition: all 0.2s ease;
}

    .modal button.primary, .modal button.btn-primary {
        background-color: var(--brand-primary);
        color: var(--bg-white);
    }

    .modal button.primary:hover, .modal button.btn-primary:hover {
        background-color: var(--brand-primary-alt);
        transform: translateY(-1px);
    }

    .modal button.secondary {
        background-color: var(--gray-secondary);
        color: var(--bg-white);
    }

    .modal button.secondary:hover {
        background-color: var(--gray-dark);
    }

/* Import Progress Modal Styles */
.import-progress-modal {
    width: 450px;
    max-width: 90vw;
}

.import-progress-modal .progress-header {
    border-bottom: 1px solid var(--border-light);
    padding-bottom: 1rem;
}

.import-progress-modal .progress {
    background-color: var(--border-light);
    border-radius: 6px;
    overflow: hidden;
    height: 12px;
}

.import-progress-modal .progress-bar {
    background-color: var(--brand-primary) !important;
    transition: width 0.3s ease;
    border: none;
    height: 100%;
    line-height: 12px;
    display: block;
    min-width: 1px; /* Ensure visibility even at 0% */
}

/* Override any Bootstrap color classes */
.import-progress-modal .progress-bar.bg-primary,
.import-progress-modal .progress-bar.bg-info,
.import-progress-modal .progress-bar.bg-warning,
.import-progress-modal .progress-bar.bg-success {
    background-color: var(--brand-primary) !important;
}

.import-progress-modal .alert {
    border-radius: 4px;
    border: none;
}

.import-progress-modal .alert-warning {
    background-color: var(--alert-warning-bg);
    color: var(--alert-warning-text);
}

/* Import Results Modal Styles */
.import-results-modal {
    width: 500px;
    max-width: 90vw;
}

.import-results-modal .row {
    margin: 0;
}

.import-results-modal .col-4 {
    padding: 8px;
}

.import-results-modal .alert {
    border-radius: 4px;
    border: none;
    margin-bottom: 0;
}

.import-results-modal .alert-info {
    background-color: var(--alert-info-bg);
    color: var(--alert-info-text);
}

.import-results-modal .alert-danger {
    background-color: var(--alert-danger-bg);
    color: var(--alert-danger-text);
}

.import-results-modal .collapse-content {
    border-top: 1px solid var(--border-light);
    margin-top: 8px;
    padding-top: 8px;
    animation: slideDown 0.3s ease-out;
}

.import-results-modal .collapse-content.d-none {
    animation: slideUp 0.3s ease-out;
}

/* Custom collapse animations */
@keyframes slideDown {
    from {
        opacity: 0;
        max-height: 0;
        padding-top: 0;
        margin-top: 0;
    }
    to {
        opacity: 1;
        max-height: 200px;
        padding-top: 8px;
        margin-top: 8px;
    }
}

@keyframes slideUp {
    from {
        opacity: 1;
        max-height: 200px;
    }
    to {
        opacity: 0;
        max-height: 0;
    }
}

/* Animation improvements */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-30px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes fadeOut {
    from {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    to {
        opacity: 0;
        transform: translateY(-30px) scale(0.95);
    }
}

/* Progress bar color transitions */
.progress-bar.bg-info {
    background: var(--progress-gradient-info) !important;
}

.progress-bar.bg-warning {
    background: var(--progress-gradient-warning) !important;
}

.progress-bar.bg-primary {
    background: var(--progress-gradient-primary) !important;
}

.progress-bar.bg-success {
    background: var(--progress-gradient-success) !important;
}

/* Badge styling */
.badge {
    font-size: 11px;
    padding: 4px 8px;
    border-radius: 4px;
}

/* Button styling for collapse */
.btn-outline-secondary {
    border-color: var(--gray-secondary);
    color: var(--gray-secondary);
    background: transparent;
    border-radius: var(--border-radius-sm);
    padding: 6px 12px;
    font-size: 13px;
    transition: all 0.2s ease;
}

.btn-outline-secondary:hover {
    background-color: var(--gray-secondary);
    color: var(--bg-white);
    border-color: var(--gray-secondary);
}

/* Text size adjustments */
.import-results-modal .fs-5 {
    font-size: 1.1rem !important;
}

.import-results-modal .text-muted {
    font-size: 11px;
}
