/**
 * ==========================================
 * RIMBOTOAST CSS - Sistema Unificato Notifiche
 * ==========================================
 *
 * Versione: 1.0.0
 * Data: 23 Ottobre 2025
 *
 * Stili per toast notifications unificate
 * - Desktop: top-right corner
 * - Mobile: bottom-center
 * - Responsive e accessibile
 * - No conflitti con classi esistenti
 * ==========================================
 */

/* ==========================================
   CONTAINER
   ========================================== */

.rimbo-toast-container {
    position: fixed;
    z-index: 999999; /* Sopra tutto */
    pointer-events: none; /* Non blocca click sotto */
    max-width: 420px;
}

/* Desktop: top-right */
.rimbo-toast-container[data-position="top-right"] {
    top: 20px;
    right: 20px;
}

/* Mobile: bottom-center */
.rimbo-toast-container[data-position="bottom-center"] {
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    max-width: calc(100% - 40px);
}

/* ==========================================
   TOAST BASE
   ========================================== */

.rimbo-toast {
    position: relative;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15),
                0 0 0 1px rgba(0, 0, 0, 0.05);
    padding: 16px 20px;
    margin-bottom: 10px;
    min-width: 300px;
    max-width: 100%;
    pointer-events: auto; /* Ripristina click sul toast */
    opacity: 0;
    transform: translateX(100%);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

/* Mobile toast */
.rimbo-toast-mobile {
    min-width: 280px;
    transform: translateY(100%);
    /* translateX rimosso - container già centrato */
}

/* ==========================================
   STATI TOAST
   ========================================== */

/* Toast visibile */
.rimbo-toast-show {
    opacity: 1;
    transform: translateX(0);
}

.rimbo-toast-mobile.rimbo-toast-show {
    transform: translateY(0);
    /* translateX rimosso - container già centrato */
}

/* Toast in uscita */
.rimbo-toast-hide {
    opacity: 0;
    transform: translateX(120%);
}

.rimbo-toast-mobile.rimbo-toast-hide {
    opacity: 0;
    transform: translateY(120%);
    /* translateX rimosso - container già centrato */
}

/* ==========================================
   CONTENUTO TOAST
   ========================================== */

