/* ==========================================================================
   Brand Color Variables & Dark/Light Mode Definition
   ========================================================================== */
:root {
    --toast-bg: #FFFFFF;
    --toast-border: #F6E6CE;
    --toast-title: #24000A;
    --toast-message: rgba(36, 0, 10, 0.75);
    --toast-close: rgba(36, 0, 10, 0.45);
    --toast-close-hover-bg: #FAF3E7;
    --toast-close-hover: #800021;
    --toast-shadow: 0 10px 25px -5px rgba(36, 0, 10, 0.08), 0 8px 10px -6px rgba(36, 0, 10, 0.04);
    --toast-shadow-hover: 0 14px 28px -4px rgba(36, 0, 10, 0.12);

    /* Variant Highlights (Light Mode) */
    --toast-accent-success: #800021;
    --toast-badge-success: #FAF3E7;
    --toast-accent-error: #B91C1C;
    --toast-badge-error: #FEF2F2;
    --toast-accent-warning: #D97706;
    --toast-badge-warning: #FFFBEB;
    --toast-accent-info: #0F9AC5;
    --toast-badge-info: #F0F9FF;
}

html.dark, body.dark {
    --toast-bg: #1A0007;
    --toast-border: rgba(128, 0, 33, 0.35);
    --toast-title: #F6E6CE;
    --toast-message: rgba(246, 230, 206, 0.75);
    --toast-close: rgba(246, 230, 206, 0.4);
    --toast-close-hover-bg: rgba(128, 0, 33, 0.3);
    --toast-close-hover: #FFFFFF;
    --toast-shadow: 0 12px 30px -4px rgba(0, 0, 0, 0.6);
    --toast-shadow-hover: 0 16px 36px 0 rgba(0, 0, 0, 0.75);

    /* Variant Highlights (Dark Mode) */
    --toast-accent-success: #F6E6CE;
    --toast-badge-success: rgba(128, 0, 33, 0.35);
    --toast-accent-error: #F87171;
    --toast-badge-error: rgba(185, 28, 28, 0.25);
    --toast-accent-warning: #FBBF24;
    --toast-badge-warning: rgba(217, 119, 6, 0.25);
    --toast-accent-info: #38BDF8;
    --toast-badge-info: rgba(15, 154, 197, 0.25);
}

/* ==========================================================================
   Alert Toast Layout & Styles
   ========================================================================== */
.alert-toast {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 99999;
    min-width: 290px;
    max-width: 370px;
    font-family: inherit;
    animation: toastSlideIn 0.32s cubic-bezier(0.16, 1, 0.3, 1);
}

.alert-toast__container {
    background: var(--toast-bg);
    border: 1px solid var(--toast-border);
    border-left: 4px solid var(--status-color, var(--toast-accent-info));
    border-radius: 18px;
    padding: 13px 15px;
    box-shadow: var(--toast-shadow);
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.alert-toast__container:hover {
    transform: translateY(-2px);
    box-shadow: var(--toast-shadow-hover);
}

.alert-toast__icon-wrap {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
    border-radius: 10px;
    background: var(--status-badge, var(--toast-badge-info));
    color: var(--status-color, var(--toast-accent-info));
    display: flex;
    align-items: center;
    justify-content: center;
}

.alert-toast__icon-wrap svg {
    width: 17px;
    height: 17px;
}

.alert-toast__content {
    flex: 1;
    min-width: 0;
    padding-top: 1px;
    padding-right: 18px;
}

.alert-toast__title {
    font-weight: 700;
    font-size: 13px;
    color: var(--toast-title);
    line-height: 1.25;
    margin-bottom: 2px;
}

.alert-toast__message {
    font-size: 12px;
    color: var(--toast-message);
    line-height: 1.4;
    word-break: break-word;
}

.alert-toast__close {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 24px;
    height: 24px;
    border-radius: 8px;
    border: none;
    background: transparent;
    color: var(--toast-close);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    padding: 0;
}

.alert-toast__close:hover {
    background: var(--toast-close-hover-bg);
    color: var(--toast-close-hover);
}

.alert-toast__close svg {
    width: 14px;
    height: 14px;
}

.alert-toast__progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 2.5px;
    background: var(--status-color, var(--toast-accent-info));
    opacity: 0.85;
    width: 100%;
    transform-origin: left;
    animation: progressBar 5s linear forwards;
}

/* ==========================================================================
   Variant Themes
   ========================================================================== */
.alert-toast--success {
    --status-color: var(--toast-accent-success);
    --status-badge: var(--toast-badge-success);
}

.alert-toast--error {
    --status-color: var(--toast-accent-error);
    --status-badge: var(--toast-badge-error);
}

.alert-toast--warning {
    --status-color: var(--toast-accent-warning);
    --status-badge: var(--toast-badge-warning);
}

.alert-toast--info {
    --status-color: var(--toast-accent-info);
    --status-badge: var(--toast-badge-info);
}

/* ==========================================================================
   Keyframes & Responsive Rules
   ========================================================================== */
@keyframes toastSlideIn {
    from {
        opacity: 0;
        transform: translateY(-16px) scale(0.96);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes toastSlideOut {
    from {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    to {
        opacity: 0;
        transform: translateY(-14px) scale(0.96);
    }
}

@keyframes progressBar {
    from { transform: scaleX(1); }
    to { transform: scaleX(0); }
}

.alert-toast--closing {
    animation: toastSlideOut 0.24s cubic-bezier(0.4, 0, 1, 1) forwards !important;
}

@media (max-width: 640px) {
    .alert-toast {
        left: 14px;
        right: 14px;
        top: 14px;
        min-width: auto;
        max-width: none;
    }
}
