﻿:root {
    /* Toast Colors */
    --toast-primary: 15, 105, 115;
    --toast-success: 22, 163, 74;
    --toast-danger: 220, 38, 38;
    --toast-warning: 217, 119, 6;
    --toast-info: 59, 130, 246;
    /* Neutrals */
    --toast-white: 255, 255, 255;
    --toast-gray-50: 249, 250, 251;
    --toast-gray-100: 243, 244, 246;
    --toast-gray-200: 229, 231, 235;
    --toast-gray-300: 209, 213, 219;
    --toast-gray-400: 156, 163, 175;
    --toast-gray-500: 107, 114, 128;
    --toast-gray-600: 75, 85, 99;
    --toast-gray-700: 55, 65, 81;
    --toast-gray-800: 31, 41, 55;
    --toast-gray-900: 17, 24, 39;
    /* Spacing */
    --toast-space-1: 0.25rem;
    --toast-space-2: 0.5rem;
    --toast-space-3: 0.75rem;
    --toast-space-4: 1rem;
    --toast-space-5: 1.25rem;
    --toast-space-6: 1.5rem;
    /* Radius */
    --toast-radius-sm: 0.375rem;
    --toast-radius-md: 0.5rem;
    --toast-radius-lg: 0.75rem;
    --toast-radius-xl: 1rem;
    --toast-radius-full: 9999px;
    /* Shadows */
    --toast-shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1);
    --toast-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    --toast-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
    --toast-shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    /* Transitions */
    --toast-transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --toast-transition-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
    --toast-transition-slow: 350ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* ====== TOAST CONTAINER ====== */
.roovia-toast-container {
    position: fixed;
    top: 4.75rem; /* Below 64px topbar + spacing */
    right: 1.5rem;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-width: 420px;
    pointer-events: none;
}

/* ====== TOAST BASE ====== */
.roovia-toast {
    background: rgb(var(--toast-white));
    border-radius: var(--toast-radius-lg);
    box-shadow: var(--toast-shadow-lg), 0 0 0 1px rgba(0, 0, 0, 0.04);
    min-width: 320px;
    max-width: 420px;
    opacity: 0;
    transform: translateX(120%) scale(0.96);
    transition: all var(--toast-transition-base);
    cursor: default;
    position: relative;
    overflow: hidden;
    pointer-events: auto;
    display: flex;
    align-items: flex-start;
    gap: 0.875rem;
    padding: 1rem 1.125rem;
    border-left: 3px solid transparent;
}

    .roovia-toast.show {
        opacity: 1;
        transform: translateX(0) scale(1);
    }

    .roovia-toast:hover {
        transform: translateX(-2px);
        box-shadow: var(--toast-shadow-xl), 0 0 0 1px rgba(0, 0, 0, 0.06);
    }

/* ====== TOAST ICON ====== */
.roovia-toast-icon {
    font-size: 1.125rem;
    flex-shrink: 0;
    width: 1.375rem;
    height: 1.375rem;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 0.0625rem;
}

/* ====== TOAST CONTENT ====== */
.roovia-toast-content {
    flex: 1;
    min-width: 0;
    padding-right: 1.5rem;
}

.roovia-toast-title {
    font-weight: 600;
    font-size: 0.8125rem;
    margin-bottom: 0.1875rem;
    color: rgb(var(--toast-gray-900));
    line-height: 1.3;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    letter-spacing: -0.015em;
}

