/* Simple Toast Component (Dark Glass Theme) - Optimized positioning and options */

/* Base container */
.toast-container {
    position: fixed;
    z-index: var(--toast-z, 2147483646);
    pointer-events: none;
    display: flex;
    gap: 10px; /* will be overridden by JS with options.gap */
}

/* Flow (top vs bottom) */
.toast-container[data-pos^="top"] {
    flex-direction: column;
}
.toast-container[data-pos^="bottom"] {
    flex-direction: column-reverse;
}

/* Exact positions (avoid left/right conflicts) */
.toast-container[data-pos="top-center"] {
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
}
.toast-container[data-pos="bottom-center"] {
    bottom: 25px;
    left: 50%;
    transform: translateX(-50%);
}
.toast-container[data-pos="top-left"] {
    top: 20px;
    left: 20px;
    align-items: flex-start;
}
.toast-container[data-pos="top-right"] {
    top: 20px;
    right: 20px;
    align-items: flex-end;
}
.toast-container[data-pos="bottom-left"] {
    bottom: 25px;
    left: 20px;
    align-items: flex-start;
}
.toast-container[data-pos="bottom-right"] {
    bottom: 25px;
    right: 20px;
    align-items: flex-end;
}

/* Single toast */
.toast-item {
    position: relative;
    min-width: 180px;
    max-width: 320px;
    padding: 12px 16px 12px 46px;
    border-radius: 16px;
    font-size: 13.5px;
    line-height: 1.4;
    letter-spacing: .3px;
    font-weight: 500;
    color: #f4f6fa;
    background:
            linear-gradient(145deg, rgba(26,26,30,.82), rgba(18,18,22,.82)),
            linear-gradient(30deg, rgba(255,255,255,.05), rgba(255,255,255,0) 55%);
    backdrop-filter: blur(16px) saturate(160%);
    -webkit-backdrop-filter: blur(16px) saturate(160%);
    border: 1px solid rgba(255,255,255,.12);
    box-shadow: 0 10px 30px -12px rgba(0,0,0,.75), 0 4px 12px -6px rgba(0,0,0,.55);
    overflow: hidden;
    transform: translateY(8px) scale(.96);
    opacity: 0;
    pointer-events: all;
    cursor: default;
    user-select: none;
    will-change: transform, opacity, filter;
    animation: toast-in .42s cubic-bezier(.34,1.56,.64,1) forwards;
}

/* Optional scrollable content */
.toast-item.scrollable {
    max-height: 180px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #3a414c transparent;
}
.toast-item.scrollable::-webkit-scrollbar { width: 8px; }
.toast-item.scrollable::-webkit-scrollbar-thumb {
    background:#3a414c;
    border-radius: 4px;
}

/* Click-close cursor */
.toast-item[data-click-close="true"] { cursor: pointer; }

/* Icon */
.toast-item .toast-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%) scale(1);
    width: 22px;
    height: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    opacity: .9;
}

/* Close button */
.toast-item .toast-close {
    position: absolute;
    right: 6px;
    top: 6px;
    width: 28px;
    height: 28px;
    border: none;
    background: rgba(255,255,255,.08);
    color: #d4d8e0;
    border-radius: 10px;
    cursor: pointer;
    font-size: 0;
    line-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .25s, transform .25s;
}
.toast-item .toast-close::after {
    content: '×';
    font-size: 16px;
    font-weight: 600;
    line-height: 1;
}
.toast-item .toast-close:hover { background: rgba(255,255,255,.18); transform: scale(1.05); }
.toast-item .toast-close:active { transform: scale(.85); background: rgba(255,255,255,.26); }

/* Content */
.toast-item .toast-content {
    position: relative;
    z-index: 2;
    word-break: break-word;
}

/* Progress bar */
.toast-item .toast-progress {
    position: absolute;
    left: 0;
    bottom: 0;
    height: 3px;
    background: linear-gradient(90deg,#2f6fff,#1a53ea);
    border-bottom-left-radius: inherit;
    border-bottom-right-radius: inherit;
    transform-origin: left center;
    animation: toast-progress linear forwards;
}

/* Type styles */
.toast-item.type-success {
    background:
            linear-gradient(145deg, rgba(25,60,36,.85), rgba(18,30,22,.85)),
            linear-gradient(30deg, rgba(255,255,255,.05), rgba(255,255,255,0) 55%);
    border: 1px solid rgba(90,255,150,.22);
}
.toast-item.type-success .toast-progress { background: linear-gradient(90deg,#35c46a,#1f9b4b); }

.toast-item.type-error {
    background:
            linear-gradient(145deg, rgba(70,19,27,.85), rgba(40,12,16,.85));
    border: 1px solid rgba(255,100,110,.35);
}
.toast-item.type-error .toast-progress { background: linear-gradient(90deg,#ff4d5d,#d81f34); }

.toast-item.type-warning {
    background:
            linear-gradient(145deg, rgba(90,60,10,.85), rgba(50,35,5,.85));
    border: 1px solid rgba(255,210,120,.35);
}
.toast-item.type-warning .toast-progress { background: linear-gradient(90deg,#ffb547,#ff8a00); }

.toast-item.type-loading {
    background:
            linear-gradient(145deg, rgba(32,40,60,.85), rgba(20,24,34,.85));
    border: 1px solid rgba(120,170,255,.22);
}
.toast-item.type-loading .spinner {
    width: 18px;
    height: 18px;
    border: 3px solid rgba(255,255,255,.18);
    border-top-color: #2f6fff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Icon color tweaks */
.toast-item.type-success .toast-icon { color:#35c46a; }
.toast-item.type-error .toast-icon { color:#ff5d63; }
.toast-item.type-warning .toast-icon { color:#ffb547; }
.toast-item.type-info .toast-icon,
.toast-item.type-loading .toast-icon { color:#5d8dff; }

/* Animations */
@keyframes toast-in {
    0% { opacity:0; transform: translateY(14px) scale(.85) rotateX(25deg); filter: blur(4px); }
    60% { transform: translateY(-4px) scale(1.02); }
    100% { opacity:1; transform: translateY(0) scale(1); filter: blur(0); }
}
@keyframes toast-out {
    to { opacity:0; transform: translateY(8px) scale(.9); filter: blur(4px); }
}
@keyframes toast-progress {
    from { transform: scaleX(1); }
    to { transform: scaleX(0); }
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Closing */
.toast-item.closing {
    animation: toast-out .35s ease forwards !important;
}

/* Lightweight mode (optional) */
.toast-lite .toast-item {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    background:#181a1f;
    box-shadow:0 8px 26px -10px rgba(0,0,0,.7);
}

/* Compact mode (optional) */
.toast-compact .toast-item {
    padding: 8px 14px 8px 40px;
    border-radius: 12px;
    font-size: 12.5px;
    min-width:160px;
}

/* Left/right container spacing keeps margins tight */
.toast-container[data-pos$="right"] .toast-item,
.toast-container[data-pos$="left"] .toast-item {
    margin-left: 0;
    margin-right: 0;
}

/* Click-through outside */
.toast-container * { box-sizing: border-box; }