/* =========================================================
   alertx.css — shared toast alert ("main alert").
   Used by the main layout and by <x-auth-layout> (login etc.).
   Moved out of style.css / style-mobile.css so pages that must not
   load those global files can still use the exact same alert.

   Markup:
     <div class="alertx-container">
       <div class="alertx [alertx-danger|alertx-warning]">
         Message <span class="close-btn">&times;</span>
       </div>
     </div>
   ========================================================= */

.alertx-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
}

.alertx {
    --alertx-bg: linear-gradient(135deg, #2e9e4f 0%, #1f7a3a 100%);
    --alertx-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='3.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E");

    position: relative;
    overflow: hidden;
    width: min(420px, 30vw);
    min-width: 320px;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 16px 18px 18px;

    background: var(--alertx-bg);
    color: #fff;
    font-size: 0.95rem;
    font-weight: 500;
    line-height: 1.4;

    border: 0;
    border-radius: 14px;
    box-shadow:
        0 10px 24px rgba(0, 0, 0, 0.28);

    animation: alertx-in 0.55s cubic-bezier(0.22, 1.4, 0.36, 1) both;
}

/* Status icon */
.alertx::before {
    content: "";
    flex: 0 0 34px;
    height: 34px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.22);
    background-image: var(--alertx-icon);
    background-repeat: no-repeat;
    background-position: center;
    background-size: 18px;
}

/* Auto-dismiss countdown: keep in sync with the 5000ms timers that remove the alert */
.alertx::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 3px;
    background: rgba(255, 255, 255, 0.55);
    transform-origin: left center;
    animation: alertx-timer 5s linear forwards;
}

.alertx ul {
    flex: 1;
    margin: 0;
}

.alertx-title {
    font-size: 1.1rem;
    font-weight: 700;
}

.alertx-danger {
    --alertx-bg: linear-gradient(135deg, #f0454f 0%, #c92a36 100%);
    --alertx-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='3.2' stroke-linecap='round'%3E%3Cpath d='M7 7l10 10M17 7L7 17'/%3E%3C/svg%3E");
    background: var(--alertx-bg) !important;
    animation-name: alertx-in, alertx-shake;
    animation-duration: 0.55s, 0.5s;
    animation-delay: 0s, 0.5s;
}

.alertx-warning {
    --alertx-bg: linear-gradient(135deg, #f5a53a 0%, #d9821a 100%);
    --alertx-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='3.2' stroke-linecap='round'%3E%3Cpath d='M12 6v7M12 18v.01'/%3E%3C/svg%3E");
}

.close-btn {
    flex: 0 0 auto;
    margin-left: auto;
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.4rem;
    line-height: 1;
    color: rgba(255, 255, 255, 0.8);
    border-radius: 50%;
    transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.close-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    transform: rotate(90deg);
}

@keyframes alertx-in {
    from { opacity: 0; transform: translateX(60px) scale(0.92); }
    to   { opacity: 1; transform: translateX(0) scale(1); }
}

@keyframes alertx-shake {
    0%, 100% { translate: 0; }
    20% { translate: -6px; }
    40% { translate: 6px; }
    60% { translate: -4px; }
    80% { translate: 3px; }
}

@keyframes alertx-timer {
    from { transform: scaleX(1); }
    to   { transform: scaleX(0); }
}

@media (prefers-reduced-motion: reduce) {
    .alertx, .alertx::after { animation: none; }
}

/* phones: full-width toast at the top (was in style-mobile.css, max-width: 801px) */
@media (max-width: 801px) {
    .alertx-container {
        position: fixed;
        top: 5vh;
        bottom: auto;
        right: 5vw;
        z-index: 3000;
    }

    .alertx {
        min-height: 30px;
        width: 90vw;
        min-width: 0;
    }

    .alertx-title {
        font-size: 1.2rem;
        font-weight: 700;
    }
}
