/* Loading and Saving Overlay Styles */
/* Blocks all user interactions when displayed */

.loading-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;
    pointer-events: all;
}

.loading-overlay > div {
    background: white;
    padding: 2rem;
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    min-width: 300px;
    text-align: center;
}

.loading-overlay h3 {
    margin: 0 0 1rem 0;
    color: #2c3e50;
}

/* Saving overlay: higher z-index to be above loading overlay */
#saving-overlay {
    z-index: 20000;
}

.progress-bar {
    width: 100%;
    height: 30px;
    background: #ecf0f1;
    border-radius: 15px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.progress-fill {
    height: 100%;
    background: var(--color-accent, #5a6fd8);
    width: 0%;
    transition: width 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
}

.progress-text {
    color: #7f8c8d;
    font-size: 0.9rem;
}

/* Spinner indéterminé : utilisé quand aucune progression réelle n'est
   connue (ex. navigation générique entre pages). Masqué par défaut ;
   affiché uniquement quand .loading-overlay porte la classe .indeterminate,
   qui masque alors la barre de progression déterminée à sa place. */
.spinner {
    display: none;
    width: 40px;
    height: 40px;
    margin: 0 auto 1rem;
    border: 4px solid #ecf0f1;
    border-top-color: var(--color-accent, #5a6fd8);
    border-radius: 50%;
    animation: loading-spinner-rotation 0.8s linear infinite;
}

@keyframes loading-spinner-rotation {
    to {
        transform: rotate(360deg);
    }
}

.loading-overlay.indeterminate .spinner {
    display: block;
}

.loading-overlay.indeterminate .progress-bar,
.loading-overlay.indeterminate .progress-text {
    display: none;
}

/* Responsive styles */
@media (max-width: 768px) {
    .loading-overlay > div {
        width: 90%;
        min-width: auto;
        padding: 1.5rem;
    }
}
