/**
 * BookingSummer — Stili per il sistema di notifiche Toastr personalizzato
 *
 * Animazioni di entrata/uscita, barra di progresso, layout responsivo.
 */

/* Contenitore principale delle notifiche — posizionato in alto a destra */
.toastr-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 99999;
    display: flex;
    flex-direction: column;
    gap: 0.625rem;
    max-width: 400px;
    width: calc(100% - 2rem);
    pointer-events: none;
}

/* Singola notifica */
.toastr-toast {
    pointer-events: auto;
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 1rem 1.125rem;
    border-radius: 0.75rem;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.12),
        0 2px 8px rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.6);
    overflow: hidden;
    cursor: pointer;
    transform: translateX(110%);
    opacity: 0;
    transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1),
                opacity 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}

/* Stato visibile — dopo l'animazione di entrata */
.toastr-toast.toastr-visible {
    transform: translateX(0);
    opacity: 1;
}

/* Stato di uscita — animazione di dissolvenza */
.toastr-toast.toastr-exit {
    transform: translateX(110%);
    opacity: 0;
    transition: transform 0.35s cubic-bezier(0.55, 0, 1, 0.45),
                opacity 0.35s cubic-bezier(0.55, 0, 1, 0.45);
}

/* Striscia laterale colorata a sinistra */
.toastr-toast::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    border-radius: 4px 0 0 4px;
}

/* Colori della striscia per tipo */
.toastr-toast.toastr-success::before { background: #0D9488; }
.toastr-toast.toastr-error::before   { background: #EF4444; }
.toastr-toast.toastr-warning::before { background: #F59E0B; }
.toastr-toast.toastr-info::before    { background: #0066CC; }

/* Icona della notifica */
.toastr-icon {
    flex-shrink: 0;
    width: 1.5rem;
    height: 1.5rem;
    margin-top: 0.125rem;
}

.toastr-success .toastr-icon { color: #0D9488; }
.toastr-error   .toastr-icon { color: #EF4444; }
.toastr-warning .toastr-icon { color: #F59E0B; }
.toastr-info    .toastr-icon { color: #0066CC; }

/* Contenuto testuale */
.toastr-body {
    flex: 1;
    min-width: 0;
}

.toastr-title {
    font-weight: 600;
    font-size: 0.875rem;
    line-height: 1.25;
    margin-bottom: 0.125rem;
    color: #1f2937;
}

.toastr-message {
    font-size: 0.8125rem;
    line-height: 1.4;
    color: #6b7280;
    word-wrap: break-word;
}

/* Pulsante di chiusura */
.toastr-close {
    flex-shrink: 0;
    width: 1.25rem;
    height: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    color: #9ca3af;
    cursor: pointer;
    padding: 0;
    border-radius: 0.25rem;
    transition: color 0.2s, background 0.2s;
    margin-top: 0.125rem;
}

.toastr-close:hover {
    color: #374151;
    background: rgba(0, 0, 0, 0.06);
}

/* Barra di progresso in basso */
.toastr-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    border-radius: 0 0 0 0.75rem;
    width: 100%;
    transform-origin: left;
    animation: toastr-progress-shrink linear forwards;
}

.toastr-success .toastr-progress { background: #0D9488; }
.toastr-error   .toastr-progress { background: #EF4444; }
.toastr-warning .toastr-progress { background: #F59E0B; }
.toastr-info    .toastr-progress { background: #0066CC; }

/* Animazione della barra di progresso — si restringe da destra a sinistra */
@keyframes toastr-progress-shrink {
    from { transform: scaleX(1); }
    to   { transform: scaleX(0); }
}

/* Pausa dell'animazione al hover */
.toastr-toast:hover .toastr-progress {
    animation-play-state: paused;
}

/* ============================================================
   Responsivo — su mobile le notifiche occupano tutta la larghezza
   ============================================================ */
@media (max-width: 480px) {
    .toastr-container {
        top: 0.5rem;
        right: 0.5rem;
        left: 0.5rem;
        max-width: none;
        width: auto;
    }

    .toastr-toast {
        border-radius: 0.625rem;
    }
}

/* ============================================================
   Overlay di caricamento AJAX
   ============================================================ */
.ajax-loading-overlay {
    position: fixed;
    inset: 0;
    z-index: 99998;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    opacity: 0;
    transition: opacity 0.2s ease;
}

.ajax-loading-overlay.active {
    opacity: 1;
}

.ajax-spinner {
    width: 2.5rem;
    height: 2.5rem;
    border: 3px solid #e5e7eb;
    border-top-color: #0066CC;
    border-radius: 50%;
    animation: ajax-spin 0.7s linear infinite;
}

@keyframes ajax-spin {
    to { transform: rotate(360deg); }
}

/* ============================================================
   Modale di conferma personalizzata
   ============================================================ */
.confirm-modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 99997;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    opacity: 0;
    transition: opacity 0.2s ease;
}

.confirm-modal-backdrop.active {
    opacity: 1;
}

.confirm-modal {
    background: white;
    border-radius: 1rem;
    padding: 1.5rem;
    max-width: 400px;
    width: calc(100% - 2rem);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
    transform: scale(0.95);
    transition: transform 0.2s cubic-bezier(0.22, 1, 0.36, 1);
}

.confirm-modal-backdrop.active .confirm-modal {
    transform: scale(1);
}

.confirm-modal-title {
    font-weight: 700;
    font-size: 1.0625rem;
    color: #111827;
    margin-bottom: 0.5rem;
}

.confirm-modal-message {
    font-size: 0.875rem;
    color: #6b7280;
    line-height: 1.5;
    margin-bottom: 1.25rem;
}

.confirm-modal-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
}

.confirm-modal-btn {
    padding: 0.5rem 1.25rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: background 0.15s, transform 0.1s;
}

.confirm-modal-btn:active {
    transform: scale(0.97);
}

.confirm-modal-btn-cancel {
    background: #f3f4f6;
    color: #374151;
}

.confirm-modal-btn-cancel:hover {
    background: #e5e7eb;
}

.confirm-modal-btn-confirm {
    background: #EF4444;
    color: white;
}

.confirm-modal-btn-confirm:hover {
    background: #DC2626;
}
