/* ==========================================================================
   NOOKNICK LIVE CHAT - MOBILE & RESPONSIVE (COMPACT)
   ========================================================================== */

:root {
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --safe-left: env(safe-area-inset-left, 0px);
    --safe-right: env(safe-area-inset-right, 0px);
}

/* 1. Desktop Defaults (Hide Mobile UI) */
.mobile-top-bar, .mobile-back-btn, .mobile-info-btn,
.mobile-action-plus-btn, .mobile-action-sheet { display: none !important; }

.desktop-input-action-btn {
    background: transparent !important; color: var(--text-muted) !important;
    border: none !important; box-shadow: none !important;
    width: 36px !important; height: 36px !important; border-radius: 8px !important;
    font-size: 1.15rem !important; cursor: pointer; display: flex;
    align-items: center; justify-content: center; transition: all 0.2s;
}
.desktop-input-action-btn:hover { color: var(--text-main) !important; background: var(--bg-hover) !important; }

/* 2. Tablet & Mobile Viewport (<= 768px) */
@media (max-width: 768px) {
    html, body {
        height: 100dvh !important; height: -webkit-fill-available;
        overflow: hidden; overscroll-behavior: none; -webkit-overflow-scrolling: touch;
        background-color: #18181b !important;
    }
    .app-container {
        display: flex !important; width: 100vw !important; height: 100dvh !important;
        position: relative !important; overflow: hidden !important; box-sizing: border-box !important;
    }
    .info-toggle-tab { display: flex !important; z-index: 99 !important; }

    /* Top App Bar */
    .mobile-top-bar {
        display: flex !important; align-items: center; justify-content: space-between;
        width: 100vw; height: calc(56px + var(--safe-top, 0px));
        background: #18181b !important;
        border-bottom: 1px solid var(--border-color);
        padding-top: var(--safe-top, 0px) !important;
        padding-bottom: 0;
        padding-left: calc(16px + var(--safe-left, 0px));
        padding-right: calc(16px + var(--safe-right, 0px));
        position: fixed; top: 0; left: 0; z-index: 900; box-sizing: border-box;
    }

    /* Hide top app bar completely when mobile chat room is active */
    body.mobile-chat-active .mobile-top-bar,
    body:has(.mobile-chat-active) .mobile-top-bar,
    .app-container.mobile-chat-active ~ .mobile-top-bar {
        display: none !important;
    }
    .mobile-drawer-btn, .mobile-top-icon-btn {
        background: transparent; border: none; font-size: 1.25rem;
        color: var(--text-main); cursor: pointer; padding: 4px; display: flex; align-items: center;
    }

    /* Navigation Drawer (Sidebar) */
    .nav-sidebar {
        position: fixed !important; top: 0; left: -280px; width: 280px !important; height: 100dvh !important;
        flex-direction: column !important; justify-content: flex-start !important; align-items: stretch !important;
        border-right: 1px solid var(--border-color) !important; border-top: none !important;
        padding-top: calc(24px + var(--safe-top, 0px)) !important;
        padding-bottom: calc(24px + var(--safe-bottom, 0px)) !important;
        padding-left: calc(16px + var(--safe-left, 0px)) !important;
        padding-right: 16px !important;
        z-index: 1000 !important; background: var(--bg-panel) !important;
        transition: left 0.3s cubic-bezier(0.16, 1, 0.3, 1) !important;
        box-shadow: 10px 0 30px rgba(0, 0, 0, 0.5);
        box-sizing: border-box !important;
    }
    body.drawer-open .nav-sidebar { left: 0 !important; }
    .drawer-overlay {
        position: fixed; top: 0; left: 0; width: 100vw; height: 100dvh;
        background: rgba(0, 0, 0, 0.6); z-index: 950; opacity: 0;
        pointer-events: none; transition: opacity 0.3s ease; display: block !important;
    }
    body.drawer-open .drawer-overlay { opacity: 1; pointer-events: auto; }

    .nav-brand { display: flex !important; margin-bottom: 30px !important; width: 100%; padding-left: 12px; }
    .nav-brand .brand-logo { width: auto !important; height: 48px !important; background: transparent !important; box-shadow: none !important; }
    .nav-brand .brand-logo img { width: auto !important; height: 100% !important; }
    .nav-menu { flex-direction: column !important; align-items: stretch !important; width: 100% !important; gap: 8px !important; }
    .nav-divider { width: 100% !important; height: 1px !important; margin: 8px 0 !important; background: var(--border-color) !important; opacity: 0.5 !important; }
    .nav-item {
        width: 100% !important; height: 48px !important; padding: 0 16px !important;
        flex-direction: row !important; justify-content: flex-start !important; align-items: center !important;
        gap: 16px !important; background: transparent !important; border-radius: 12px !important;
    }
    .nav-item .icon-wrapper,
    .nav-item > i {
        width: 24px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        font-size: 1.15rem !important;
        flex-shrink: 0 !important;
    }
    .nav-item span, .nav-text-mobile {
        display: block !important;
        font-size: 0.95rem !important;
        font-weight: 500 !important;
        max-width: none !important;
        overflow: visible !important;
        text-overflow: clip !important;
        text-align: left !important;
        white-space: nowrap !important;
        letter-spacing: normal !important;
        line-height: 1.2 !important;
    }
    .nav-profile-info.nav-text-mobile { display: flex !important; flex-direction: column; justify-content: center; min-width: 0; }
    .nav-item.active { background: var(--bg-hover) !important; color: var(--brand-glow) !important; }
    .nav-item.active::before, .nav-item.active::after { display: none !important; }
    .nav-bottom { margin-top: auto !important; flex-direction: column !important; align-items: stretch !important; gap: 12px !important; }
    .nav-profile { display: flex; align-items: center; padding: 0 12px; gap: 12px; }
    .avatar-circle { width: 36px !important; height: 36px !important; font-size: 1rem !important; }

    /* Sliding Panels: Chat List vs Active Chat */
    /* Sliding Panels: Chat List vs Active Chat */
    .chat-list-panel {
        width: 100vw !important; min-width: 100vw !important; position: fixed !important;
        top: calc(56px + var(--safe-top, 0px)) !important; left: 0; z-index: 10;
        transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
        background-color: var(--bg-panel) !important; border-right: none !important;
        height: calc(100dvh - 56px - var(--safe-top, 0px)) !important;
    }
    .chat-list-panel .customer-list,
    .customer-list {
        padding-bottom: calc(36px + var(--safe-bottom, 0px)) !important;
    }
    .chat-window {
        width: 100vw !important; min-width: 100vw !important; height: 100dvh !important;
        position: fixed !important; top: 0 !important; left: 0 !important; z-index: 1000 !important;
        transform: translateX(100vw); visibility: hidden; pointer-events: none;
        transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.25s;
        background-color: #18181b !important;
    }
    .app-container.mobile-chat-active .chat-list-panel { transform: translateX(-30vw); pointer-events: none; }
    .app-container.mobile-chat-active .chat-window { transform: translateX(0); visibility: visible; pointer-events: auto; }

    /* Chat Header */
    .chat-header {
        height: calc(56px + var(--safe-top, 0px)) !important;
        padding-top: var(--safe-top, 0px) !important;
        padding-bottom: 0 !important;
        padding-left: calc(10px + var(--safe-left, 0px)) !important;
        padding-right: calc(10px + var(--safe-right, 0px)) !important;
        background: #18181b !important;
        border-bottom: 1px solid var(--border-color); z-index: 30;
        display: flex !important; align-items: center !important; justify-content: space-between !important;
        box-sizing: border-box !important;
    }
    .chat-header-left { display: flex !important; align-items: center !important; gap: 6px !important; min-width: 0 !important; flex: 1 !important; overflow: hidden !important; }
    .mobile-back-btn {
        display: flex !important; align-items: center !important; justify-content: center !important;
        width: 34px !important; height: 34px !important; min-width: 34px !important;
        background: transparent !important; border: none !important; color: var(--text-main) !important;
        font-size: 1.15rem !important; cursor: pointer !important; border-radius: 50% !important;
        z-index: 100 !important; flex-shrink: 0 !important; -webkit-tap-highlight-color: rgba(255,255,255,0.1);
    }
    .mobile-back-btn:active { background: var(--bg-hover) !important; transform: scale(0.92); }
    .chat-header-user-clickable {
        display: flex !important; align-items: center !important; gap: 8px !important; cursor: pointer !important;
        padding: 2px 4px !important; border-radius: 10px !important; min-width: 0 !important; flex: 1 !important;
        overflow: hidden !important; transition: background 0.15s, transform 0.1s; -webkit-tap-highlight-color: transparent;
    }
    .chat-header-user-clickable:hover { background: var(--bg-hover) !important; }
    .chat-header-user-clickable:active { transform: scale(0.97); background: rgba(255, 255, 255, 0.08) !important; }
    .chat-header .avatar { width: 38px !important; height: 38px !important; min-width: 38px !important; border-radius: 50% !important; flex-shrink: 0 !important; }
    .chat-header-info-col { min-width: 0 !important; flex: 1 !important; overflow: hidden !important; display: flex !important; flex-direction: column !important; justify-content: center !important; }
    .chat-header-info-name { font-size: 0.92rem !important; font-weight: 600 !important; line-height: 1.25 !important; white-space: nowrap !important; overflow: hidden !important; text-overflow: ellipsis !important; color: var(--text-main) !important; }
    .chat-header-info-status { font-size: 0.72rem !important; display: flex !important; align-items: center !important; gap: 6px !important; overflow: hidden !important; white-space: nowrap !important; margin-top: 1px !important; }
    #chatHeaderStatusText { white-space: nowrap !important; overflow: hidden !important; text-overflow: ellipsis !important; font-size: 0.72rem !important; }
    #chatHeaderAdminBadge { white-space: nowrap !important; font-size: 0.68rem !important; padding: 1px 6px !important; border-radius: 6px !important; }
    .chat-header-actions { display: flex !important; align-items: center !important; gap: 6px !important; flex-shrink: 0 !important; }
    .chat-header-actions button {
        width: 36px !important; height: 36px !important; min-width: 36px !important;
        padding: 0 !important; display: flex !important; align-items: center !important; justify-content: center !important;
        border-radius: 10px !important; font-size: 0.95rem !important; flex-shrink: 0 !important;
    }
    .chat-header-actions button span { display: none !important; }

    /* Messages & Input Area */
    .chat-messages { padding: 15px 12px !important; gap: 12px !important; }
    .message { max-width: 85% !important; padding: 10px 14px !important; font-size: 0.9rem !important; border-radius: 16px !important; }
    .chat-input-area {
        padding: 8px 10px !important; padding-bottom: calc(8px + var(--safe-bottom, 0px)) !important;
        gap: 8px !important; background: #18181b !important; border-top: 1px solid var(--border-color);
    }
    .desktop-input-action-btn { width: 34px !important; height: 34px !important; min-width: 34px !important; font-size: 1.05rem !important; }
    .mobile-action-plus-btn { display: none !important; }
    .chat-input-area input { padding: 10px 14px !important; border-radius: 20px !important; font-size: 0.9rem !important; min-width: 0 !important; flex: 1 !important; }
    .chat-input-area button#sendBtn { width: 38px !important; height: 38px !important; min-width: 38px !important; border-radius: 50% !important; font-size: 0.95rem !important; box-shadow: none !important; flex-shrink: 0 !important; }

    /* Customer Info Panel Drawer */
    .info-panel {
        position: fixed !important; top: 0; right: 0; width: 88vw !important; max-width: 360px; height: 100dvh !important;
        z-index: 1100 !important; background: #18181b !important; transform: translateX(100%);
        transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1) !important;
        padding-top: var(--safe-top, 0px) !important;
        padding-bottom: var(--safe-bottom, 0px) !important;
        box-sizing: border-box !important;
        box-shadow: -10px 0 30px rgba(0, 0, 0, 0.5) !important; border-left: 1px solid var(--border-color); display: flex !important;
    }
    .info-panel .panel-header { background: #18181b !important; }
    .app-container.mobile-info-active .info-panel { transform: translateX(0) !important; }
    .close-mobile-info-btn {
        display: flex !important; align-items: center; justify-content: center;
        width: 32px; height: 32px; background: var(--bg-hover); border: 1px solid var(--border-color);
        color: var(--text-muted); border-radius: 50%; cursor: pointer; font-size: 1rem;
    }
}

