/**
 * ═══════════════════════════════════════════════════════════════════════════
 * TOAST NOTIFICATIONS
 *
 * Toast/Snackbar notification system for sadec-marketing-hub
 * Supports: success, error, warning, info types
 *
 * @version 1.0.0 | 2026-03-14
 * @module toast-notifications
 * ═══════════════════════════════════════════════════════════════════════════
 */

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

.toast-container {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-width: 420px;
    pointer-events: none;
}

.toast-container.toast-container--bottom {
    top: auto;
    bottom: 24px;
}

.toast-container.toast-container--left {
    right: auto;
    left: 24px;
}

.toast-container.toast-container--center {
    left: 50%;
    transform: translateX(-50%);
    max-width: 420px;
}

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

.toast {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px;
    background: var(--md-sys-color-surface);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.16);
    border: 1px solid var(--md-sys-color-outline-variant);
    pointer-events: auto;
    animation: toastSlideIn 0.3s ease-out forwards;
    min-width: 280px;
    max-width: 420px;
    position: relative;
    overflow: hidden;
}

.toast--exiting {
    animation: toastSlideOut 0.3s ease-in forwards;
}

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

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

/* ============================================================================
   TOAST ICON
   ============================================================================ */

.toast-icon {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.toast-icon .material-symbols-outlined {
    font-size: 16px;
}

/* ============================================================================
   TOAST TYPES
   ============================================================================ */

/* Success */
.toast--success {
    border-color: var(--md-sys-color-primary);
}

.toast--success .toast-icon {
    background: var(--md-sys-color-primary-container);
    color: var(--md-sys-color-primary);
}

.toast--success::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--md-sys-color-primary);
}

/* Error */
.toast--error {
    border-color: var(--md-sys-color-error);
}

.toast--error .toast-icon {
    background: var(--md-sys-color-error-container);
    color: var(--md-sys-color-error);
}

.toast--error::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--md-sys-color-error);
}

/* Warning */
.toast--warning {
    border-color: var(--md-sys-color-secondary);
}

.toast--warning .toast-icon {
    background: var(--md-sys-color-secondary-container);
    color: var(--md-sys-color-secondary);
}

.toast--warning::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--md-sys-color-secondary);
}

/* Info */
.toast--info {
    border-color: var(--md-sys-color-tertiary);
}

.toast--info .toast-icon {
    background: var(--md-sys-color-tertiary-container);
    color: var(--md-sys-color-tertiary);
}

.toast--info::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--md-sys-color-tertiary);
}

/* ============================================================================
   TOAST CONTENT
   ============================================================================ */

.toast-content {
    flex: 1;
    min-width: 0;
}

.toast-title {
    font: var(--md-sys-typescale-title-small);
    color: var(--md-sys-color-on-surface);
    margin-bottom: 4px;
    font-weight: 600;
}

.toast-message {
    font: var(--md-sys-typescale-body-small);
    color: var(--md-sys-color-on-surface-variant);
    line-height: 1.5;
}

/* ============================================================================
   TOAST ACTIONS
   ============================================================================ */

.toast-actions {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

.toast-action-btn {
    padding: 6px 12px;
    border-radius: 8px;
    font: var(--md-sys-typescale-label-small);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
}

.toast-action-btn--primary {
    background: var(--md-sys-color-primary);
    color: var(--md-sys-color-on-primary);
}

.toast-action-btn--primary:hover {
    filter: brightness(1.1);
}

.toast-action-btn--secondary {
    background: transparent;
    color: var(--md-sys-color-primary);
    border: 1px solid var(--md-sys-color-primary);
}

.toast-action-btn--secondary:hover {
    background: var(--md-sys-color-primary-container);
}

/* ============================================================================
   TOAST CLOSE BUTTON
   ============================================================================ */

.toast-close {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--md-sys-color-on-surface-variant);
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.toast-close:hover {
    background: var(--md-sys-color-surface-container);
    color: var(--md-sys-color-on-surface);
}

.toast-close .material-symbols-outlined {
    font-size: 18px;
}

/* ============================================================================
   TOAST PROGRESS BAR
   ============================================================================ */

.toast-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--md-sys-color-surface-container);
    overflow: hidden;
}

.toast-progress__bar {
    height: 100%;
    background: var(--md-sys-color-primary);
    width: 100%;
    transform-origin: left;
}

.toast--success .toast-progress__bar {
    background: var(--md-sys-color-primary);
}

.toast--error .toast-progress__bar {
    background: var(--md-sys-color-error);
}

.toast--warning .toast-progress__bar {
    background: var(--md-sys-color-secondary);
}

.toast--info .toast-progress__bar {
    background: var(--md-sys-color-tertiary);
}

.toast-progress__bar--animating {
    animation: toastProgress linear forwards;
}

@keyframes toastProgress {
    from {
        transform: scaleX(1);
    }
    to {
        transform: scaleX(0);
    }
}

/* ============================================================================
   RESPONSIVE
   ============================================================================ */

/* Tablet and below (1024px) */
@media (max-width: 1024px) {
    .toast-container {
        top: 16px;
        right: 16px;
        max-width: 360px;
    }
}

/* Mobile and below (768px) */
@media (max-width: 768px) {
    .toast-container {
        top: auto;
        bottom: 80px;
        right: 16px;
        left: 16px;
        max-width: none;
    }

    .toast {
        min-width: auto;
        max-width: none;
        padding: 14px 12px;
        gap: 10px;
    }

    .toast-icon {
        width: 20px;
        height: 20px;
    }

    .toast-icon .material-symbols-outlined {
        font-size: 14px;
    }

    .toast-title {
        font-size: 14px;
    }

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

    .toast-close {
        width: 20px;
        height: 20px;
    }

    .toast-close .material-symbols-outlined {
        font-size: 16px;
    }

    .toast-actions {
        flex-wrap: wrap;
    }

    .toast-action-btn {
        padding: 6px 10px;
        font-size: 12px;
        min-height: 36px;
    }
}

/* Mobile Small (375px) */
@media (max-width: 375px) {
    .toast-container {
        bottom: 70px;
        right: 12px;
        left: 12px;
    }

    .toast {
        padding: 12px 10px;
        border-radius: 10px;
    }

    .toast-title {
        font-size: 13px;
    }

    .toast-message {
        font-size: 12px;
    }

    .toast-action-btn {
        padding: 5px 8px;
        font-size: 11px;
    }
}

/* ============================================================================
   REDUCED MOTION
   ============================================================================ */

@media (prefers-reduced-motion: reduce) {
    .toast,
    .toast--exiting {
        animation: none;
    }

    .toast-progress__bar--animating {
        animation: none;
        transition: width linear;
    }
}
