/* -----------------------------------------------------------------------------
 * Landing Page Alerts & Notifications Engine Stylesheet
 * Company: شركة الابتكار والحداثة التجارية (Ebtikar & Hadatha Trading Co.)
 * ----------------------------------------------------------------------------- */

/* Top Announcement Bar */
.top-alert-bar {
    background: linear-gradient(90deg, #0C4855 0%, #153D4A 50%, #08333D 100%);
    color: #FFFFFF;
    font-size: 0.8125rem;
    padding: 0.625rem 1rem;
    border-bottom: 1px solid rgba(221, 167, 58, 0.3);
    position: relative;
    z-index: 50;
    transition: all 0.4s ease-in-out;
}

.top-alert-bar .top-bar-inner {
    max-width: 80rem;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.top-alert-bar .top-bar-btn {
    background: linear-gradient(90deg, #DDA73A 0%, #E7B74D 100%);
    color: #08333D;
    font-weight: 800;
    font-size: 0.75rem;
    padding: 0.35rem 0.85rem;
    border-radius: 0.5rem;
    white-space: nowrap;
    text-decoration: none;
    transition: all 0.2s ease;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.top-alert-bar .top-bar-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(221, 167, 58, 0.3);
}

.top-alert-bar .close-btn {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    font-size: 1.1rem;
    cursor: pointer;
    padding: 0.2rem 0.5rem;
    line-height: 1;
    transition: color 0.2s ease;
}

.top-alert-bar .close-btn:hover {
    color: #FFFFFF;
}

/* Popup Modal Banner */
.popup-alert-backdrop {
    position: fixed;
    inset: 0;
    background-color: rgba(8, 51, 61, 0.75);
    backdrop-filter: blur(6px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    opacity: 0;
    visibility: hidden;
    pointer-events: none; /* ← CRITICAL: Don't intercept clicks when hidden */
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.popup-alert-backdrop.show {
    opacity: 1;
    visibility: visible;
    pointer-events: auto; /* ← Allow interaction only when shown */
}

.popup-alert-card {
    background: #FFFFFF;
    border-radius: 1.5rem;
    max-width: 32rem;
    width: 100%;
    overflow: hidden;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(226, 232, 240, 0.8);
    position: relative;
    transform: scale(0.95) translateY(10px);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.popup-alert-backdrop.show .popup-alert-card {
    transform: scale(1) translateY(0);
}

.popup-alert-card .popup-image {
    width: 100%;
    max-height: 16rem;
    object-fit: cover;
    background-color: #F1F5F9;
}

.popup-alert-card .popup-close {
    position: absolute;
    top: 0.75rem;
    left: 0.75rem;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 50%;
    background: rgba(8, 51, 61, 0.6);
    color: #FFFFFF;
    border: none;
    font-size: 1.1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
    transition: background 0.2s ease;
    z-index: 10;
}

.popup-alert-card .popup-close:hover {
    background: rgba(8, 51, 61, 0.9);
}

/* Floating Toast Notification */
.floating-toast-alert {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 9990;
    max-width: 24rem;
    width: calc(100% - 3rem);
    background: #FFFFFF;
    border-radius: 1.25rem;
    padding: 1rem 1.25rem;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.15), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    border: 1px solid #E2E8F0;
    border-right: 4px solid #DDA73A;
    transform: translateY(120%);
    opacity: 0;
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.4s ease;
}

.floating-toast-alert.show {
    transform: translateY(0);
    opacity: 1;
}

.floating-toast-alert .toast-close {
    position: absolute;
    top: 0.5rem;
    left: 0.5rem;
    background: transparent;
    border: none;
    color: #94A3B8;
    cursor: pointer;
    font-size: 1rem;
}

.floating-toast-alert .toast-close:hover {
    color: #334155;
}

/* Mobile Responsiveness Rules (max-width: 640px) */
@media (max-width: 640px) {
    .top-alert-bar {
        padding: 0.5rem 0.75rem;
    }

    .top-alert-bar .top-bar-inner {
        flex-direction: column;
        text-align: center;
        gap: 0.4rem;
        padding-left: 2rem; /* Reserve space for absolute close button */
    }

    .top-alert-bar .top-bar-inner > div.flex-1 {
        flex-direction: column;
        align-items: center;
        justify-content: center;
        text-align: center;
        width: 100%;
    }

    .top-alert-bar .top-bar-inner > div.flex-1 span {
        text-align: center;
        word-break: break-word;
        white-space: normal;
    }

    .top-alert-bar .top-bar-btn {
        display: inline-block;
        padding: 0.3rem 0.75rem;
        font-size: 0.7rem;
        margin-top: 0.2rem;
    }

    .top-alert-bar .close-btn {
        position: absolute;
        top: 0.4rem;
        left: 0.5rem; /* RTL: position on the left edge */
        font-size: 1.25rem;
        padding: 0.2rem;
    }

    /* Floating Toast Mobile Fix */
    .floating-toast-alert {
        bottom: 1rem;
        right: 0.75rem;
        left: 0.75rem;
        width: auto;
        max-width: none;
        padding: 0.75rem 1rem;
        border-radius: 1rem;
    }

    /* Popup Modal Mobile Fix */
    .popup-alert-backdrop {
        padding: 0.75rem;
    }

    .popup-alert-card {
        border-radius: 1.25rem;
    }

    .popup-alert-card .popup-image {
        max-height: 11rem;
    }
}