/* 3. Small Mobile Screen (< 640px) */
@media (max-width: 640px) {
    .chat-input-area { padding: 6px 8px !important; padding-bottom: calc(6px + var(--safe-bottom, 0px)) !important; gap: 6px !important; }
    #expandActionsBtn, #quickReplyBtn, #flexMenuBtn, #btnInputSendBank, #btnInputCreateOrder { display: none !important; }
    .mobile-action-plus-btn {
        display: flex !important; align-items: center !important; justify-content: center !important;
        width: 36px !important; height: 36px !important; min-width: 36px !important;
        background: transparent !important; border: none !important; color: #60a5fa !important;
        font-size: 1.35rem !important; cursor: pointer !important; flex-shrink: 0 !important;
    }
    .mobile-action-plus-btn * { pointer-events: none !important; }
    #attachBtn { display: flex !important; width: 32px !important; height: 32px !important; min-width: 32px !important; font-size: 1rem !important; }
    .chat-input-area input { padding: 8px 12px !important; font-size: 0.88rem !important; }
    .chat-input-area button#sendBtn { width: 36px !important; height: 36px !important; min-width: 36px !important; }
}

/* 4. Action Sheet ((+) Quick Tools Popup) */
.mobile-action-sheet { display: none; position: fixed; top: 0; left: 0; width: 100vw; height: 100dvh; z-index: 2000 !important; }
.mobile-action-sheet.show { display: block !important; }
.mobile-action-sheet-backdrop {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.5) !important; backdrop-filter: blur(3px) !important; z-index: 1;
}
.mobile-action-sheet-content {
    position: absolute; bottom: calc(58px + var(--safe-bottom, 0px)); left: 10px; width: 230px;
    background: #18181b !important; border: 1px solid rgba(255, 255, 255, 0.12) !important;
    border-radius: 14px; padding: 8px; box-shadow: 0 12px 35px rgba(0, 0, 0, 0.8) !important;
    animation: popUpFab 0.2s cubic-bezier(0.16, 1, 0.3, 1); box-sizing: border-box; z-index: 2;
}
@keyframes popUpFab {
    from { transform: scale(0.9) translateY(10px); opacity: 0; transform-origin: bottom left; }
    to { transform: scale(1) translateY(0); opacity: 1; transform-origin: bottom left; }
}
.mobile-sheet-drag-handle { display: none; }
.mobile-action-grid { display: flex; flex-direction: column; gap: 4px; }
.mobile-action-item {
    display: flex; flex-direction: row; align-items: center; justify-content: flex-start;
    gap: 12px; background: none; border: none; color: var(--text-main);
    cursor: pointer; padding: 10px 12px; border-radius: 8px; transition: background 0.15s; width: 100%;
}
.mobile-action-item:active { background: rgba(255, 255, 255, 0.05); }
.mobile-action-item .action-icon {
    width: 32px; height: 32px; border-radius: 8px; display: flex;
    align-items: center; justify-content: center; color: white; font-size: 1rem; flex-shrink: 0;
}
.mobile-action-item span { font-size: 0.95rem; font-weight: 500; }

