/* ============================================================
   APP TOAST NOTIFICATION COMPONENT — SPW Wisuda
   Modern, elegant, dark-mode compatible toast notifications
   ============================================================ */

#app-toast-container {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 9999999;
    display: flex;
    flex-direction: column;
    gap: 12px;
    pointer-events: none;
    max-width: 400px;
    width: calc(100vw - 32px);
}

.app-toast {
    pointer-events: auto;
    position: relative;
    display: flex;
    flex-direction: column;
    padding: 0;
    background: #ffffff;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 16px 36px -4px rgba(15, 23, 42, 0.16), 0 4px 12px -2px rgba(15, 23, 42, 0.08);
    overflow: hidden;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    animation: appToastSlideIn 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.app-toast.hiding {
    animation: appToastSlideOut 0.28s cubic-bezier(0.7, 0, 0.84, 0) forwards;
}

@keyframes appToastSlideIn {
    from {
        opacity: 0;
        transform: translateY(-16px) scale(0.96);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes appToastSlideOut {
    0% {
        opacity: 1;
        transform: translateY(0) scale(1);
        max-height: 180px;
        margin-bottom: 0;
    }
    100% {
        opacity: 0;
        transform: translateY(-14px) scale(0.94);
        max-height: 0;
        margin-bottom: -12px;
        padding-top: 0;
        padding-bottom: 0;
    }
}

/* ─── Type variants ─────────────────────────────────────────── */
.app-toast.toast-success {
    border-left: 4px solid #10b981;
}
.app-toast.toast-danger,
.app-toast.toast-error {
    border-left: 4px solid #ef4444;
}
.app-toast.toast-warning {
    border-left: 4px solid #f59e0b;
}
.app-toast.toast-info {
    border-left: 4px solid #3b82f6;
}

/* ─── Header ────────────────────────────────────────────────── */
.app-toast-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px 8px 12px;
    background: #fafbfc;
    border-bottom: 1px solid #f1f5f9;
}

.app-toast-header-left {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

/* ─── Icon ──────────────────────────────────────────────────── */
.app-toast-icon-wrap {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}
.app-toast.toast-success .app-toast-icon-wrap {
    background: #ecfdf5;
    color: #10b981;
    border: 1px solid #a7f3d0;
}
.app-toast.toast-danger .app-toast-icon-wrap,
.app-toast.toast-error .app-toast-icon-wrap {
    background: #fef2f2;
    color: #ef4444;
    border: 1px solid #fecaca;
}
.app-toast.toast-warning .app-toast-icon-wrap {
    background: #fffbeb;
    color: #f59e0b;
    border: 1px solid #fde68a;
}
.app-toast.toast-info .app-toast-icon-wrap {
    background: #eff6ff;
    color: #3b82f6;
    border: 1px solid #bfdbfe;
}

/* ─── Title in Header ───────────────────────────────────────── */
.app-toast-title {
    margin: 0;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    line-height: 1;
}
.app-toast.toast-success .app-toast-title {
    color: #065f46;
}
.app-toast.toast-danger .app-toast-title,
.app-toast.toast-error .app-toast-title {
    color: #991b1b;
}
.app-toast.toast-warning .app-toast-title {
    color: #92400e;
}
.app-toast.toast-info .app-toast-title {
    color: #1e40af;
}

/* ─── Close button ──────────────────────────────────────────── */
.app-toast-close {
    flex-shrink: 0;
    background: transparent;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    padding: 0;
    width: 22px;
    height: 22px;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    line-height: 1;
    transition: all 0.15s ease;
}
.app-toast-close:hover {
    color: #1e293b;
    background: #f1f5f9;
}

/* ─── Body ──────────────────────────────────────────────────── */
.app-toast-body {
    padding: 10px 14px 13px;
}

.app-toast-message {
    font-size: 13px;
    color: #334155;
    line-height: 1.45;
    word-break: break-word;
    font-weight: 400;
}

/* ─── Progress bar countdown ────────────────────────────────── */
.app-toast-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: rgba(0, 0, 0, 0.05);
}
.app-toast-progress-fill {
    height: 100%;
    width: 100%;
    transform-origin: left;
    transition: transform linear;
}
.app-toast.toast-success .app-toast-progress-fill {
    background: #10b981;
}
.app-toast.toast-danger .app-toast-progress-fill,
.app-toast.toast-error .app-toast-progress-fill {
    background: #ef4444;
}
.app-toast.toast-warning .app-toast-progress-fill {
    background: #f59e0b;
}
.app-toast.toast-info .app-toast-progress-fill {
    background: #3b82f6;
}

/* ─── Dark Mode Support ─────────────────────────────────────── */
body.dark-mode .app-toast {
    background: #1a1d27;
    border-color: #2e3348;
    box-shadow: 0 16px 36px -4px rgba(0, 0, 0, 0.5), 0 4px 12px -2px rgba(0, 0, 0, 0.35);
}
body.dark-mode .app-toast-header {
    background: #151821;
    border-bottom-color: #2e3348;
}
body.dark-mode .app-toast-message {
    color: #e2e4ef;
}
body.dark-mode .app-toast-close {
    color: #8b91b0;
}
body.dark-mode .app-toast-close:hover {
    color: #ffffff;
    background: #22263a;
}
body.dark-mode .app-toast.toast-success .app-toast-icon-wrap {
    background: rgba(16, 185, 129, 0.15);
    border-color: rgba(16, 185, 129, 0.3);
}
body.dark-mode .app-toast.toast-success .app-toast-title {
    color: #34d399;
}
body.dark-mode .app-toast.toast-danger .app-toast-icon-wrap,
body.dark-mode .app-toast.toast-error .app-toast-icon-wrap {
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.3);
}
body.dark-mode .app-toast.toast-danger .app-toast-title,
body.dark-mode .app-toast.toast-error .app-toast-title {
    color: #f87171;
}
body.dark-mode .app-toast.toast-warning .app-toast-icon-wrap {
    background: rgba(245, 158, 11, 0.15);
    border-color: rgba(245, 158, 11, 0.3);
}
body.dark-mode .app-toast.toast-warning .app-toast-title {
    color: #fbbf24;
}
body.dark-mode .app-toast.toast-info .app-toast-icon-wrap {
    background: rgba(59, 130, 246, 0.15);
    border-color: rgba(59, 130, 246, 0.3);
}
body.dark-mode .app-toast.toast-info .app-toast-title {
    color: #60a5fa;
}
body.dark-mode .app-toast-progress {
    background: rgba(255, 255, 255, 0.08);
}

@media (max-width: 575.98px) {
    #app-toast-container {
        top: 12px;
        right: 12px;
        left: 12px;
        width: auto;
        max-width: none;
    }
}