.rimbo-toast-content {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.rimbo-toast-icon {
    font-size: 20px;
    flex-shrink: 0;
    line-height: 1;
    margin-top: 2px;
}

.rimbo-toast-body {
    flex: 1;
    min-width: 0; /* Previene overflow */
}

.rimbo-toast-message {
    font-size: 14px;
    font-weight: 500;
    line-height: 1.5;
    color: #1a1a1a;
    word-wrap: break-word;
}

.rimbo-toast-subtitle {
    font-size: 12px;
    color: #666;
    margin-top: 4px;
    line-height: 1.4;
}

/* ==========================================
   BOTTONE CHIUSURA
   ========================================== */

.rimbo-toast-close {
    position: absolute;
    top: 12px;
    right: 12px;
    background: transparent;
    border: none;
    font-size: 20px;
    line-height: 1;
    color: #999;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.rimbo-toast-close:hover {
    background: rgba(0, 0, 0, 0.05);
    color: #333;
}

.rimbo-toast-close:active {
    transform: scale(0.95);
}

.rimbo-toast-close:focus {
    outline: 2px solid #27ae60;
    outline-offset: 2px;
}

/* ==========================================
   AZIONI TOAST
   ========================================== */

.rimbo-toast-actions {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
}

.rimbo-toast-action-btn {
    background: transparent;
    border: 1px solid currentColor;
    color: inherit;
    padding: 6px 16px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.rimbo-toast-action-btn:hover {
    background: rgba(0, 0, 0, 0.05);
}

.rimbo-toast-action-btn:active {
    transform: scale(0.98);
}

/* ==========================================
   TIPI TOAST - COLORI E STILI
   ========================================== */

/* Success - Verde */
.rimbo-toast-success {
    border-left: 4px solid #27ae60;
}

.rimbo-toast-success .rimbo-toast-icon {
    color: #27ae60;
}

.rimbo-toast-success .rimbo-toast-action-btn {
    color: #27ae60;
}

/* Error - Rosso */
.rimbo-toast-error {
    border-left: 4px solid #e74c3c;
}

.rimbo-toast-error .rimbo-toast-icon {
    color: #e74c3c;
}

.rimbo-toast-error .rimbo-toast-action-btn {
    color: #e74c3c;
}

/* Warning - Arancione */
.rimbo-toast-warning {
    border-left: 4px solid #f39c12;
}

.rimbo-toast-warning .rimbo-toast-icon {
    color: #f39c12;
}

.rimbo-toast-warning .rimbo-toast-action-btn {
    color: #f39c12;
}

/* Info - Blu */
.rimbo-toast-info {
    border-left: 4px solid #3498db;
}

.rimbo-toast-info .rimbo-toast-icon {
    color: #3498db;
}

.rimbo-toast-info .rimbo-toast-action-btn {
    color: #3498db;
}

/* Tip - Viola */
.rimbo-toast-tip {
    border-left: 4px solid #9b59b6;
    background: linear-gradient(135deg, #ffffff 0%, #f8f4ff 100%);
}

.rimbo-toast-tip .rimbo-toast-icon {
    color: #9b59b6;
}

.rimbo-toast-tip .rimbo-toast-action-btn {
    color: #9b59b6;
}

/* ==========================================
   RESPONSIVE - MOBILE
   ========================================== */

@media (max-width: 768px) {
    .rimbo-toast {
        min-width: 280px;
        padding: 14px 16px;
        border-radius: 10px;
        font-size: 13px;
    }

    .rimbo-toast-icon {
        font-size: 18px;
    }

    .rimbo-toast-message {
        font-size: 13px;
    }

    .rimbo-toast-subtitle {
        font-size: 11px;
    }

    .rimbo-toast-close {
        top: 10px;
        right: 10px;
        font-size: 18px;
    }

    .rimbo-toast-action-btn {
        font-size: 12px;
        padding: 5px 12px;
    }
}

/* Small phones */
@media (max-width: 380px) {
    .rimbo-toast {
        min-width: 260px;
        padding: 12px 14px;
    }

    .rimbo-toast-container[data-position="bottom-center"] {
        bottom: 10px;
        max-width: calc(100% - 20px);
    }
}

/* ==========================================
   ANIMAZIONI
   ========================================== */

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(100%);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
    /* translateX rimosso - container già centrato */
}

@keyframes fadeOut {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
    }
}

/* ==========================================
   ACCESSIBILITÀ
   ========================================== */

/* Focus visibile per navigazione tastiera */
.rimbo-toast:focus-within {
    outline: 2px solid #27ae60;
    outline-offset: 2px;
}

/* Riduzione movimento per utenti con preferenze */
@media (prefers-reduced-motion: reduce) {
    .rimbo-toast,
    .rimbo-toast-show,
    .rimbo-toast-hide,
    .rimbo-toast-close,
    .rimbo-toast-action-btn {
        transition: none;
        animation: none;
    }
}

/* Alto contrasto */
@media (prefers-contrast: high) {
    .rimbo-toast {
        border: 2px solid currentColor;
    }

    .rimbo-toast-close:focus {
        outline-width: 3px;
    }
}

/* ==========================================
   DARK MODE SUPPORT (preparazione futura)
   ========================================== */

@media (prefers-color-scheme: dark) {
    .rimbo-toast {
        background: #2c2c2c;
        color: #ffffff;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4),
                    0 0 0 1px rgba(255, 255, 255, 0.1);
    }

    .rimbo-toast-message {
        color: #ffffff;
    }

    .rimbo-toast-subtitle {
        color: #b3b3b3;
    }

    .rimbo-toast-close {
        color: #b3b3b3;
    }

    .rimbo-toast-close:hover {
        background: rgba(255, 255, 255, 0.1);
        color: #ffffff;
    }

    .rimbo-toast-action-btn:hover {
        background: rgba(255, 255, 255, 0.1);
    }

    .rimbo-toast-tip {
        background: linear-gradient(135deg, #2c2c2c 0%, #3a2f47 100%);
    }
}

/* ==========================================
   UTILITIES
   ========================================== */

/* Forza toast sopra modali/dropdown esistenti */
.rimbo-toast-force-top {
    z-index: 9999999 !important;
}

/* Toast con progress bar (preparazione futura) */
.rimbo-toast-with-progress::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    background: currentColor;
    opacity: 0.3;
    animation: shrinkProgress 5s linear forwards;
}

@keyframes shrinkProgress {
    from { width: 100%; }
    to { width: 0%; }
}
