/* ==========================================================================
   Toast Component Styles
   Toast notifications for user feedback (Django messages)
   ========================================================================== */

/* ==========================================================================
   Toast Container
   ========================================================================== */

.toast-container {
    position: fixed;
    bottom: 0;
    right: 0;
    z-index: 20;
    padding: 1rem;
}

/* ==========================================================================
   Toast Base
   ========================================================================== */

.toast {
    width: auto;
    opacity: 0;
    display: flex;
    transform: translateY(100%);
    animation: moveUp 0.5s ease-out forwards;
    border-radius: 5px;
    border: 0;
    padding: 0 10px;
    position: relative;
    overflow: hidden;
    align-items: center;

    &.closed {
        animation: dismissToast 0.3s ease-in forwards;
    }

    button.btn-close {
        font-size: 1.4rem;
        --bs-btn-close-opacity: 0.8;
    }

    .toast-content {
        display: flex;
        justify-content: space-between;
        gap: 0.5rem;
        align-items: center;

        &::before {
            font-family: 'bootstrap-icons' !important;
            font-size: 2rem;
        }
    }

    .toast-body {
        font-size: 1.2rem;

        @media screen and (min-width: 992px) {
            font-size: 1.5rem;
        }
    }

    /* ==========================================================================
       Toast Types (Light Mode)
       ========================================================================== */

    &.success,
    &.error,
    &.info {
        color: white;
    }

    &.success {
        background-color: var(--success-color);

        .toast-content::before {
            content: '\F26D';
        }
    }

    &.error {
        background-color: var(--danger-color);

        .toast-content::before {
            content: '\F339';
        }
    }

    &.info {
        background-color: var(--third-color);

        .toast-content::before {
            content: '\F433';
        }
    }

    &.warning {
        background-color: #fcd34d;

        .toast-body {
            color: var(--base-text-color);
        }

        .btn-close {
            filter: invert(0);
        }

        .toast-content::before {
            content: '\F33B';
            color: #000000;
        }
    }

    /* ==========================================================================
       Toast Progress Bar
       ========================================================================== */

    &::after {
        content: '';
        width: 100%;
        height: 10%;
        background-color: rgba(0, 0, 0, 0.3);
        position: absolute;
        bottom: 0;
        left: 0;
        animation: autoHide 5s linear forwards;
    }
}

/* ==========================================================================
   Toast Types (Dark Mode)
   ========================================================================== */

.darkmode {
    .toast {
        &.info {
            background-color: #31318A;
        }

        &.success {
            background-color: #4b984b;
        }

        &.error {
            background-color: #a30029;
        }

        &.warning {
            background-color: #cf8510;
        }
    }
}

/* ==========================================================================
   Animations
   ========================================================================== */

@keyframes moveUp {
    from {
        transform: translateY(100%);
        opacity: 0;
    }

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

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

    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

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

    to {
        width: 0%;
    }
}
