/* Modal Alert System */
.alert-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.alert-modal-overlay.show {
    opacity: 1;
    visibility: visible;
}

.alert-modal {
    background: var(--bg-color, #fff);
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    max-width: 400px;
    width: 90%;
    max-height: 80vh;
    overflow: hidden;
    transform: scale(0.9) translateY(-20px);
    transition: transform 0.3s ease;
}

.alert-modal-overlay.show .alert-modal {
    transform: scale(1) translateY(0);
}

.alert-modal-header {
    padding: 20px 20px 0 20px;
    border-bottom: 1px solid var(--border-color, #e0e0e0);
}

.alert-modal-title {
    margin: 0 0 16px 0;
    font-size: 18px;
    font-weight: 600;
    color: var(--text-color, #333);
    display: flex;
    align-items: center;
    gap: 10px;
}

.alert-modal-icon {
    font-size: 20px;
}

.alert-modal-icon.warning {
    color: #ff9800;
}

.alert-modal-icon.error {
    color: #f44336;
}

.alert-modal-icon.info {
    color: #2196f3;
}

.alert-modal-icon.success {
    color: #4caf50;
}

.alert-modal-body {
    padding: 20px;
    color: var(--text-color, #666);
    line-height: 1.5;
}

.alert-modal-footer {
    padding: 0 20px 20px 20px;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.alert-modal-button {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
    min-width: 80px;
}

.alert-modal-button:focus {
    outline: none;
    box-shadow: none;
}

.alert-modal-button.primary {
    background: var(--primary-color, #007bff);
    color: white;
}

.alert-modal-button.primary:hover {
    background: var(--primary-color-dark, #0056b3);
}

.alert-modal-button.secondary {
    background: var(--secondary-color, #6c757d);
    color: white;
}

.alert-modal-button.secondary:hover {
    background: var(--secondary-color-dark, #545b62);
}

/* Dark mode support */
html[data-theme='dark'] .alert-modal,
.dark-mode .alert-modal {
    background: var(--bg-color-dark, #2d3748);
    color: var(--text-color-dark, #e2e8f0);
}

html[data-theme='dark'] .alert-modal-header,
.dark-mode .alert-modal-header {
    border-color: var(--border-color-dark, #4a5568);
}

html[data-theme='dark'] .alert-modal-title,
.dark-mode .alert-modal-title {
    color: var(--text-color-dark, #e2e8f0);
}

html[data-theme='dark'] .alert-modal-body,
.dark-mode .alert-modal-body {
    color: var(--text-color-dark, #cbd5e0);
}

html[data-theme='dark'] .alert-modal-button,
.dark-mode .alert-modal-button {
    background-color: #333333;
    color: #e0e0e0;
    border-color: #404040;
}

html[data-theme='dark'] .alert-modal-button:hover,
.dark-mode .alert-modal-button:hover {
    background-color: #333;
}

html[data-theme='dark'] .alert-modal-button.primary,
.dark-mode .alert-modal-button.primary {
    background-color: #1e3a5f;
    color: white;
}

html[data-theme='dark'] .alert-modal-button.primary:hover,
.dark-mode .alert-modal-button.primary:hover {
    background-color: #2a4a7f;
}

/* Responsive */
@media (max-width: 480px) {
    .alert-modal {
        margin: 20px;
        width: calc(100% - 40px);
    }

    .alert-modal-footer {
        flex-direction: column;
    }

    .alert-modal-button {
        width: 100%;
    }
}

/* Loading Spinner Modal */
.spinner-modal {
    text-align: center;
}

.spinner-overlay {
    pointer-events: none;
    /* Prevent interaction with background */
}

/* Base animation for indeterminate progress bars */
@keyframes indeterminate-progress {
    0% { left: -30%; width: 30%; }
    50% { left: 40%; width: 60%; }
    100% { left: 100%; width: 30%; }
}

/* Progress Bar Modal */
.progress-modal {
    text-align: center;
}

.progress-container {
    width: 100%;
    height: 12px;
    background: var(--border-color, #e0e0e0);
    border-radius: 6px;
    overflow: hidden;
    margin: 15px 0;
    position: relative;
}

.progress-bar-inner {
    height: 100%;
    background: var(--primary-color, #007bff);
    width: 0%;
    position: absolute;
    left: 0;
    transition: width 0.3s ease;
}

html[data-theme='dark'] .progress-container,
.dark-mode .progress-container {
    background: var(--border-color-dark, #4a5568);
}

.spinner-icon {
    display: flex;
    align-items: center;
    justify-content: center;
}

.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-color, #e0e0e0);
    border-top: 2px solid var(--primary-color, #007bff);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Dark mode spinner */
html[data-theme='dark'] .spinner,
.dark-mode .spinner {
    border-color: var(--border-color-dark, #4a5568);
    border-top-color: var(--primary-color, #007bff);
}