/**
 * Toast Notification Styles
 *
 * Standalone CSS for toast notifications
 * Mobile-first responsive design
 *
 * @package WC_Nha_Hang_Viet
 * @since 1.2.0
 */

/* ==========================================================================
   CSS Variables
   ========================================================================== */

:root {
    /* Toast colors */
    --toast-success-bg: #82B300;
    --toast-success-text: #fff;
    --toast-error-bg: #dc3545;
    --toast-error-text: #fff;
    --toast-warning-bg: #ffc107;
    --toast-warning-text: #212529;
    --toast-info-bg: #17a2b8;
    --toast-info-text: #fff;
    --toast-cart-bg: #FF8533;
    --toast-cart-text: #fff;

    /* Toast dimensions */
    --toast-padding-x: 16px;
    --toast-padding-y: 12px;
    --toast-border-radius: 12px;
    --toast-min-width: 280px;
    --toast-max-width: 400px;
    --toast-gap: 10px;

    /* Toast animation */
    --toast-duration: 300ms;
    --toast-ease: cubic-bezier(0.33, 1, 0.68, 1);

    /* Toast z-index */
    --toast-z-index: 999999;
}


/* ==========================================================================
   Toast Container
   ========================================================================== */

.wc-nhv-toast-container {
    position: fixed;
    left: 50%;
    transform: translateX(-50%);
    z-index: var(--toast-z-index);
    display: flex;
    flex-direction: column;
    gap: var(--toast-gap);
    pointer-events: none;
    max-width: calc(100vw - 20px);
}

/* Top position (desktop default) */
.wc-nhv-toast-container--top {
    top: 20px;
}

/* Bottom position (mobile default) */
.wc-nhv-toast-container--bottom {
    bottom: 80px; /* Above floating cart button */
    flex-direction: column-reverse;
}


/* ==========================================================================
   Toast Base
   ========================================================================== */

.wc-nhv-toast {
    display: flex;
    align-items: center;
    min-width: var(--toast-min-width);
    max-width: var(--toast-max-width);
    padding: var(--toast-padding-y) var(--toast-padding-x);
    border-radius: var(--toast-border-radius);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
    pointer-events: auto;
    position: relative;
    overflow: hidden;

    /* Animation - initial state */
    opacity: 0;
    transform: translateY(-20px) scale(0.95);
    transition: all var(--toast-duration) var(--toast-ease);
}

/* Visible state */
.wc-nhv-toast.is-visible {
    opacity: 1;
    transform: translateY(0) scale(1);
}

/* Hiding state */
.wc-nhv-toast.is-hiding {
    opacity: 0;
    transform: translateY(-20px) scale(0.95);
}

/* Bottom position animations */
.wc-nhv-toast-container--bottom .wc-nhv-toast {
    transform: translateY(20px) scale(0.95);
}

.wc-nhv-toast-container--bottom .wc-nhv-toast.is-visible {
    transform: translateY(0) scale(1);
}

.wc-nhv-toast-container--bottom .wc-nhv-toast.is-hiding {
    transform: translateY(20px) scale(0.95);
}


/* ==========================================================================
   Toast Content
   ========================================================================== */

.wc-nhv-toast__content {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
}

.wc-nhv-toast__icon {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
}

.wc-nhv-toast__icon svg {
    width: 20px;
    height: 20px;
}

.wc-nhv-toast__message {
    font-size: 14px;
    font-weight: 500;
    line-height: 1.4;
}


/* ==========================================================================
   Toast Close Button
   ========================================================================== */

.wc-nhv-toast__close {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    margin-left: 8px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    color: inherit;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    transition: background 0.15s ease;
}

.wc-nhv-toast__close:hover {
    background: rgba(255, 255, 255, 0.3);
}

.wc-nhv-toast__close:focus {
    outline: 2px solid rgba(255, 255, 255, 0.5);
    outline-offset: 2px;
}


/* ==========================================================================
   Toast Progress Bar
   ========================================================================== */

.wc-nhv-toast__progress {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: rgba(255, 255, 255, 0.3);
    transform-origin: left;
    animation: toast-progress linear forwards;
}

@keyframes toast-progress {
    from {
        transform: scaleX(1);
    }
    to {
        transform: scaleX(0);
    }
}


/* ==========================================================================
   Toast Types
   ========================================================================== */

/* Success */
.wc-nhv-toast--success {
    background: var(--toast-success-bg);
    color: var(--toast-success-text);
}

/* Error */
.wc-nhv-toast--error {
    background: var(--toast-error-bg);
    color: var(--toast-error-text);
}

/* Warning */
.wc-nhv-toast--warning {
    background: var(--toast-warning-bg);
    color: var(--toast-warning-text);
}

.wc-nhv-toast--warning .wc-nhv-toast__close {
    background: rgba(0, 0, 0, 0.1);
}

.wc-nhv-toast--warning .wc-nhv-toast__close:hover {
    background: rgba(0, 0, 0, 0.2);
}

/* Info */
.wc-nhv-toast--info {
    background: var(--toast-info-bg);
    color: var(--toast-info-text);
}

/* Cart (primary orange) */
.wc-nhv-toast--cart {
    background: var(--toast-cart-bg);
    color: var(--toast-cart-text);
}


/* ==========================================================================
   Responsive Adjustments
   ========================================================================== */

@media (max-width: 480px) {
    :root {
        --toast-min-width: 260px;
        --toast-max-width: calc(100vw - 40px);
        --toast-padding-x: 14px;
        --toast-padding-y: 10px;
    }

    .wc-nhv-toast__message {
        font-size: 13px;
    }
}


/* ==========================================================================
   Reduced Motion
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
    .wc-nhv-toast {
        transition: opacity var(--toast-duration) ease;
        transform: none !important;
    }

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

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

    .wc-nhv-toast__progress {
        animation: none;
    }
}


/* ==========================================================================
   Dark Mode Support
   ========================================================================== */

@media (prefers-color-scheme: dark) {
    .wc-nhv-toast {
        box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    }
}
