/**
 * Toast Notification Styles
 *
 * Co-located CSS for the toast JS module.
 * Include this file alongside toast.js
 *
 * Uses BEM naming convention with .toast prefix
 * Uses CSS custom properties for theming
 */

/* ============================================
   Custom Properties
   ============================================ */
:root {
    --toast-success: var(--color-success, #059669);
    --toast-error: var(--color-danger, #dc2626);
    --toast-warning: var(--color-warning, #d97706);
    --toast-info: var(--color-primary, #3b82f6);
    --toast-radius: var(--radius, 0.5rem);
    --toast-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* ============================================
   Container
   ============================================ */
.toast-container {
    position: fixed;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    pointer-events: none;
    max-width: calc(100vw - 2rem);
}

/* Position variants */
.toast-container--bottom-right {
    bottom: 1rem;
    right: 1rem;
}

.toast-container--top-right {
    top: 1rem;
    right: 1rem;
}

.toast-container--bottom-left {
    bottom: 1rem;
    left: 1rem;
}

.toast-container--top-left {
    top: 1rem;
    left: 1rem;
}

.toast-container--top-center {
    top: 1rem;
    left: 50%;
    transform: translateX(-50%);
}

.toast-container--bottom-center {
    bottom: 1rem;
    left: 50%;
    transform: translateX(-50%);
}

/* ============================================
   Toast Base
   ============================================ */
.toast {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    border-radius: var(--toast-radius);
    box-shadow: var(--toast-shadow);
    pointer-events: auto;
    min-width: 280px;
    max-width: 400px;

    /* Animation setup */
    opacity: 0;
    transform: translateX(100%);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

/* Visible state */
.toast--visible {
    opacity: 1;
    transform: translateX(0);
}

/* Hiding state */
.toast--hiding {
    opacity: 0;
    transform: translateX(100%);
}

/* Left-side container animations */
.toast-container--bottom-left .toast,
.toast-container--top-left .toast {
    transform: translateX(-100%);
}

.toast-container--bottom-left .toast--visible,
.toast-container--top-left .toast--visible {
    transform: translateX(0);
}

.toast-container--bottom-left .toast--hiding,
.toast-container--top-left .toast--hiding {
    transform: translateX(-100%);
}

/* Center container animations */
.toast-container--top-center .toast,
.toast-container--bottom-center .toast {
    transform: translateY(-100%) scale(0.95);
}

.toast-container--top-center .toast--visible,
.toast-container--bottom-center .toast--visible {
    transform: translateY(0) scale(1);
}

.toast-container--top-center .toast--hiding,
.toast-container--bottom-center .toast--hiding {
    transform: translateY(-100%) scale(0.95);
}

/* ============================================
   Toast Variants
   ============================================ */
.toast--success {
    background: var(--toast-success);
    color: white;
}

.toast--error {
    background: var(--toast-error);
    color: white;
}

.toast--warning {
    background: var(--toast-warning);
    color: white;
}

.toast--info {
    background: var(--toast-info);
    color: white;
}

/* ============================================
   Toast Parts
   ============================================ */
.toast__icon {
    flex-shrink: 0;
    width: 1.25rem;
    height: 1.25rem;
}

.toast__icon svg {
    width: 100%;
    height: 100%;
}

.toast__message {
    flex: 1;
    font-size: 0.875rem;
    font-weight: 500;
    line-height: 1.4;
}

.toast__close {
    flex-shrink: 0;
    width: 1.5rem;
    height: 1.5rem;
    padding: 0.25rem;
    background: none;
    border: none;
    color: inherit;
    cursor: pointer;
    opacity: 0.7;
    border-radius: 0.25rem;
    transition: opacity 0.15s ease, background 0.15s ease;
}

.toast__close:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.1);
}

.toast__close svg {
    width: 100%;
    height: 100%;
}

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 480px) {
    .toast-container {
        left: 1rem;
        right: 1rem;
        max-width: none;
    }

    .toast-container--bottom-right,
    .toast-container--bottom-left,
    .toast-container--bottom-center {
        bottom: 1rem;
    }

    .toast-container--top-right,
    .toast-container--top-left,
    .toast-container--top-center {
        top: 1rem;
    }

    .toast {
        min-width: auto;
        max-width: none;
        width: 100%;
    }

    /* Mobile: slide up from bottom */
    .toast-container--bottom-right .toast,
    .toast-container--bottom-left .toast,
    .toast-container--bottom-center .toast {
        transform: translateY(100%);
    }

    .toast-container--bottom-right .toast--visible,
    .toast-container--bottom-left .toast--visible,
    .toast-container--bottom-center .toast--visible {
        transform: translateY(0);
    }

    .toast-container--bottom-right .toast--hiding,
    .toast-container--bottom-left .toast--hiding,
    .toast-container--bottom-center .toast--hiding {
        transform: translateY(100%);
    }
}

/* ============================================
   Accessibility
   ============================================ */
@media (prefers-reduced-motion: reduce) {
    .toast {
        transition: opacity 0.15s ease;
        transform: none !important;
    }

    .toast--visible {
        transform: none !important;
    }

    .toast--hiding {
        transform: none !important;
    }
}
