/* ==========================================================================
   DESKTOP TOP BANNER (Zalo PC Announcement Bar - Desktop Only)
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. MOBILE VIEW (< 992px)
   Strictly hidden on mobile. Mobile remains 100% untouched.
   -------------------------------------------------------------------------- */
@media (max-width: 991.98px) {
    .desktop-top-banner {
        display: none !important;
    }

    body.has-desktop-top-banner {
        padding-top: 0 !important;
    }

    body.has-desktop-top-banner .chat-desktop-container,
    body.has-desktop-top-banner .contacts-desktop-container {
        top: 0 !important;
        height: 100vh !important;
        height: 100dvh !important;
    }
}

/* --------------------------------------------------------------------------
   2. DESKTOP VIEW (>= 992px)
   -------------------------------------------------------------------------- */
@media (min-width: 992px) {
    body.has-desktop-top-banner {
        padding-top: 36px;
    }

    body.has-desktop-top-banner .chat-desktop-container,
    body.has-desktop-top-banner .contacts-desktop-container {
        top: 36px !important;
        height: calc(100vh - 36px) !important;
        height: calc(100dvh - 36px) !important;
    }

    .chat-desktop-container,
    .contacts-desktop-container {
        transition: top 0.2s cubic-bezier(0.2, 0, 0, 1), height 0.2s cubic-bezier(0.2, 0, 0, 1);
    }

    .desktop-top-banner {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        height: 36px;
        background-color: #ebf3fc;
        border-bottom: 1px solid #dce8f6;
        z-index: 100000;
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 0 16px;
        box-sizing: border-box;
        user-select: none;
        -webkit-user-select: none;
        font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
        transition: transform 0.2s cubic-bezier(0.2, 0, 0, 1), opacity 0.2s ease;
    }

    .desktop-top-banner--closing {
        transform: translateY(-100%);
        opacity: 0;
        pointer-events: none;
    }

    .desktop-top-banner__inner {
        width: 100%;
        max-width: 100%;
        display: flex;
        align-items: center;
        justify-content: center;
        position: relative;
    }

    .desktop-top-banner__content {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 6px;
        font-size: 13.5px;
        color: #081c36;
        line-height: 1;
        white-space: nowrap;
    }

    .desktop-top-banner__icon {
        font-size: 18px;
        color: #1e4a30;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        flex-shrink: 0;
        vertical-align: middle;
    }

    .desktop-top-banner__text {
        display: inline-flex;
        align-items: center;
        gap: 6px;
        font-weight: 400;
        color: #081c36;
    }

    .desktop-top-banner__link {
        color: #1e4a30;
        font-weight: 500;
        text-decoration: none;
        cursor: pointer;
        background: transparent;
        border: none;
        padding: 0;
        margin: 0;
        font-size: inherit;
        font-family: inherit;
        line-height: inherit;
        display: inline;
        transition: color 0.15s ease, text-decoration 0.15s ease;
    }

    .desktop-top-banner__link:hover {
        text-decoration: underline;
        color: #0052cc;
    }

    .desktop-top-banner__close {
        position: absolute;
        right: 0;
        top: 50%;
        transform: translateY(-50%);
        background: transparent;
        border: none;
        outline: none;
        cursor: pointer;
        padding: 4px;
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: 4px;
        color: #64748b;
        transition: background-color 0.15s ease, color 0.15s ease;
    }

    .desktop-top-banner__close:hover {
        background-color: rgba(0, 0, 0, 0.06);
        color: #081c36;
    }

    .desktop-top-banner__close-icon {
        font-size: 16px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
}

/* --------------------------------------------------------------------------
   3. DESKTOP INSTALL GUIDE MODAL (PWA Fallback)
   -------------------------------------------------------------------------- */
.desktop-install-modal {
    position: fixed;
    inset: 0;
    z-index: 100002;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.desktop-install-modal__backdrop {
    position: fixed;
    inset: 0;
    background-color: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 1;
}

.desktop-install-modal__card {
    position: relative;
    z-index: 2;
    background-color: #ffffff;
    border-radius: 14px;
    width: 520px;
    max-width: 95vw;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: installModalPop 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes installModalPop {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(8px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.desktop-install-modal__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 20px 24px 16px;
    border-bottom: 1px solid #f1f5f9;
}

.desktop-install-modal__brand {
    display: flex;
    align-items: center;
    gap: 14px;
}

.desktop-install-modal__logo {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    object-fit: cover;
    box-shadow: 0 4px 10px rgba(0, 104, 255, 0.15);
}

.desktop-install-modal__title {
    font-size: 16px;
    font-weight: 700;
    color: #0f172a;
    margin: 0 0 4px;
    line-height: 1.3;
}

.desktop-install-modal__desc {
    font-size: 12.5px;
    color: #64748b;
    margin: 0;
    line-height: 1.4;
}

.desktop-install-modal__close-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    color: #94a3b8;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.15s, color 0.15s;
}

.desktop-install-modal__close-btn:hover {
    background-color: #f1f5f9;
    color: #0f172a;
}

.desktop-install-modal__body {
    padding: 20px 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.desktop-install-modal__step {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    background-color: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 14px 16px;
}

.desktop-install-modal__step-num {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background-color: #1e4a30;
    color: #ffffff;
    font-size: 13px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.desktop-install-modal__step-info {
    flex: 1;
}

.desktop-install-modal__step-title {
    font-size: 14px;
    font-weight: 600;
    color: #0f172a;
    margin: 0 0 4px;
}

.desktop-install-modal__step-text {
    font-size: 13px;
    color: #475569;
    margin: 0;
    line-height: 1.5;
}

.desktop-install-modal__inline-icon {
    font-size: 17px;
    color: #1e4a30;
    vertical-align: -3px;
    margin: 0 2px;
}

.desktop-install-modal__footer {
    display: flex;
    justify-content: flex-end;
    padding: 14px 24px 20px;
    border-top: 1px solid #f1f5f9;
}

.desktop-install-modal__btn {
    background-color: #1e4a30;
    color: #ffffff;
    border: none;
    border-radius: 8px;
    padding: 9px 24px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.15s ease, box-shadow 0.15s ease;
}

.desktop-install-modal__btn:hover {
    background-color: #0052cc;
    box-shadow: 0 4px 12px rgba(0, 104, 255, 0.25);
}

/* --------------------------------------------------------------------------
   4. STANDALONE APP WINDOW (PWA)
   Never show top banner when running inside installed app window
   -------------------------------------------------------------------------- */
@media all and (display-mode: standalone) {
    .desktop-top-banner {
        display: none !important;
    }

    body.has-desktop-top-banner {
        padding-top: 0 !important;
    }

    body.has-desktop-top-banner .chat-desktop-container,
    body.has-desktop-top-banner .contacts-desktop-container {
        top: 0 !important;
        height: 100vh !important;
        height: 100dvh !important;
    }
}
