/**
 * Franchify - Toast Notifications System
 * Modern toast notifications in bottom-right corner
 * Author: Tony GOMEZ - https://www.tonygomez.net
 */

/* ========================================
   TOAST CONTAINER
   ======================================== */
.franchify-toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 999999;
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-width: 400px;
    pointer-events: none;
}

/* ========================================
   TOAST NOTIFICATION
   ======================================== */
.franchify-toast {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px 20px;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 
        0 10px 40px rgba(0, 0, 0, 0.12),
        0 4px 12px rgba(0, 0, 0, 0.08);
    border-left: 4px solid var(--toast-color, #3b82f6);
    pointer-events: all;
    animation: toastSlideIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    transform-origin: right center;
    overflow: hidden;
    position: relative;
}

.franchify-toast.exiting {
    animation: toastSlideOut 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* ========================================
   TOAST ANIMATIONS
   ======================================== */
@keyframes toastSlideIn {
    0% {
        opacity: 0;
        transform: translateX(100%) scale(0.9);
    }
    100% {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
}

@keyframes toastSlideOut {
    0% {
        opacity: 1;
        transform: translateX(0) scale(1);
        max-height: 200px;
        margin-bottom: 0;
    }
    100% {
        opacity: 0;
        transform: translateX(100%) scale(0.9);
        max-height: 0;
        margin-bottom: -12px;
        padding: 0;
    }
}

/* ========================================
   TOAST ICON
   ======================================== */
.franchify-toast-icon {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
    background: var(--toast-bg, rgba(59, 130, 246, 0.1));
    color: var(--toast-color, #3b82f6);
}

/* ========================================
   TOAST CONTENT
   ======================================== */
.franchify-toast-content {
    flex: 1;
    min-width: 0;
}

.franchify-toast-title {
    font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 14px;
    font-weight: 600;
    color: #1e293b;
    margin: 0 0 2px 0;
    line-height: 1.4;
}

.franchify-toast-message {
    font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 13px;
    color: #64748b;
    margin: 0;
    line-height: 1.5;
    word-wrap: break-word;
}

/* Toast sans titre */
.franchify-toast-content:not(:has(.franchify-toast-title)) .franchify-toast-message,
.franchify-toast-message:only-child {
    color: #1e293b;
    font-weight: 500;
}

/* ========================================
   TOAST CLOSE BUTTON
   ======================================== */
.franchify-toast-close {
    width: 24px;
    height: 24px;
    border: none;
    background: transparent;
    color: #94a3b8;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all 0.15s ease;
    flex-shrink: 0;
    font-size: 16px;
    line-height: 1;
    padding: 0;
    margin: -4px -8px -4px 0;
}

.franchify-toast-close:hover {
    background: #f1f5f9;
    color: #475569;
}

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

/* ========================================
   TOAST PROGRESS BAR
   ======================================== */
.franchify-toast-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    background: var(--toast-color, #3b82f6);
    opacity: 0.3;
    animation: toastProgress var(--toast-duration, 10s) linear forwards;
    transform-origin: left;
}

@keyframes toastProgress {
    0% {
        width: 100%;
    }
    100% {
        width: 0%;
    }
}

/* Pause on hover */
.franchify-toast:hover .franchify-toast-progress {
    animation-play-state: paused;
}

/* ========================================
   TOAST TYPES - SUCCESS
   ======================================== */
.franchify-toast.success {
    --toast-color: #10b981;
    --toast-bg: rgba(16, 185, 129, 0.1);
}

/* ========================================
   TOAST TYPES - ERROR
   ======================================== */
.franchify-toast.error {
    --toast-color: #ef4444;
    --toast-bg: rgba(239, 68, 68, 0.1);
}

/* ========================================
   TOAST TYPES - WARNING
   ======================================== */
.franchify-toast.warning {
    --toast-color: #f59e0b;
    --toast-bg: rgba(245, 158, 11, 0.1);
}

/* ========================================
   TOAST TYPES - INFO
   ======================================== */
.franchify-toast.info {
    --toast-color: #3b82f6;
    --toast-bg: rgba(59, 130, 246, 0.1);
}

/* ========================================
   RESPONSIVE DESIGN
   ======================================== */
@media (max-width: 480px) {
    .franchify-toast-container {
        left: 16px;
        right: 16px;
        bottom: 16px;
        max-width: none;
    }
    
    .franchify-toast {
        padding: 14px 16px;
    }
}

/* ========================================
   DARK MODE SUPPORT (optional)
   ======================================== */
@media (prefers-color-scheme: dark) {
    .franchify-toast {
        background: #1e293b;
    }
    
    .franchify-toast-title {
        color: #f1f5f9;
    }
    
    .franchify-toast-message {
        color: #94a3b8;
    }
    
    .franchify-toast-message:only-child {
        color: #f1f5f9;
    }
    
    .franchify-toast-close:hover {
        background: #334155;
        color: #e2e8f0;
    }
}

/* Si on ne veut pas le dark mode automatique, commenter le bloc ci-dessus */