/* 5. Light Theme Overrides */
html[data-theme="light"], html[data-theme="light"] body { background-color: #ffffff !important; }
html[data-theme="light"] .mobile-top-bar,
html[data-theme="light"] .chat-list-panel,
html[data-theme="light"] .chat-list-panel .panel-header,
html[data-theme="light"] .chat-header,
html[data-theme="light"] .chat-input-area,
html[data-theme="light"] .info-panel,
html[data-theme="light"] .info-panel .panel-header,
html[data-theme="light"] .mobile-action-sheet-content { background: #ffffff !important; border-color: #e2e8f0 !important; }
html[data-theme="light"] .chat-input-area input { background: #f1f5f9 !important; border: 1px solid #e2e8f0 !important; color: #0f172a !important; }
html[data-theme="light"] .mobile-back-btn, html[data-theme="light"] .mobile-action-item { color: #0f172a !important; }
html[data-theme="light"] .mobile-action-plus-btn, html[data-theme="light"] .mobile-action-item span,
html[data-theme="light"] .close-mobile-info-btn { color: #64748b !important; }
html[data-theme="light"] .mobile-action-item:active, html[data-theme="light"] .close-mobile-info-btn { background: #f1f5f9 !important; border-color: #e2e8f0 !important; }
html[data-theme="light"] .mobile-action-sheet-content, html[data-theme="light"] .info-panel { box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.1) !important; }
html[data-theme="light"] .mobile-sheet-drag-handle { background: #cbd5e1 !important; }

/* 6. PWA Install Banner & Standalone Fullscreen */
.pwa-install-banner {
    position: fixed; top: calc(64px + var(--safe-top, 0px)); left: 12px; right: 12px;
    z-index: 10000; background: rgba(18, 24, 38, 0.94); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(56, 189, 248, 0.35); border-radius: 14px; padding: 10px 14px;
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5), 0 0 16px rgba(56, 189, 248, 0.15);
    animation: pwaBannerSlideDown 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    transition: transform 0.3s ease, opacity 0.3s ease;
}
@keyframes pwaBannerSlideDown {
    from { opacity: 0; transform: translateY(-20px) scale(0.96); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}
.pwa-banner-hide { opacity: 0 !important; transform: translateY(-20px) scale(0.96) !important; pointer-events: none !important; }
.pwa-banner-content { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; }
.pwa-banner-icon { width: 36px; height: 36px; border-radius: 10px; overflow: hidden; flex-shrink: 0; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3); }
.pwa-banner-icon img { width: 100%; height: 100%; object-fit: cover; }
.pwa-banner-text { min-width: 0; display: flex; flex-direction: column; }
.pwa-banner-title { font-size: 0.85rem; font-weight: 700; color: #f8fafc; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pwa-banner-desc { font-size: 0.72rem; color: #38bdf8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pwa-banner-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.pwa-btn-install {
    background: linear-gradient(135deg, #0284c7, #0ea5e9); color: #ffffff; border: none;
    border-radius: 8px; padding: 6px 14px; font-size: 0.8rem; font-weight: 600; cursor: pointer;
    display: inline-flex; align-items: center; gap: 6px; box-shadow: 0 2px 8px rgba(14, 165, 233, 0.4);
    transition: all 0.2s ease;
}
.pwa-btn-install:active { transform: scale(0.95); background: #0284c7; }
.pwa-btn-close {
    background: transparent; border: none; color: #94a3b8; font-size: 1rem; cursor: pointer;
    padding: 6px; display: flex; align-items: center; justify-content: center; border-radius: 6px;
}
.pwa-btn-close:active { color: #f1f5f9; background: rgba(255, 255, 255, 0.1); }

@media (min-width: 769px) {
    .pwa-install-banner, #btnInstallPwa { display: none !important; }
}

@media all and (display-mode: standalone), (display-mode: fullscreen) {
    .pwa-install-banner, #btnInstallPwa { display: none !important; }
}
:is(html, body).is-pwa-standalone .pwa-install-banner,
:is(html, body).is-pwa-standalone #btnInstallPwa,
:is(html, body).is-in-app .pwa-install-banner,
:is(html, body).is-in-app #btnInstallPwa { display: none !important; }

/* 7. Notification Dropdown Panel (Mobile & Tablet / Desktop) */
.notif-dropdown-panel {
    position: fixed;
    top: calc(62px + var(--safe-top, 0px));
    right: 12px;
    width: 370px;
    max-width: calc(100vw - 24px);
    max-height: calc(85dvh - var(--safe-top, 0px) - var(--safe-bottom, 0px));
    background: rgba(18, 24, 38, 0.96);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(56, 189, 248, 0.25);
    border-radius: 16px;
    box-shadow: 0 20px 45px rgba(0, 0, 0, 0.65), 0 0 20px rgba(56, 189, 248, 0.1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: notifSlideIn 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes notifSlideIn {
    from {
        opacity: 0;
        transform: translateY(-10px) scale(0.97);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.notif-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.02);
}

.notif-bell-icon-wrap {
    width: 32px;
    height: 32px;
    border-radius: 10px;
    background: rgba(56, 189, 248, 0.15);
    color: #38bdf8;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
}

.notif-panel-body {
    flex: 1;
    overflow-y: auto;
    max-height: 420px;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    -webkit-overflow-scrolling: touch;
}

.notif-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    cursor: pointer;
    transition: all 0.15s ease;
    position: relative;
    -webkit-tap-highlight-color: transparent;
}

.notif-item:hover, .notif-item:active {
    background: rgba(56, 189, 248, 0.1);
    border-color: rgba(56, 189, 248, 0.25);
    transform: translateX(2px);
}

.notif-item.unread {
    background: rgba(56, 189, 248, 0.06);
    border-left: 3px solid #38bdf8;
}

.notif-item-icon {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    flex-shrink: 0;
    margin-top: 2px;
}

.notif-item-icon.assigned {
    background: rgba(168, 85, 247, 0.18);
    color: #c084fc;
}

.notif-item-icon.handover {
    background: rgba(6, 182, 212, 0.18);
    color: #22d3ee;
}

.notif-item-icon.sla {
    background: rgba(245, 158, 11, 0.18);
    color: #fbbf24;
}

.notif-item-content {
    flex: 1;
    min-width: 0;
}

.notif-item-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: #f1f5f9;
    line-height: 1.3;
}

.notif-item-body {
    font-size: 0.78rem;
    color: #94a3b8;
    margin-top: 2px;
    line-height: 1.35;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.notif-item-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 4px;
    font-size: 0.7rem;
    color: #64748b;
}

.notif-item-tag {
    font-size: 0.68rem;
    padding: 1px 6px;
    border-radius: 6px;
    font-weight: 600;
}

.notif-item-tag.assigned {
    background: rgba(168, 85, 247, 0.15);
    color: #c084fc;
}

.notif-item-tag.handover {
    background: rgba(6, 182, 212, 0.15);
    color: #22d3ee;
}

.notif-item-tag.sla {
    background: rgba(245, 158, 11, 0.15);
    color: #fbbf24;
}

.notif-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #38bdf8;
    box-shadow: 0 0 6px #38bdf8;
    flex-shrink: 0;
    margin-top: 6px;
}

.notif-panel-footer {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    font-size: 0.75rem;
    color: #94a3b8;
    background: rgba(0, 0, 0, 0.2);
}

/* 8. Tablet & iPad Scaling & Responsive Optimization (769px to 1050px) */
@media (min-width: 769px) {
    .notif-dropdown-panel {
        top: 68px;
        left: 78px;
        right: auto;
        width: 380px;
    }
}

@media (min-width: 769px) and (max-width: 1050px) {
    /* Tablet layout grid */
    .app-container {
        grid-template-columns: 66px 290px 1fr 0px !important;
        height: 100vh !important;
        height: 100dvh !important;
    }
    .app-container.info-collapsed {
        grid-template-columns: 66px 290px 1fr 0px !important;
    }

    /* Tablet Touch Targets */
    .nav-item {
        min-height: 44px;
    }

    .chat-tabs .chat-tab {
        padding: 8px 10px;
        font-size: 0.85rem;
    }

    .customer-item {
        padding: 12px 14px !important;
    }

    /* Tablet Chat Header Actions */
    .chat-header {
        padding: 0 16px !important;
    }
    .chat-header-actions {
        display: flex !important;
        align-items: center;
        gap: 6px;
        flex-shrink: 0;
    }
    .chat-header-actions button {
        padding: 6px 10px !important;
        font-size: 0.82rem !important;
    }

    /* Smooth touch scrolling */
    .customer-list, .chat-messages {
        -webkit-overflow-scrolling: touch;
    }

    /* Tablet Customer Info Overlay */
    .app-container:not(.info-collapsed) .info-panel {
        position: fixed !important;
        right: 0 !important;
        top: 0 !important;
        width: 360px !important;
        max-width: 90vw !important;
        height: 100vh !important;
        height: 100dvh !important;
        z-index: 500 !important;
        box-shadow: -12px 0 35px rgba(0, 0, 0, 0.5) !important;
        display: flex !important;
    }
}

/* 9. Live App Version Update Floating Banner */
.app-update-floating-banner {
    position: fixed;
    top: calc(14px + var(--safe-top, 0px));
    left: 50%;
    transform: translateX(-50%);
    width: calc(100% - 24px);
    max-width: 440px;
    z-index: 99999;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(56, 189, 248, 0.4);
    border-radius: 16px;
    padding: 10px 14px;
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.7), 0 0 20px rgba(56, 189, 248, 0.2);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    animation: updateBannerSlideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    box-sizing: border-box;
}

@keyframes updateBannerSlideIn {
    from {
        opacity: 0;
        transform: translate(-50%, -20px) scale(0.96);
    }
    to {
        opacity: 1;
        transform: translate(-50%, 0) scale(1);
    }
}

@keyframes updateBannerSlideOut {
    from {
        opacity: 1;
        transform: translate(-50%, 0) scale(1);
    }
    to {
        opacity: 0;
        transform: translate(-50%, -20px) scale(0.96);
    }
}

.update-banner-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: rgba(56, 189, 248, 0.15);
    color: #38bdf8;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.update-banner-text {
    flex: 1;
    min-width: 0;
}

.update-banner-title {
    font-size: 0.88rem;
    font-weight: 700;
    color: #ffffff;
    line-height: 1.25;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.update-banner-desc {
    font-size: 0.74rem;
    color: #94a3b8;
    margin-top: 1px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.update-banner-buttons {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.btn-update-apply {
    background: linear-gradient(135deg, #0284c7, #38bdf8);
    color: #ffffff;
    border: none;
    border-radius: 10px;
    padding: 7px 14px;
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(56, 189, 248, 0.35);
    transition: all 0.15s ease;
    white-space: nowrap;
}

.btn-update-apply:active {
    transform: scale(0.95);
    opacity: 0.9;
}

.btn-update-close {
    background: transparent;
    border: none;
    color: #64748b;
    font-size: 1rem;
    cursor: pointer;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: color 0.15s ease;
}

.btn-update-close:active {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.08);
}

/* ==========================================================================
   iOS Native Proportions (Apple HIG Standard: 44px Navigation Bar)
   Strictly targets iOS devices (Safari / WebClip / PWA) via @supports & html.is-ios
   Leaves Android completely untouched!
   ========================================================================== */
@supports (-webkit-touch-callout: none) {
    @media (max-width: 768px) {
        .mobile-top-bar {
            height: calc(44px + env(safe-area-inset-top, 0px)) !important;
            padding-top: env(safe-area-inset-top, 0px) !important;
            padding-bottom: 0 !important;
            padding-left: calc(12px + env(safe-area-inset-left, 0px)) !important;
            padding-right: calc(12px + env(safe-area-inset-right, 0px)) !important;
            box-sizing: border-box !important;
        }

        .mobile-top-bar > div {
            height: 44px !important;
        }

        .mobile-top-bar .mobile-drawer-btn,
        .mobile-top-bar .mobile-top-icon-btn {
            width: 36px !important;
            height: 36px !important;
            display: flex !important;
            align-items: center !important;
            justify-content: center !important;
            padding: 0 !important;
            font-size: 1.15rem !important;
        }

        .mobile-top-bar .mobile-brand img {
            height: 28px !important;
            width: auto !important;
            object-fit: contain !important;
        }

        .mobile-top-bar .mobile-top-profile {
            width: 30px !important;
            height: 30px !important;
            min-width: 30px !important;
        }

        .chat-list-panel {
            top: calc(44px + env(safe-area-inset-top, 0px)) !important;
            height: calc(100dvh - 44px - env(safe-area-inset-top, 0px)) !important;
        }

        .chat-list-panel .panel-header {
            padding: 8px 12px 6px 12px !important;
        }

        .chat-list-panel .search-box input {
            padding: 8px 12px 8px 34px !important;
            height: 36px !important;
            font-size: 0.88rem !important;
            border-radius: 10px !important;
        }

        .chat-list-panel .search-box button#btnChatFilter {
            height: 36px !important;
            width: 36px !important;
            border-radius: 10px !important;
        }

        .chat-tabs {
            padding: 2px 8px 6px 8px !important;
            gap: 6px !important;
        }

        .chat-tab {
            padding: 6px 10px !important;
            font-size: 0.82rem !important;
            border-radius: 8px !important;
        }

        .chat-header {
            height: calc(44px + env(safe-area-inset-top, 0px)) !important;
            padding-top: env(safe-area-inset-top, 0px) !important;
            padding-bottom: 0 !important;
            padding-left: calc(8px + env(safe-area-inset-left, 0px)) !important;
            padding-right: calc(8px + env(safe-area-inset-right, 0px)) !important;
            box-sizing: border-box !important;
        }

        .chat-header .avatar {
            width: 32px !important;
            height: 32px !important;
            min-width: 32px !important;
        }

        .mobile-back-btn {
            width: 32px !important;
            height: 32px !important;
            min-width: 32px !important;
            font-size: 1.1rem !important;
        }

        .chat-header-actions button {
            width: 32px !important;
            height: 32px !important;
            min-width: 32px !important;
            border-radius: 8px !important;
        }

        .notif-dropdown-panel {
            top: calc(48px + env(safe-area-inset-top, 0px)) !important;
        }

        .order-detail-popup {
            top: calc(50px + env(safe-area-inset-top, 0px)) !important;
        }

        .nav-sidebar {
            padding-top: calc(16px + env(safe-area-inset-top, 0px)) !important;
            padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px)) !important;
        }
    }
}

html.is-ios:not(.is-android) {
    @media (max-width: 768px) {
        .mobile-top-bar {
            height: calc(44px + env(safe-area-inset-top, 0px)) !important;
            padding-top: env(safe-area-inset-top, 0px) !important;
            padding-bottom: 0 !important;
            padding-left: calc(12px + env(safe-area-inset-left, 0px)) !important;
            padding-right: calc(12px + env(safe-area-inset-right, 0px)) !important;
            box-sizing: border-box !important;
        }

        .mobile-top-bar > div {
            height: 44px !important;
        }

        .mobile-top-bar .mobile-drawer-btn,
        .mobile-top-bar .mobile-top-icon-btn {
            width: 36px !important;
            height: 36px !important;
            display: flex !important;
            align-items: center !important;
            justify-content: center !important;
            padding: 0 !important;
            font-size: 1.15rem !important;
        }

        .mobile-top-bar .mobile-brand img {
            height: 28px !important;
            width: auto !important;
            object-fit: contain !important;
        }

        .mobile-top-bar .mobile-top-profile {
            width: 30px !important;
            height: 30px !important;
            min-width: 30px !important;
        }

        .chat-list-panel {
            top: calc(44px + env(safe-area-inset-top, 0px)) !important;
            height: calc(100dvh - 44px - env(safe-area-inset-top, 0px)) !important;
        }

        .chat-list-panel .panel-header {
            padding: 8px 12px 6px 12px !important;
        }

        .chat-list-panel .search-box input {
            padding: 8px 12px 8px 34px !important;
            height: 36px !important;
            font-size: 0.88rem !important;
            border-radius: 10px !important;
        }

        .chat-list-panel .search-box button#btnChatFilter {
            height: 36px !important;
            width: 36px !important;
            border-radius: 10px !important;
        }

        .chat-tabs {
            padding: 2px 8px 6px 8px !important;
            gap: 6px !important;
        }

        .chat-tab {
            padding: 6px 10px !important;
            font-size: 0.82rem !important;
            border-radius: 8px !important;
        }

        .chat-header {
            height: calc(44px + env(safe-area-inset-top, 0px)) !important;
            padding-top: env(safe-area-inset-top, 0px) !important;
            padding-bottom: 0 !important;
            padding-left: calc(8px + env(safe-area-inset-left, 0px)) !important;
            padding-right: calc(8px + env(safe-area-inset-right, 0px)) !important;
            box-sizing: border-box !important;
        }

        .chat-header .avatar {
            width: 32px !important;
            height: 32px !important;
            min-width: 32px !important;
        }

        .mobile-back-btn {
            width: 32px !important;
            height: 32px !important;
            min-width: 32px !important;
            font-size: 1.1rem !important;
        }

        .chat-header-actions button {
            width: 32px !important;
            height: 32px !important;
            min-width: 32px !important;
            border-radius: 8px !important;
        }

        .notif-dropdown-panel {
            top: calc(48px + env(safe-area-inset-top, 0px)) !important;
        }

        .order-detail-popup {
            top: calc(50px + env(safe-area-inset-top, 0px)) !important;
        }

        .nav-sidebar {
            padding-top: calc(16px + env(safe-area-inset-top, 0px)) !important;
            padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px)) !important;
        }
    }
}