/**
 * RSite — Notification System  v1.0
 * Depends on: base.css (variables, glass-card)
 *
 * Toast (stacking top-right) + Marquee (center flash).
 * Non-blocking, dismissible, with auto-timeout and progress bar.
 * Two visual modes: information and feedback.
 */

/* 
   TOAST CONTAINER — top right stacking
*/

.rs-toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 99998;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
    max-width: 380px;
    width: calc(100vw - 40px);
}

/* 
   TOAST CARD — matte plastic
*/

.rs-toast {
    pointer-events: auto;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
    font-family: var(--font-body);
    font-size: 0.88em;
    line-height: 1.4;
    color: var(--text-primary);

    /* Matte plastic */
    background: rgba(0, 0, 0, 0.78);
    backdrop-filter: blur(8px) brightness(112%) contrast(88%) saturate(75%);
    -webkit-backdrop-filter: blur(8px) brightness(112%) contrast(88%) saturate(75%);
    border: 0.5px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-md);
    box-shadow:
        0 6px 24px rgba(0, 0, 0, 0.45),
        inset 0 0 3px rgba(255, 255, 255, 0.03);

    /* Clip progress bar to rounded corners */
    overflow: hidden;

    /* Animation */
    opacity: 0;
    transform: translateX(40px);
    animation: toastIn 0.35s var(--ease-out) forwards;
}

.rs-toast.exiting {
    animation: toastOut 0.3s var(--ease-out) forwards;
}

/* ── Toast variants ── */

.rs-toast.success {
    border-left: 3px solid rgba(53, 208, 122, 0.6);
}

.rs-toast.error {
    border-left: 3px solid rgba(232, 84, 84, 0.6);
}

.rs-toast.warning {
    border-left: 3px solid rgba(212, 175, 55, 0.6);
}

.rs-toast.info {
    border-left: 3px solid rgba(100, 140, 220, 0.5);
}

/* ── Toast icon ── */

.rs-toast-icon {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    margin-top: 1px;
}

.rs-toast.success .rs-toast-icon {
    color: var(--success);
}

.rs-toast.error .rs-toast-icon {
    color: var(--error);
}

.rs-toast.warning .rs-toast-icon {
    color: var(--gold-accent);
}

.rs-toast.info .rs-toast-icon {
    color: #6488dc;
}

/* ── Toast body ── */

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

.rs-toast-title {
    font-weight: 600;
    font-size: 0.92em;
    margin-bottom: 2px;
    color: var(--text-primary);
}

.rs-toast-message {
    color: var(--text-secondary);
    font-size: 0.88em;
}

/* ── Toast close ── */

.rs-toast-close {
    flex-shrink: 0;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 2px;
    line-height: 1;
    font-size: 1.1em;
    transition: color var(--duration-fast) ease;
    font-family: var(--font-body);
}

.rs-toast-close:hover {
    color: var(--text-primary);
}

/* ── Toast progress bar (auto-dismiss timer) ── */

.rs-toast-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 2px;
    background: rgba(212, 175, 55, 0.3);
    animation: toastProgress linear forwards;
}

.rs-toast.success .rs-toast-progress {
    background: rgba(53, 208, 122, 0.3);
}

.rs-toast.error .rs-toast-progress {
    background: rgba(232, 84, 84, 0.3);
}

/* 
   MARQUEE — center top flash
*/

.rs-marquee {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 99997;
    padding: 8px 24px;
    font-family: var(--font-body);
    font-size: 0.85em;
    letter-spacing: 0.04em;
    color: var(--gold-accent);
    white-space: nowrap;
    pointer-events: none;

    /* Matte plastic */
    background: rgba(0, 0, 0, 0.82);
    backdrop-filter: blur(10px) brightness(112%) contrast(88%);
    -webkit-backdrop-filter: blur(10px) brightness(112%) contrast(88%);
    border: 0.5px solid rgba(212, 175, 55, 0.2);
    border-radius: var(--radius-full);
    box-shadow:
        0 4px 20px rgba(0, 0, 0, 0.4),
        0 0 12px rgba(212, 175, 55, 0.06);

    /* Animation — text slides in from right */
    opacity: 0;
    animation: marqueeIn 0.3s var(--ease-out) forwards;
}

.rs-marquee.exiting {
    animation: marqueeOut 0.25s var(--ease-out) forwards;
}

/* Marquee inner — overflow clip for text slide effect */
.rs-marquee-text {
    display: inline-block;
    overflow: hidden;
}

.rs-marquee-text span {
    display: inline-block;
    animation: marqueeTextSlide 0.4s var(--ease-out) forwards;
}

/* 
   KEYFRAMES
*/

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateX(40px) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
}

@keyframes toastOut {
    from {
        opacity: 1;
        transform: translateX(0) scale(1);
    }

    to {
        opacity: 0;
        transform: translateX(30px) scale(0.95);
    }
}

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

    to {
        width: 0%;
    }
}

@keyframes marqueeIn {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(-12px) scale(0.96);
    }

    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0) scale(1);
    }
}

@keyframes marqueeOut {
    from {
        opacity: 1;
        transform: translateX(-50%) translateY(0) scale(1);
    }

    to {
        opacity: 0;
        transform: translateX(-50%) translateY(-8px) scale(0.97);
    }
}

@keyframes marqueeTextSlide {
    from {
        transform: translateX(30px);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* 
   RESPONSIVE
*/

@media (max-width: 480px) {
    .rs-toast-container {
        right: 10px;
        top: 10px;
        max-width: calc(100vw - 20px);
    }

    .rs-toast {
        padding: 10px 12px;
        font-size: 0.84em;
    }

    .rs-marquee {
        font-size: 0.8em;
        padding: 6px 18px;
    }
}