/* ============================================================
   Toast notifications — floating, glass style matching the header.
   Sits at the top corner on the inline-START side, so it flips with the
   page language (Arabic/RTL → right, English/LTR → left) and slides in
   horizontally from that edge. Border accent color reflects the type.
   ============================================================ */

.toast-container {
    position: fixed;
    top: 84px;
    left: 0;
    right: 0;
    margin: 0 auto;
    /* match the header's .container so toasts line up with its edge */
    max-width: 1200px;
    padding: 0 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    align-items: flex-start; /* hug the inline-start edge; RTL → right, LTR → left */
    gap: 12px;
    pointer-events: none;
}

.toast {
    pointer-events: auto;
    width: min(380px, 100%);
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--hd-glass);
    border: 1px solid var(--hd-border);
    /* accent sits on the inline-end edge — next to the close (×) button */
    border-inline-end: 4px solid var(--toast-accent, var(--hd-teal));
    border-radius: 14px;
    padding: 14px 16px;
    color: var(--hd-text);
    box-shadow: var(--hd-shadow);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    font-size: .92rem;
    line-height: 1.45;
    /* slide in from the left edge (LTR default) */
    animation: toastInLtr .34s cubic-bezier(.2, .8, .2, 1);
}

.toast.hide {
    animation: toastOutLtr .26s ease forwards;
}

/* Arabic/RTL: anchored on the right, so slide in FROM the right (right → left) */
html[dir="rtl"] .toast {
    animation-name: toastInRtl;
}

html[dir="rtl"] .toast.hide {
    animation-name: toastOutRtl;
}

.toast .toast-icon {
    font-size: 1.15rem;
    color: var(--toast-accent, var(--hd-teal));
    flex: 0 0 auto;
}

.toast .toast-msg {
    flex: 1;
    word-break: break-word;
}

.toast .toast-close {
    background: none;
    border: none;
    color: var(--hd-dim);
    cursor: pointer;
    font-size: 1.2rem;
    line-height: 1;
    padding: 0 2px;
    flex: 0 0 auto;
    transition: color .2s ease;
}

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

.toast.toast-success { --toast-accent: #10b981; }
.toast.toast-error   { --toast-accent: #ef4444; }
.toast.toast-warning { --toast-accent: #f59e0b; }
.toast.toast-info    { --toast-accent: var(--hd-teal); }

@keyframes toastInLtr {
    from { opacity: 0; transform: translateX(-44px); }
    to   { opacity: 1; transform: translateX(0); }
}

@keyframes toastOutLtr {
    to { opacity: 0; transform: translateX(-44px); }
}

@keyframes toastInRtl {
    from { opacity: 0; transform: translateX(44px); }
    to   { opacity: 1; transform: translateX(0); }
}

@keyframes toastOutRtl {
    to { opacity: 0; transform: translateX(44px); }
}

@media (max-width: 560px) {
    .toast-container {
        top: 74px;
        padding: 0 14px;
    }
    .toast {
        width: 100%;
    }
}