.roovia-toast-message {
    font-size: 0.75rem;
    color: rgb(var(--toast-gray-600));
    line-height: 1.4;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* ====== TOAST ACTION (CLICKABLE) ====== */
.roovia-toast-action {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    margin-top: 0.375rem;
    font-size: 0.6875rem;
    font-weight: 500;
    color: rgb(var(--toast-primary));
    opacity: 0;
    transition: opacity var(--toast-transition-fast);
}

.roovia-toast:hover .roovia-toast-action {
    opacity: 1;
}

.roovia-toast-action i {
    font-size: 0.625rem;
}

/* ====== CLOSE BUTTON ====== */
.roovia-toast-close {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    width: 1.375rem;
    height: 1.375rem;
    background: transparent;
    border: none;
    color: rgb(var(--toast-gray-400));
    cursor: pointer;
    transition: all var(--toast-transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    opacity: 0;
    padding: 0;
    border-radius: var(--toast-radius-sm);
}

.roovia-toast:hover .roovia-toast-close {
    opacity: 1;
}

.roovia-toast-close:hover {
    background: rgba(0, 0, 0, 0.05);
    color: rgb(var(--toast-gray-700));
    transform: rotate(90deg);
}

.roovia-toast-close:focus-visible {
    opacity: 1;
    outline: 2px solid rgba(var(--toast-primary), 0.2);
    outline-offset: 2px;
}

/* ====== PROGRESS BAR ====== */
.roovia-toast-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: rgba(0, 0, 0, 0.03);
    overflow: hidden;
}

.roovia-toast-progress-bar {
    height: 100%;
    width: 100%;
    transform-origin: left;
    animation: toastProgress linear forwards;
}

@keyframes toastProgress {
    from {
        transform: scaleX(1);
    }

    to {
        transform: scaleX(0);
    }
}

/* ====== TOAST TYPE VARIATIONS ====== */

/* Success Toast */
.roovia-toast-success {
    border-left-color: rgb(var(--toast-success));
}

    .roovia-toast-success .roovia-toast-icon {
        color: rgb(var(--toast-success));
    }

    .roovia-toast-success .roovia-toast-progress-bar {
        background: rgb(var(--toast-success));
    }

    .roovia-toast-success .roovia-toast-action {
        color: rgb(var(--toast-success));
    }

/* Error Toast */
.roovia-toast-error {
    border-left-color: rgb(var(--toast-danger));
}

    .roovia-toast-error .roovia-toast-icon {
        color: rgb(var(--toast-danger));
    }

    .roovia-toast-error .roovia-toast-progress-bar {
        background: rgb(var(--toast-danger));
    }

    .roovia-toast-error .roovia-toast-action {
        color: rgb(var(--toast-danger));
    }

/* Warning Toast */
.roovia-toast-warning {
    border-left-color: rgb(var(--toast-warning));
}

    .roovia-toast-warning .roovia-toast-icon {
        color: rgb(var(--toast-warning));
    }

    .roovia-toast-warning .roovia-toast-progress-bar {
        background: rgb(var(--toast-warning));
    }

    .roovia-toast-warning .roovia-toast-action {
        color: rgb(var(--toast-warning));
    }

/* Info Toast */
.roovia-toast-info {
    border-left-color: rgb(var(--toast-info));
}

    .roovia-toast-info .roovia-toast-icon {
        color: rgb(var(--toast-info));
    }

    .roovia-toast-info .roovia-toast-progress-bar {
        background: rgb(var(--toast-info));
    }

    .roovia-toast-info .roovia-toast-action {
        color: rgb(var(--toast-info));
    }

/* ====== ANIMATIONS ====== */
@keyframes toastSlideIn {
    from {
        transform: translateX(120%) scale(0.96);
        opacity: 0;
    }

    to {
        transform: translateX(0) scale(1);
        opacity: 1;
    }
}

@keyframes toastSlideOut {
    from {
        transform: translateX(0) scale(1);
        opacity: 1;
    }

    to {
        transform: translateX(120%) scale(0.96);
        opacity: 0;
    }
}

.roovia-toast.show {
    animation: toastSlideIn var(--toast-transition-base) forwards;
}

.roovia-toast.dismissing {
    animation: toastSlideOut var(--toast-transition-fast) forwards;
}

/* ====== STACKING ====== */
.roovia-toast-container > .roovia-toast:nth-child(n+2) {
    transform-origin: top center;
}

.roovia-toast-container > .roovia-toast:nth-child(2) {
    z-index: -1;
    pointer-events: none;
    opacity: 0.95;
    transform: scale(0.98) translateY(-8px);
}

.roovia-toast-container > .roovia-toast:nth-child(3) {
    z-index: -2;
    pointer-events: none;
    opacity: 0.9;
    transform: scale(0.96) translateY(-16px);
}

.roovia-toast-container > .roovia-toast:nth-child(n+4) {
    display: none;
}

/* ====== DARK THEME ====== */
[data-theme="atriver-dark"] {
    --toast-white: 28, 28, 32;
    --toast-gray-50: 35, 35, 40;
    --toast-gray-100: 45, 45, 52;
    --toast-gray-200: 55, 55, 64;
    --toast-gray-300: 75, 75, 85;
    --toast-gray-400: 120, 120, 135;
    --toast-gray-500: 156, 163, 175;
    --toast-gray-600: 209, 213, 219;
    --toast-gray-700: 229, 231, 235;
    --toast-gray-800: 243, 244, 246;
    --toast-gray-900: 249, 250, 251;
    --toast-primary: 100, 165, 175;
    --toast-success: 52, 211, 153;
    --toast-danger: 248, 113, 113;
    --toast-warning: 251, 191, 36;
    --toast-info: 96, 165, 250;
}

    [data-theme="atriver-dark"] .roovia-toast {
        background: rgb(28, 28, 32);
        box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.06);
    }

        [data-theme="atriver-dark"] .roovia-toast:hover {
            box-shadow: 0 12px 48px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.08);
        }

    [data-theme="atriver-dark"] .roovia-toast-close:hover {
        background: rgba(255, 255, 255, 0.08);
        color: rgba(255, 255, 255, 0.8);
    }

    [data-theme="atriver-dark"] .roovia-toast-progress {
        background: rgba(255, 255, 255, 0.06);
    }

    /* Dark Theme Type Variations */
    [data-theme="atriver-dark"] .roovia-toast-success {
        border-left-color: rgb(52, 211, 153);
    }

        [data-theme="atriver-dark"] .roovia-toast-success .roovia-toast-icon,
        [data-theme="atriver-dark"] .roovia-toast-success .roovia-toast-action {
            color: rgb(52, 211, 153);
        }

        [data-theme="atriver-dark"] .roovia-toast-success .roovia-toast-progress-bar {
            background: rgb(52, 211, 153);
        }

    [data-theme="atriver-dark"] .roovia-toast-error {
        border-left-color: rgb(248, 113, 113);
    }

        [data-theme="atriver-dark"] .roovia-toast-error .roovia-toast-icon,
        [data-theme="atriver-dark"] .roovia-toast-error .roovia-toast-action {
            color: rgb(248, 113, 113);
        }

        [data-theme="atriver-dark"] .roovia-toast-error .roovia-toast-progress-bar {
            background: rgb(248, 113, 113);
        }

    [data-theme="atriver-dark"] .roovia-toast-warning {
        border-left-color: rgb(251, 191, 36);
    }

        [data-theme="atriver-dark"] .roovia-toast-warning .roovia-toast-icon,
        [data-theme="atriver-dark"] .roovia-toast-warning .roovia-toast-action {
            color: rgb(251, 191, 36);
        }

        [data-theme="atriver-dark"] .roovia-toast-warning .roovia-toast-progress-bar {
            background: rgb(251, 191, 36);
        }

    [data-theme="atriver-dark"] .roovia-toast-info {
        border-left-color: rgb(96, 165, 250);
    }

        [data-theme="atriver-dark"] .roovia-toast-info .roovia-toast-icon,
        [data-theme="atriver-dark"] .roovia-toast-info .roovia-toast-action {
            color: rgb(96, 165, 250);
        }

        [data-theme="atriver-dark"] .roovia-toast-info .roovia-toast-progress-bar {
            background: rgb(96, 165, 250);
        }

