/* ============================================
   TOAST SYSTEM - CryptoCall V24
   Style hybride : Glass + Rich structure
   ============================================ */

/* ----------------
   CONTAINER
   ---------------- */
#toast-container {
    position: fixed;
    z-index: 9999;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    width: 100%;
    max-width: 420px;
    padding: 16px;
    /* Position: top-center */
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
}

/* ----------------
   TOAST BASE
   ---------------- */
.toast {
    pointer-events: auto;
    background: rgba(17, 24, 39, 0.92);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-radius: var(--radius-md, 12px);
    padding: 14px 16px 14px 20px; /* Plus de padding à gauche pour l'accent bar */
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.08);
    position: relative;
    overflow: hidden;
    width: 100%;
    max-width: 380px;
    animation: toastInUp 0.4s cubic-bezier(0.21, 1.02, 0.73, 1) forwards;
}

.toast.removing {
    animation: toastOutDown 0.3s cubic-bezier(0.21, 1.02, 0.73, 1) forwards;
}

/* ----------------
   ANIMATIONS
   ---------------- */
@keyframes toastInUp {
    from {
        opacity: 0;
        transform: translateY(16px) scale(0.96);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes toastOutDown {
    from {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    to {
        opacity: 0;
        transform: translateY(8px) scale(0.96);
    }
}

/* ----------------
   ACCENT BAR (gauche)
   ---------------- */
.toast::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
}

.toast.success::before { background: var(--success-color, #10b981); }
.toast.error::before { background: var(--error-color, #ef4444); }
.toast.warning::before { background: var(--warning-color, #f59e0b); }
.toast.info::before { background: var(--info-color, #00d4ff); }

/* ----------------
   ICÔNE
   ---------------- */
.toast-icon {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 13px;
    font-weight: 600;
}

.toast.success .toast-icon {
    background: var(--success-color, #10b981);
    color: white;
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.3);
}

.toast.error .toast-icon {
    background: var(--error-color, #ef4444);
    color: white;
    box-shadow: 0 0 20px rgba(239, 68, 68, 0.3);
}

.toast.warning .toast-icon {
    background: var(--warning-color, #f59e0b);
    color: white;
    box-shadow: 0 0 20px rgba(245, 158, 11, 0.3);
}

.toast.info .toast-icon {
    background: var(--info-color, #00d4ff);
    color: var(--background, #0a0e17);
    box-shadow: 0 0 20px rgba(0, 212, 255, 0.3);
}

/* ----------------
   CONTENU
   ---------------- */
.toast-content {
    flex: 1 1 auto;
    min-width: 0;
    padding-top: 2px;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.toast-title {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 2px;
    color: var(--white, #ffffff);
    line-height: 1.4;
    word-wrap: break-word;
}

.toast-message {
    font-size: 13px;
    color: var(--text-secondary, #9ca3af);
    line-height: 1.4;
    word-wrap: break-word;
}

/* Si pas de message, centrer verticalement le titre */
.toast-content.no-message {
    display: flex;
    align-items: center;
}

.toast-content.no-message .toast-title {
    margin-bottom: 0;
}

/* ----------------
   BOUTON FERMER
   ---------------- */
.toast-close {
    flex-shrink: 0;
    background: none;
    border: none;
    color: var(--gray-medium, #9ca3af);
    cursor: pointer;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all 0.2s;
    font-size: 20px;
    line-height: 1;
    opacity: 0.6;
    margin-left: auto;
}

.toast-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-color, #ffffff);
    opacity: 1;
}

/* ----------------
   BARRE DE PROGRESSION
   ---------------- */
.toast-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: rgba(255, 255, 255, 0.1);
    overflow: hidden;
}

.toast-progress-bar {
    height: 100%;
    animation: toastProgressShrink linear forwards;
}

.toast.success .toast-progress-bar { background: var(--success-color, #10b981); }
.toast.error .toast-progress-bar { background: var(--error-color, #ef4444); }
.toast.warning .toast-progress-bar { background: var(--warning-color, #f59e0b); }
.toast.info .toast-progress-bar { background: var(--info-color, #00d4ff); }

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

/* ----------------
   RESPONSIVE
   ---------------- */
@media (max-width: 480px) {
    #toast-container {
        max-width: none;
        width: 100%;
        padding: 12px;
        bottom: 70px;
    }

    .toast {
        min-width: 0;
        width: 100%;
    }
    
    .toast-title {
        font-size: 13px;
    }
    
    .toast-message {
        font-size: 12px;
    }
}

/* ----------------
   QUAND PAS DE BOTTOM NAV (landing, etc.)
   ---------------- */
body.no-nav #toast-container {
    bottom: 20px;
}