/* ====== RESPONSIVE ====== */
@media (max-width: 991px) {
    .roovia-toast-container {
        top: 4.25rem;
    }
}

@media (max-width: 768px) {
    .roovia-toast-container {
        top: 4rem;
        right: 1rem;
        left: 1rem;
        max-width: none;
    }

    .roovia-toast {
        min-width: auto;
        max-width: none;
    }
}

@media (max-width: 576px) {
    .roovia-toast-container {
        top: 3.75rem;
        right: 0.75rem;
        left: 0.75rem;
        gap: 0.5rem;
    }

    .roovia-toast {
        padding: 0.875rem 1rem;
        gap: 0.75rem;
    }

    .roovia-toast-icon {
        font-size: 1rem;
        width: 1.25rem;
        height: 1.25rem;
    }

    .roovia-toast-title {
        font-size: 0.75rem;
    }

    .roovia-toast-message {
        font-size: 0.6875rem;
    }

    .roovia-toast-close {
        top: 0.625rem;
        right: 0.625rem;
        width: 1.25rem;
        height: 1.25rem;
        font-size: 0.6875rem;
    }
}

@media (max-width: 400px) {
    .roovia-toast-container {
        top: 3.5rem;
        right: 0.5rem;
        left: 0.5rem;
    }

    .roovia-toast {
        padding: 0.75rem 0.875rem;
        gap: 0.625rem;
        border-left-width: 2px;
    }
}

/* ====== ACCESSIBILITY ====== */
@media (prefers-reduced-motion: reduce) {
    .roovia-toast,
    .roovia-toast-close,
    .roovia-toast-progress-bar {
        animation: none !important;
        transition: opacity 0.2s ease !important;
    }

        .roovia-toast.show {
            animation: none !important;
            opacity: 1;
            transform: translateX(0) scale(1);
        }

        .roovia-toast:hover {
            transform: translateX(0) scale(1);
        }
}

@media (prefers-contrast: high) {
    .roovia-toast {
        border: 2px solid currentColor;
        border-left-width: 4px;
    }
}

/* ====== PRINT STYLES ====== */
@media print {
    .roovia-toast-container {
        display: none !important;
    }
}

