/* ============================================================
   KANUPAPA - CONTACT CHAT & MEDIA VIEWER (chat.css)
   WhatsApp conversation stream, attachments, photo viewer & zoom
   ============================================================ */

.btn-category-select {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    user-select: none;
}

.btn-category-select.active {
    border-color: #10b981 !important;
    background: rgba(16, 185, 129, 0.22) !important;
    color: #34d399 !important;
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.25);
}

.profile-actions-grid {
    display: flex;
    gap: 8px;
    width: 100%;
}

.profile-action-btn {
    flex: 1;
    padding: 10px 6px;
    font-size: 0.85rem;
    font-weight: 700;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    cursor: pointer;
}

/* ========================================================
   STRICT 3-TIER INDEPENDENT UI ARCHITECTURE
   Tier 1: Mobile Phone (role-mobile / screen <= 768px)
   Tier 2: Desktop / Laptop (role-desktop / screen >= 769px)
   Tier 3: Smart TV (role-tv / 10-foot remote D-pad)
   ======================================================== */

/* --------------------------------------------------------
   COMMON DEFAULTS (Overridden per tier below)
   -------------------------------------------------------- */
.desktop-header-user-group {
    display: none;
    align-items: center;
    gap: 8px;
}
.desktop-logout-btn {
    display: none !important;
}
.desktop-subbars-banner {
    display: none;
}
.desktop-sidebar-search-box {
    display: none;
}
.profile-avatar-wrapper {
    display: none;
}
.main-workspace-container {
    width: 100%;
    height: 100%;
    position: relative;
    overflow: hidden;
}
.workspace-body-split {
    width: 100%;
    height: 100%;
}
.desktop-stage-area {
    width: 100%;
    height: 100%;
}

/* ========================================================
   TIER 1: MOBILE PHONE UI (Screen <= 768px OR body.role-mobile)
   WhatsApp Mobile full-screen experience
   ======================================================== */
@media (max-width: 768px) {
    /* Mobile Top Bar */
    .top-bar {
        padding: 0 12px !important;
        height: 56px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
        background: #111b21 !important;
        border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
    }

    .topbar-default-view {
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
        width: 100% !important;
    }

    .logo {
        display: flex !important;
        align-items: center !important;
        gap: 6px !important;
    }

    .logo-img {
        display: inline-block !important;
        height: 32px !important;
        width: 32px !important;
        border-radius: 8px !important;
        object-fit: contain !important;
    }

    .nav-back-btn,
    #btn-nav-back {
        display: none !important;
    }

    .logo-text {
        font-size: 1.35rem !important;
        font-weight: 700 !important;
        color: #f8fafc !important;
        letter-spacing: 0.3px;
    }

    #btn-admin-portal,
    #btn-open-account,
    #lang-selector,
    .desktop-header-user-group,
    .profile-avatar-wrapper,
    .desktop-logout-btn,
    #desktop-subbars-banner,
    .desktop-sidebar-search-box,
    #desktop-empty-stage {
        display: none !important;
    }

    .top-bar-actions {
        display: flex !important;
        align-items: center !important;
        gap: 4px !important;
    }

    #btn-mobile-menu-toggle {
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        font-size: 1.5rem !important;
        font-weight: 700 !important;
        color: #f8fafc !important;
        background: transparent !important;
        border: none !important;
        cursor: pointer !important;
        padding: 4px 8px !important;
        line-height: 1 !important;
    }

    #btn-mobile-search-toggle {
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        font-size: 1.15rem !important;
        color: #cbd5e1 !important;
        background: transparent !important;
        border: none !important;
        cursor: pointer !important;
        padding: 4px 8px !important;
    }

    /* Workspace container flattens so mobile views are direct full-screen pages */
    .main-workspace-container {
        width: 100% !important;
        height: calc(100vh - 56px) !important;
        display: block !important;
        position: relative !important;
        overflow: hidden !important;
        padding: 0 !important;
        margin: 0 !important;
    }

    .workspace-body-split {
        display: contents !important;
    }

    .desktop-stage-area {
        display: contents !important;
    }

    /* Contacts View on Mobile: 100% full screen WhatsApp List */
    #contacts-view.contacts-view-pane {
        width: 100% !important;
        max-width: 100% !important;
        height: 100% !important;
        padding: 0 !important;
        margin: 0 !important;
        background: #0b141a !important;
        border: none !important;
        box-shadow: none !important;
        display: flex !important;
        flex-direction: column !important;
        position: relative !important;
    }

    #contacts-view.hidden {
        display: none !important;
    }

    .unified-panel-header,
    .chat-panel,
    #tv-desktop-sections {
        display: none !important;
    }

    /* Mobile Single-row Dropdown + Business Directory button */
    .mobile-search-section {
        display: flex !important;
        padding: 8px 12px !important;
        background: #111b21 !important;
        border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
        flex-shrink: 0 !important;
    }

    .mobile-filter-bar {
        display: flex !important;
        align-items: center !important;
        gap: 8px !important;
        width: 100% !important;
    }

    .mobile-filter-select-wrap {
        position: relative !important;
        flex: 1 !important;
    }

    .mobile-filter-dropdown {
        width: 100% !important;
        background: #202c33 !important;
        color: #e9edef !important;
        border: 1px solid rgba(255, 255, 255, 0.12) !important;
        border-radius: 8px !important;
        padding: 8px 28px 8px 12px !important;
        font-size: 0.88rem !important;
        font-weight: 500 !important;
        outline: none !important;
        appearance: none !important;
        -webkit-appearance: none !important;
    }

    .mobile-dropdown-chevron {
        position: absolute !important;
        right: 10px !important;
        top: 50% !important;
        transform: translateY(-50%) !important;
        pointer-events: none !important;
        color: #8696a0 !important;
        font-size: 0.8rem !important;
    }

    .btn-directory-tab {
        padding: 8px 12px !important;
        font-size: 0.82rem !important;
        white-space: nowrap !important;
        border-radius: 8px !important;
        background: rgba(56, 189, 248, 0.1) !important;
        border: 1px solid rgba(56, 189, 248, 0.25) !important;
        color: #38bdf8 !important;
        font-weight: 600 !important;
        cursor: pointer !important;
    }

    .btn-directory-tab.active {
        background: #0284c7 !important;
        border-color: #38bdf8 !important;
        color: #ffffff !important;
    }

    /* Contacts List on Mobile (1 Person = 1 Row) */
    .unified-mobile-list {
        display: flex !important;
        flex-direction: column !important;
        flex: 1 !important;
        width: 100% !important;
        overflow-y: auto !important;
        padding: 4px 0 80px 0 !important;
        background: #0b141a !important;
    }

    /* Mobile Floating Action Buttons */
    .fab-btn {
        display: flex !important;
        position: fixed !important;
        bottom: 22px !important;
        right: 18px !important;
        width: 56px !important;
        height: 56px !important;
        border-radius: 50% !important;
        background: #00a884 !important;
        color: #ffffff !important;
        align-items: center !important;
        justify-content: center !important;
        font-size: 1.4rem !important;
        box-shadow: 0 4px 16px rgba(0, 168, 132, 0.45) !important;
        border: none !important;
        cursor: pointer !important;
        z-index: 100 !important;
        transition: transform 0.2s ease !important;
    }

    .fab-btn:active {
        transform: scale(0.92) !important;
    }

    .btn-mobile-bottom-library {
        display: flex !important;
        position: fixed !important;
        bottom: 22px !important;
        left: 18px !important;
        padding: 10px 16px !important;
        border-radius: 28px !important;
        background: rgba(15, 23, 42, 0.92) !important;
        backdrop-filter: blur(8px) !important;
        border: 1px solid rgba(56, 189, 248, 0.4) !important;
        color: #38bdf8 !important;
        align-items: center !important;
        gap: 8px !important;
        font-size: 0.88rem !important;
        font-weight: 600 !important;
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4) !important;
        cursor: pointer !important;
        z-index: 100 !important;
        transition: transform 0.2s ease !important;
    }

    .btn-mobile-bottom-library:active {
        transform: scale(0.95) !important;
    }

    /* Full-Screen Chat View on Mobile (STRICT: only visible when in-chat-view and NOT hidden) */
    body.in-chat-view .top-bar {
        display: none !important;
    }

    body.in-chat-view #view-contact-chat:not(.hidden),
    body.in-chat-view .contact-chat-view:not(.hidden) {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        width: 100vw !important;
        height: 100vh !important;
        max-width: 100vw !important;
        z-index: 9999 !important;
        background: #0b141a !important;
        display: flex !important;
        flex-direction: column !important;
    }

    #view-contact-chat.hidden,
    .contact-chat-view.hidden,
    body:not(.in-chat-view) #view-contact-chat,
    body:not(.in-chat-view) .contact-chat-view {
        display: none !important;
    }

    .btn-chat-back {
        display: flex !important;
    }

    /* Full-Screen Directory & Library Sections on Mobile */
    #directory-section,
    #library-section {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        width: 100vw !important;
        height: 100vh !important;
        z-index: 9999 !important;
        background: #0b141a !important;
        overflow-y: auto !important;
        padding: 16px 12px 60px 12px !important;
        box-sizing: border-box !important;
        display: block !important;
    }

    #directory-section.hidden,
    #library-section.hidden {
        display: none !important;
    }
}

/* Explicit body.role-mobile (covers mobile devices in landscape / tablet widths) */
body.role-mobile .top-bar {
    padding: 0 12px !important;
    height: 56px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    background: #111b21 !important;
}
body.role-mobile .logo {
    display: flex !important;
    align-items: center !important;
    gap: 6px !important;
}
body.role-mobile .logo-img {
    display: inline-block !important;
    height: 32px !important;
    width: 32px !important;
    border-radius: 8px !important;
    object-fit: contain !important;
}
body.role-mobile .nav-back-btn,
body.role-mobile #btn-nav-back {
    display: none !important;
}
body.role-mobile .logo-text {
    font-size: 1.35rem !important;
    font-weight: 700 !important;
}
body.role-mobile #btn-admin-portal,
body.role-mobile #btn-open-account,
body.role-mobile #lang-selector,
body.role-mobile .desktop-header-user-group,
body.role-mobile .profile-avatar-wrapper,
body.role-mobile .desktop-logout-btn,
body.role-mobile #desktop-subbars-banner,
body.role-mobile .desktop-sidebar-search-box,
body.role-mobile #desktop-empty-stage {
    display: none !important;
}
body.role-mobile #btn-mobile-menu-toggle {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 1.5rem !important;
    font-weight: 700 !important;
    color: #f8fafc !important;
    background: transparent !important;
    border: none !important;
    cursor: pointer !important;
    padding: 4px 8px !important;
}
body.role-mobile #btn-mobile-search-toggle {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 1.15rem !important;
    color: #cbd5e1 !important;
    background: transparent !important;
    border: none !important;
    cursor: pointer !important;
    padding: 4px 8px !important;
}
body.role-mobile .main-workspace-container {
    width: 100% !important;
    height: calc(100vh - 56px) !important;
    display: block !important;
    position: relative !important;
    overflow: hidden !important;
}
body.role-mobile .workspace-body-split {
    display: contents !important;
}
body.role-mobile .desktop-stage-area {
    display: contents !important;
}
body.role-mobile #contacts-view.contacts-view-pane {
    width: 100% !important;
    max-width: 100% !important;
    height: 100% !important;
    background: #0b141a !important;
    border: none !important;
    display: flex !important;
    flex-direction: column !important;
}
body.role-mobile #contacts-view.hidden {
    display: none !important;
}
body.role-mobile .mobile-search-section {
    display: flex !important;
}
body.role-mobile .unified-mobile-list {
    display: flex !important;
}
body.role-mobile .fab-btn {
    display: flex !important;
}
body.role-mobile .btn-mobile-bottom-library {
    display: flex !important;
}
body.role-mobile.in-chat-view .top-bar {
    display: none !important;
}
body.role-mobile.in-chat-view #view-contact-chat:not(.hidden) {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 9999 !important;
    background: #0b141a !important;
    display: flex !important;
    flex-direction: column !important;
}
body.role-mobile:not(.in-chat-view) #view-contact-chat,
body.role-mobile #view-contact-chat.hidden,
body.role-mobile .contact-chat-view.hidden {
    display: none !important;
}
body.role-mobile .btn-chat-back {
    display: flex !important;
}

/* ========================================================
   TIER 2: DESKTOP / LAPTOP / WEB BROWSER UI
   (@media min-width: 769px & body:not(.role-mobile):not(.role-tv))
   WhatsApp Desktop 2-Pane Split Architecture
   ======================================================== */
@media (min-width: 769px) {
    /* Hide mobile-only elements */
    #mobile-search-section,
    #btn-fab-add-contact,
    #btn-mobile-bottom-library,
    .mobile-only-btn,
    .btn-chat-back {
        display: none !important;
    }

    .top-bar {
        padding: 0 16px !important;
        height: 58px !important;
        background: #111b21 !important;
        border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
        display: flex !important;
    }

    .top-bar-actions {
        display: flex !important;
        align-items: center !important;
        gap: 10px !important;
    }

    .desktop-header-user-group {
        display: flex !important;
    }

    .desktop-logout-btn,
    #btn-admin-portal,
    #btn-open-account,
    #active-account-chip {
        display: none !important;
    }

    #btn-mobile-search-toggle,
    #btn-mobile-menu-toggle {
        display: none !important;
    }

    /* Google Profile Avatar & Dropdown Flyout */
    .profile-avatar-wrapper {
        position: relative !important;
        display: inline-flex !important;
        align-items: center !important;
    }

    .topbar-profile-btn {
        width: 38px !important;
        height: 38px !important;
        border-radius: 50% !important;
        background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%) !important;
        border: 2px solid rgba(255, 255, 255, 0.25) !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        cursor: pointer !important;
        padding: 0 !important;
        margin: 0 !important;
        transition: all 0.2s ease !important;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3) !important;
        outline: none !important;
    }

    .topbar-profile-btn:hover,
    .topbar-profile-btn:focus-visible {
        border-color: #38bdf8 !important;
        transform: scale(1.05) !important;
        box-shadow: 0 0 12px rgba(56, 189, 248, 0.5) !important;
    }

    .topbar-profile-avatar-circle {
        width: 100% !important;
        height: 100% !important;
        border-radius: 50% !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        font-size: 16px !important;
        font-weight: 700 !important;
        color: #ffffff !important;
        overflow: hidden !important;
        user-select: none !important;
    }

    .topbar-profile-avatar-circle img {
        width: 100% !important;
        height: 100% !important;
        object-fit: cover !important;
        border-radius: 50% !important;
    }

    .google-profile-dropdown {
        position: absolute !important;
        top: calc(100% + 10px) !important;
        right: 0 !important;
        width: 330px !important;
        background: #182229 !important;
        border: 1px solid rgba(255, 255, 255, 0.12) !important;
        border-radius: 18px !important;
        box-shadow: 0 16px 40px rgba(0, 0, 0, 0.65), 0 0 0 1px rgba(255, 255, 255, 0.05) !important;
        padding: 16px !important;
        z-index: 10000 !important;
        display: flex !important;
        flex-direction: column !important;
        gap: 12px !important;
        backdrop-filter: blur(12px) !important;
        animation: profileDropdownFade 0.18s ease-out !important;
    }

    .google-profile-dropdown.hidden {
        display: none !important;
    }

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

    .profile-dropdown-card {
        background: rgba(255, 255, 255, 0.04) !important;
        border: 1px solid rgba(255, 255, 255, 0.06) !important;
        border-radius: 14px !important;
        padding: 14px !important;
        display: flex !important;
        flex-direction: column !important;
        gap: 10px !important;
    }

    .profile-dropdown-header {
        display: flex !important;
        align-items: center !important;
        gap: 12px !important;
    }

    .profile-dropdown-avatar-circle {
        width: 52px !important;
        height: 52px !important;
        min-width: 52px !important;
        border-radius: 50% !important;
        background: linear-gradient(135deg, #4f46e5 0%, #2563eb 100%) !important;
        border: 2px solid rgba(255, 255, 255, 0.2) !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        font-size: 22px !important;
        font-weight: 700 !important;
        color: #ffffff !important;
        overflow: hidden !important;
    }

    .profile-dropdown-avatar-circle img {
        width: 100% !important;
        height: 100% !important;
        object-fit: cover !important;
        border-radius: 50% !important;
    }

    .profile-dropdown-user-details {
        display: flex !important;
        flex-direction: column !important;
        gap: 3px !important;
        overflow: hidden !important;
    }

    .profile-dropdown-name {
        font-size: 0.98rem !important;
        font-weight: 700 !important;
        color: #f8fafc !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
    }

    .profile-dropdown-email {
        font-size: 0.82rem !important;
        color: #94a3b8 !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
    }

    .profile-dropdown-id-row {
        margin-top: 2px !important;
    }

    .profile-dropdown-kpid {
        display: inline-block !important;
        background: rgba(99, 102, 241, 0.2) !important;
        border: 1px solid rgba(99, 102, 241, 0.4) !important;
        color: #a5b4fc !important;
        font-family: monospace !important;
        font-size: 11px !important;
        font-weight: 700 !important;
        padding: 2px 7px !important;
        border-radius: 5px !important;
        letter-spacing: 0.5px !important;
    }

    .profile-dropdown-device-row {
        display: flex !important;
        align-items: center !important;
        gap: 6px !important;
        padding-top: 8px !important;
        border-top: 1px solid rgba(255, 255, 255, 0.06) !important;
        font-size: 0.8rem !important;
        color: #cbd5e1 !important;
    }

    .profile-dropdown-device-label {
        color: #94a3b8 !important;
        font-weight: 500 !important;
    }

    .profile-dropdown-device-text {
        font-weight: 600 !important;
        color: #e2e8f0 !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        flex: 1 !important;
    }

    .btn-icon-rename {
        background: transparent !important;
        border: none !important;
        color: #38bdf8 !important;
        cursor: pointer !important;
        font-size: 13px !important;
        padding: 2px 4px !important;
        border-radius: 4px !important;
        transition: background 0.15s !important;
    }

    .btn-icon-rename:hover {
        background: rgba(56, 189, 248, 0.15) !important;
    }

    .profile-dropdown-actions {
        display: flex !important;
        flex-direction: column !important;
        gap: 4px !important;
    }

    .profile-dropdown-btn {
        display: flex !important;
        align-items: center !important;
        gap: 12px !important;
        width: 100% !important;
        padding: 9px 12px !important;
        border-radius: 10px !important;
        background: transparent !important;
        border: none !important;
        cursor: pointer !important;
        text-align: left !important;
        transition: background 0.15s ease !important;
        color: #f1f5f9 !important;
    }

    .profile-dropdown-btn:hover {
        background: rgba(255, 255, 255, 0.07) !important;
    }

    .profile-dropdown-btn.admin-btn {
        background: rgba(239, 68, 68, 0.08) !important;
        border: 1px solid rgba(239, 68, 68, 0.2) !important;
    }

    .profile-dropdown-btn.admin-btn:hover {
        background: rgba(239, 68, 68, 0.18) !important;
        border-color: rgba(239, 68, 68, 0.4) !important;
    }

    .profile-dropdown-icon {
        font-size: 18px !important;
        width: 24px !important;
        text-align: center !important;
        flex-shrink: 0 !important;
    }

    .profile-dropdown-text {
        display: flex !important;
        flex-direction: column !important;
        gap: 1px !important;
        overflow: hidden !important;
    }

    .profile-dropdown-title {
        font-size: 0.88rem !important;
        font-weight: 600 !important;
        color: #f8fafc !important;
    }

    .profile-dropdown-sub {
        font-size: 0.75rem !important;
        color: #94a3b8 !important;
    }

    .profile-dropdown-footer {
        padding-top: 8px !important;
        border-top: 1px solid rgba(255, 255, 255, 0.08) !important;
    }

    .profile-dropdown-logout-btn {
        width: 100% !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 8px !important;
        padding: 8px 14px !important;
        border-radius: 9px !important;
        background: rgba(239, 68, 68, 0.15) !important;
        border: 1px solid rgba(239, 68, 68, 0.35) !important;
        color: #fca5a5 !important;
        font-weight: 600 !important;
        font-size: 0.88rem !important;
        cursor: pointer !important;
        transition: all 0.15s ease !important;
    }

    .profile-dropdown-logout-btn:hover {
        background: rgba(239, 68, 68, 0.28) !important;
        border-color: rgba(239, 68, 68, 0.5) !important;
        color: #fee2e2 !important;
    }

    /* Horizontal Sub-Bars Banner directly below top header */
    .desktop-subbars-banner {
        display: flex !important;
        flex-direction: column !important;
        gap: 6px !important;
        padding: 8px 16px !important;
        background: #182229 !important;
        border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
        flex-shrink: 0 !important;
    }

    .subbar-row {
        display: flex !important;
        align-items: center !important;
        gap: 8px !important;
        flex-wrap: wrap !important;
    }

    .subbar-row-filters .filter-pill {
        padding: 5px 14px !important;
        font-size: 0.85rem !important;
        font-weight: 500 !important;
        border-radius: 16px !important;
        background: rgba(255, 255, 255, 0.06) !important;
        border: 1px solid rgba(255, 255, 255, 0.12) !important;
        color: #cbd5e1 !important;
        cursor: pointer !important;
        transition: all 0.15s ease !important;
    }

    .subbar-row-filters .filter-pill:hover {
        background: rgba(255, 255, 255, 0.12) !important;
        color: #ffffff !important;
    }

    .subbar-row-filters .filter-pill.active {
        background: #00a884 !important;
        border-color: #00a884 !important;
        color: #111b21 !important;
        font-weight: 700 !important;
        box-shadow: 0 0 10px rgba(0, 168, 132, 0.3) !important;
    }

    .subbar-row-features .filter-pill {
        padding: 5px 14px !important;
        font-size: 0.85rem !important;
        font-weight: 600 !important;
        border-radius: 8px !important;
        background: rgba(56, 189, 248, 0.08) !important;
        border: 1px solid rgba(56, 189, 248, 0.25) !important;
        color: #7dd3fc !important;
        cursor: pointer !important;
        transition: all 0.15s ease !important;
    }

    .subbar-row-features .filter-pill:hover {
        background: rgba(56, 189, 248, 0.18) !important;
        border-color: #38bdf8 !important;
        color: #ffffff !important;
    }

    .subbar-row-features .filter-pill.active {
        background: #0284c7 !important;
        border-color: #38bdf8 !important;
        color: #ffffff !important;
        box-shadow: 0 0 12px rgba(56, 189, 248, 0.35) !important;
    }

    /* Main Desktop Workspace Container */
    .main-workspace-container {
        display: flex !important;
        flex-direction: column !important;
        height: calc(100vh - 58px) !important;
        overflow: hidden !important;
        width: 100% !important;
    }

    /* 2-Pane Split: Left Sidebar + Right Main Stage */
    .workspace-body-split {
        display: flex !important;
        flex-direction: row !important;
        flex: 1 !important;
        height: 100% !important;
        overflow: hidden !important;
        width: 100% !important;
    }

    /* Left Column: WhatsApp-style Contacts Sidebar */
    #contacts-view.contacts-view-pane {
        width: 380px !important;
        min-width: 320px !important;
        max-width: 420px !important;
        height: 100% !important;
        display: flex !important;
        flex-direction: column !important;
        background: #111b21 !important;
        border-right: 1px solid rgba(255, 255, 255, 0.08) !important;
        overflow: hidden !important;
        flex-shrink: 0 !important;
        position: relative !important;
        padding: 0 !important;
        margin: 0 !important;
    }

    #contacts-view.contacts-view-pane.hidden {
        display: flex !important; /* Sidebar stays visible on desktop */
    }

    .desktop-sidebar-search-box {
        display: flex !important;
        align-items: center !important;
        gap: 8px !important;
        padding: 10px 14px !important;
        background: #111b21 !important;
        border-bottom: 1px solid rgba(255, 255, 255, 0.06) !important;
        flex-shrink: 0 !important;
    }

    .sidebar-search-icon {
        color: #8696a0;
        font-size: 0.95rem;
    }

    .sidebar-search-input {
        flex: 1 !important;
        background: #202c33 !important;
        border: 1px solid rgba(255, 255, 255, 0.08) !important;
        border-radius: 8px !important;
        padding: 8px 12px !important;
        color: #e9edef !important;
        font-size: 0.9rem !important;
        outline: none !important;
    }

    .sidebar-search-input:focus {
        border-color: #00a884 !important;
    }

    .contacts-view-pane .unified-mobile-list {
        flex: 1 !important;
        max-height: none !important;
        overflow-y: auto !important;
        background: #111b21 !important;
        padding: 4px 0 !important;
    }

    /* Right Column: Desktop Main Stage Area */
    .desktop-stage-area {
        flex: 1 !important;
        height: 100% !important;
        display: flex !important;
        flex-direction: column !important;
        background: #0b141a !important;
        overflow: hidden !important;
        position: relative !important;
    }

    .desktop-empty-stage {
        flex: 1 !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        padding: 40px !important;
        text-align: center !important;
        background: radial-gradient(circle at center, #111b21 0%, #0b141a 100%) !important;
    }

    .desktop-empty-stage.hidden {
        display: none !important;
    }

    .empty-stage-card {
        max-width: 560px !important;
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        gap: 16px !important;
    }

    .empty-stage-logo {
        width: 88px !important;
        height: 88px !important;
        border-radius: 22px !important;
        box-shadow: 0 8px 28px rgba(0, 168, 132, 0.25) !important;
    }

    .empty-stage-title {
        color: #e9edef !important;
        font-size: 1.7rem !important;
        font-weight: 700 !important;
        margin: 0 !important;
    }

    .empty-stage-desc {
        color: #8696a0 !important;
        font-size: 0.96rem !important;
        line-height: 1.5 !important;
        margin: 0 !important;
    }

    .empty-stage-features-grid {
        display: grid !important;
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 12px !important;
        width: 100% !important;
        margin-top: 8px !important;
    }

    .empty-stage-feat {
        background: rgba(255, 255, 255, 0.03) !important;
        border: 1px solid rgba(255, 255, 255, 0.07) !important;
        border-radius: 12px !important;
        padding: 14px 10px !important;
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        gap: 4px !important;
        text-align: center !important;
    }

    .empty-stage-feat .feat-icon {
        font-size: 1.6rem !important;
        margin-bottom: 4px !important;
    }

    .empty-stage-feat .feat-title {
        color: #cbd5e1 !important;
        font-size: 0.85rem !important;
    }

    .empty-stage-feat .feat-sub {
        color: #64748b !important;
        font-size: 0.75rem !important;
    }

    .empty-stage-hint {
        color: #64748b !important;
        font-size: 0.82rem !important;
        margin-top: 8px !important;
    }

    /* Embedded sections inside right stage */
    .desktop-stage-area #directory-section,
    .desktop-stage-area #library-section {
        flex: 1 !important;
        height: 100% !important;
        max-height: 100% !important;
        overflow-y: auto !important;
        padding: 24px !important;
        box-sizing: border-box !important;
        background: #0b141a !important;
        display: block !important;
        position: relative !important;
    }

    .desktop-stage-area #directory-section.hidden,
    .desktop-stage-area #library-section.hidden,
    .desktop-stage-area #desktop-empty-stage.hidden,
    .desktop-stage-area #view-contact-chat.hidden {
        display: none !important;
    }

    .desktop-stage-area #view-contact-chat {
        flex: 1 !important;
        height: 100% !important;
        max-height: 100% !important;
        max-width: 100% !important;
        position: relative !important;
        margin: 0 !important;
        display: flex !important;
        flex-direction: column !important;
        background: #0b141a !important;
    }

    body.in-chat-view .top-bar {
        display: flex !important;
    }

    /* Active contact highlighting in sidebar (WhatsApp style) */
    .wa-contact-row.active-chat-contact {
        background: rgba(0, 168, 132, 0.16) !important;
        border-left: 4px solid #00a884 !important;
    }
}

/* ========================================================
   TIER 3: SMART TV UI (body.role-tv)
   Accessible D-Pad, Large Text, Clear Highlighting, Remote Nav
   ======================================================== */
body.role-tv .logo-img {
    display: inline-block !important;
}

body.role-tv .main-workspace-container {
    width: 100% !important;
    height: 100% !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    padding: 10px 24px !important;
    box-sizing: border-box !important;
    overflow-y: auto !important;
}

body.role-tv .desktop-subbars-banner,
body.role-tv #desktop-subbars-banner {
    display: none !important;
}

/* TV Remote D-Pad High-Visibility Glow Focus */
body.role-tv .tv-focused,
body.role-tv .tv-nav-tab.tv-focused,
body.role-tv .tv-nav-tab:focus,
body.role-tv .filter-pill.tv-focused,
body.role-tv .filter-pill:focus,
body.role-tv .feature-pill:focus,
body.role-tv .feature-pill.tv-focused,
body.role-tv .filter-pill.nav-item:focus,
body.role-tv .btn-shortcut:focus,
body.role-tv button.nav-item:focus,
body.role-tv .nav-item:focus,
body.role-tv .wa-contact-row.tv-focused,
body.role-tv .wa-contact-row:focus,
body.role-tv .contact-card.tv-focused,
body.role-tv .contact-card:focus {
    outline: 3px solid #38bdf8 !important;
    outline-offset: 3px !important;
    border: 2px solid #38bdf8 !important;
    background: rgba(56, 189, 248, 0.35) !important;
    box-shadow: 0 0 25px rgba(56, 189, 248, 0.9), 0 0 45px rgba(56, 189, 248, 0.5) !important;
    transform: scale(1.08) !important;
    color: #ffffff !important;
    z-index: 10 !important;
    transition: transform 0.15s ease, box-shadow 0.15s ease !important;
}

/* -------------------------------------------------------------
   SMART TV 5-TAB STREAMLINED HEADER NAVIGATION
------------------------------------------------------------- */
.tv-header-nav-bar {
    display: none;
    align-items: center;
    gap: 8px;
    margin-left: 10px;
}

body.role-tv .tv-header-nav-bar {
    display: flex !important;
}

body.role-tv #desktop-subbars-banner {
    display: none !important;
}

body.role-tv .desktop-header-user-group,
body.role-tv #btn-mobile-search-toggle,
body.role-tv #btn-app-logout,
body.role-tv .profile-avatar-wrapper,
body.role-tv #tv-tab-directory,
body.role-tv #directory-section,
body.role-tv .btn-directory-tab,
body.role-tv #btn-chat-biz-storefront {
    display: none !important;
}

body.role-tv .tv-nav-tab {
    background: rgba(30, 41, 59, 0.85);
    border: 1.5px solid rgba(56, 189, 248, 0.25);
    color: #f1f5f9;
    padding: 6px 14px;
    border-radius: 12px;
    font-size: 0.92rem;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

body.role-tv .tv-filter-select {
    appearance: none;
    -webkit-appearance: none;
    background-color: rgba(30, 41, 59, 0.95);
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2338bdf8' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 13px;
    padding-right: 28px;
    color: #38bdf8;
    border-color: rgba(56, 189, 248, 0.4);
}

body.role-tv .tv-tab-panchang {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.2), rgba(217, 119, 6, 0.3));
    border-color: rgba(245, 158, 11, 0.5);
    color: #fef08a;
}

body.role-tv .tv-tab-bhakti {
    background: linear-gradient(135deg, rgba(14, 165, 233, 0.2), rgba(6, 182, 212, 0.3));
    border-color: rgba(14, 165, 233, 0.5);
    color: #bae6fd;
}

/* Compact TV Language Selector: E / T */
body.role-tv #lang-selector {
    width: 44px !important;
    min-width: 44px !important;
    padding: 6px 2px !important;
    text-align: center !important;
    text-align-last: center !important;
    font-size: 1rem !important;
    font-weight: 800 !important;
    border-radius: 10px !important;
    border: 1.5px solid rgba(56, 189, 248, 0.4) !important;
    background: rgba(15, 23, 42, 0.85) !important;
    color: #38bdf8 !important;
    cursor: pointer !important;
}

body.role-tv .workspace-body-split {
    display: flex !important;
    justify-content: center !important;
    width: 100% !important;
}

body.role-tv #desktop-stage-area {
    display: contents !important;
}

body.role-tv #contacts-view.contacts-view-pane {
    width: 100% !important;
    max-width: 1100px !important;
    background: rgba(15, 23, 42, 0.9) !important;
    border: 1px solid rgba(56, 189, 248, 0.25) !important;
    border-radius: 18px !important;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6) !important;
    display: flex !important;
    flex-direction: column !important;
    padding: 14px 20px !important;
}

body.role-tv .mobile-search-section {
    display: none !important;
}

body.role-tv .unified-mobile-list {
    display: flex !important;
    max-height: 65vh !important;
}

body.role-tv .wa-contact-row {
    padding: 14px 18px !important;
    border-radius: 12px !important;
    margin: 4px 10px !important;
    border-bottom: none !important;
}

body.role-tv .wa-contact-row.nav-item:focus,
body.role-tv .wa-contact-row:focus {
    outline: none !important;
    border: 2px solid #38bdf8 !important;
    background: rgba(56, 189, 248, 0.2) !important;
    box-shadow: 0 0 20px rgba(56, 189, 248, 0.5) !important;
    transform: scale(1.01) !important;
}

body.role-tv .wa-contact-name {
    font-size: 1.15rem !important;
}

body.role-tv .chat-panel,
body.role-tv #tv-desktop-sections,
body.role-tv .desktop-sidebar-search-box,
body.role-tv #desktop-empty-stage,
body.role-tv .profile-avatar-wrapper,
body.role-tv .desktop-header-user-group,
body.role-tv .fab-btn,
body.role-tv .btn-mobile-bottom-library {
    display: none !important;
}

body.role-tv #lang-selector {
    display: inline-block !important;
}



/* ============================================================ */
/* WHATSAPP-STYLE CONTACT CONVERSATION STREAM & SLIDESHOW       */
/* ============================================================ */

/* Contact Chat View Base - Hidden by default unless active */
.contact-chat-view.hidden,
#view-contact-chat.hidden {
    display: none !important;
}

.contact-chat-view {
    height: 100%;
    width: 100%;
    background: #0b141a;
    position: relative;
    overflow: hidden;
}

@media (max-width: 768px) {
    body.in-chat-view #view-contact-chat:not(.hidden) {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        width: 100vw !important;
        height: 100vh !important;
        max-width: 100vw !important;
        z-index: 9999 !important;
        display: flex !important;
        flex-direction: column !important;
    }
    body:not(.in-chat-view) #view-contact-chat {
        display: none !important;
    }
}

@media (min-width: 769px) {
    body.in-chat-view .top-bar {
        display: flex !important;
    }
    .contact-chat-view {
        position: relative !important;
        width: 100% !important;
        height: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
    }
    .btn-chat-back {
        display: none !important;
    }
}

/* Chat Header */
.chat-header-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: #1f2c34;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
    z-index: 20;
    flex-shrink: 0;
    width: 100%;
    box-sizing: border-box;
}

.btn-chat-back {
    display: none !important;
}

.chat-header-user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
    cursor: pointer;
    user-select: none;
}

.chat-avatar-wrap {
    position: relative;
    width: 44px;
    height: 44px;
    flex-shrink: 0;
}

.chat-header-avatar {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: linear-gradient(135deg, #00a884, #008069);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    font-weight: 700;
    color: #ffffff;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.chat-header-avatar-img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.chat-presence-dot {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #64748b;
    border: 2px solid #1f2c34;
}

.chat-presence-dot.online {
    background: #25d366;
    box-shadow: 0 0 6px rgba(37, 211, 102, 0.7);
}

.chat-header-text-col {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.chat-header-name {
    font-size: 1.05rem;
    font-weight: 700;
    color: #e9edef;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-header-status {
    font-size: 0.75rem;
    color: #8696a0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.btn-chat-back {
    display: none !important;
}

.chat-header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.chat-action-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.chat-action-btn:active {
    transform: scale(0.92);
}

/* Audio Call: Vibrant Emerald Green */
.chat-action-btn.btn-chat-audio {
    background: rgba(34, 197, 94, 0.22) !important;
    border: 1.5px solid #22c55e !important;
    color: #4ade80 !important;
}

.chat-action-btn.btn-chat-audio:hover, .chat-action-btn.btn-chat-audio:focus {
    background: #16a34a !important;
    color: #ffffff !important;
    box-shadow: 0 0 12px rgba(34, 197, 94, 0.6) !important;
    transform: scale(1.08);
}

/* Video Call: Vibrant Sky Blue */
.chat-action-btn.btn-chat-video {
    background: rgba(59, 130, 246, 0.22) !important;
    border: 1.5px solid #3b82f6 !important;
    color: #60a5fa !important;
}

.chat-action-btn.btn-chat-video:hover, .chat-action-btn.btn-chat-video:focus {
    background: #2563eb !important;
    color: #ffffff !important;
    box-shadow: 0 0 12px rgba(59, 130, 246, 0.6) !important;
    transform: scale(1.08);
}

/* Photo Slideshow: Vibrant Amber Gold */
.chat-action-btn.btn-chat-slideshow {
    background: rgba(245, 158, 11, 0.22) !important;
    border: 1.5px solid #f59e0b !important;
    color: #fbbf24 !important;
}

.chat-action-btn.btn-chat-slideshow:hover, .chat-action-btn.btn-chat-slideshow:focus {
    background: #d97706 !important;
    color: #ffffff !important;
    box-shadow: 0 0 12px rgba(245, 158, 11, 0.6) !important;
    transform: scale(1.08);
}

/* Chat Messages Container */
.chat-messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 16px 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background-color: #0b141a;
    background-image: radial-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px);
    background-size: 24px 24px;
    scroll-behavior: smooth;
}

.spinner {
    display: inline-block;
    border-radius: 50%;
    border-style: solid;
    animation: kanupapaSpin 0.8s linear infinite;
}

@keyframes kanupapaSpin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.chat-loading-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 60vh;
    color: #94a3b8;
    gap: 12px;
}

.chat-empty-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 60vh;
    color: #94a3b8;
    text-align: center;
    padding: 24px;
}

.chat-messages-container::-webkit-scrollbar {
    width: 6px;
}

.chat-messages-container::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 4px;
}

/* Date Separator Pill */
.chat-date-separator {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 12px 0 6px 0;
    position: sticky;
    top: 4px;
    z-index: 10;
}

.chat-date-separator span {
    background: rgba(30, 41, 59, 0.88);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #94a3b8;
    font-size: 0.76rem;
    font-weight: 700;
    padding: 4px 14px;
    border-radius: 20px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    letter-spacing: 0.3px;
}

/* Chat Bubbles */
.chat-bubble-row {
    display: flex;
    width: 100%;
}

.chat-bubble-row.sent {
    justify-content: flex-end;
}

.chat-bubble-row.received {
    justify-content: flex-start;
}

.chat-bubble-card {
    max-width: 82%;
    padding: 8px 12px;
    border-radius: 14px;
    position: relative;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
    word-break: break-word;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.bubble-sent {
    background: #005c4b;
    color: #e9edef;
    border-top-right-radius: 2px;
}

.bubble-received {
    background: #202c33;
    color: #e9edef;
    border-top-left-radius: 2px;
}

.chat-bubble-sender {
    font-size: 0.72rem;
    font-weight: 700;
    color: #53bdeb;
    margin-bottom: 2px;
}

.chat-text-content {
    font-size: 0.95rem;
    line-height: 1.45;
}

.chat-bubble-meta {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
    margin-top: 2px;
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.55);
}

.chat-meta-check {
    color: #53bdeb;
    font-weight: 700;
}

.btn-chat-delete-msg {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.35);
    cursor: pointer;
    font-size: 0.7rem;
    padding: 0 2px;
    display: none;
}

.chat-bubble-card:hover .btn-chat-delete-msg {
    display: inline-block;
}

/* Media in chat */
.chat-media-wrap {
    display: flex;
    flex-direction: column;
    gap: 6px;
    border-radius: 10px;
    overflow: hidden;
}

.chat-inline-photo {
    max-width: 100%;
    max-height: 280px;
    object-fit: cover;
    border-radius: 10px;
    cursor: pointer;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: transform 0.2s ease;
}

.chat-inline-photo:hover {
    transform: scale(1.01);
}

.chat-photo-actions-row {
    display: flex;
    gap: 6px;
    margin-top: 4px;
    flex-wrap: wrap;
}

.btn-chat-media-action {
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    border: 1px solid rgba(255, 255, 255, 0.18);
    color: #f8fafc;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 5px 10px;
    border-radius: 8px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: all 0.15s ease;
}

.btn-chat-media-action:hover, .btn-chat-media-action:focus {
    background: rgba(2, 132, 199, 0.5);
    border-color: #38bdf8;
    outline: none;
}

/* Festive Greetings Card */
.chat-greeting-card {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.18), rgba(217, 119, 6, 0.12));
    border: 1px solid rgba(251, 191, 36, 0.4);
    border-radius: 12px;
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.chat-greeting-header {
    display: flex;
    align-items: center;
    gap: 8px;
}

.chat-greeting-body {
    font-size: 0.92rem;
    line-height: 1.45;
    color: #fef08a;
}

.chat-retention-pill {
    font-size: 0.68rem;
    color: rgba(255, 255, 255, 0.6);
    background: rgba(0, 0, 0, 0.25);
    padding: 2px 8px;
    border-radius: 6px;
    align-self: flex-start;
    margin-top: 4px;
}

/* Voice Player */
.chat-voice-player {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.25);
    border-radius: 10px;
    border: 1px solid rgba(56, 189, 248, 0.25);
}

/* Quick Greetings Drawer */
.chat-quick-greetings-drawer {
    background: #1f2c34;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding: 12px 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.4);
    z-index: 15;
}

.quick-greetings-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.85rem;
    font-weight: 700;
    color: #fbbf24;
}

.btn-drawer-close {
    background: transparent;
    border: none;
    color: #8696a0;
    font-size: 1rem;
    cursor: pointer;
    padding: 2px 6px;
}

.quick-greetings-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.btn-quick-preset {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #e9edef;
    padding: 8px 10px;

    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-slideshow-ctrl:hover, .btn-slideshow-ctrl:focus {
    background: rgba(56, 189, 248, 0.25);
    border-color: #38bdf8;
    color: #38bdf8;
    outline: none;
}

.slideshow-nav-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #f8fafc;
    width: 52px;
    height: 52px;

    border-radius: 50%;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 10;
}

.slideshow-nav-arrow.left { left: 24px; }
.slideshow-nav-arrow.right { right: 24px; }

.slideshow-nav-arrow:hover, .slideshow-nav-arrow:focus {
    background: rgba(2, 132, 199, 0.7);
    border-color: #38bdf8;
    transform: translateY(-50%) scale(1.1);
    outline: none;
}

/* TV Specific Rules */
body.role-tv .mobile-web-only {
    display: none !important;
}

body.role-tv .chat-text-input:focus,
body.role-tv .chat-action-btn:focus,
body.role-tv .btn-chat-media-action:focus,
body.role-tv .btn-slideshow-ctrl:focus,
body.role-tv .slideshow-nav-arrow:focus {
    outline: 3px solid #38bdf8 !important;
    box-shadow: 0 0 16px rgba(56, 189, 248, 0.8) !important;
}

/* ==========================================================================
   CHAT ATTACHMENT DRAWER & POPUP (PHOTOS, FILES, WEB LINKS)
   ========================================================================== */
.chat-attach-drawer {
    position: absolute;
    bottom: 74px;
    left: 12px;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 20px;
    padding: 14px 18px;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.65), 0 0 0 1px rgba(255, 255, 255, 0.05);
    z-index: 95;
    animation: drawerPopUp 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes drawerPopUp {
    from {
        opacity: 0;
        transform: translateY(14px) scale(0.96);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.chat-attach-grid {
    display: flex;
    gap: 16px;
    align-items: center;
}

.chat-attach-tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px 8px;
    border-radius: 12px;
    transition: transform 0.18s ease, background 0.18s ease;
    color: #e2e8f0;
}

.chat-attach-tile:hover, .chat-attach-tile:focus {
    transform: translateY(-3px);
    background: rgba(255, 255, 255, 0.06);
    outline: none;
}

.attach-icon-circle {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.chat-attach-tile:hover .attach-icon-circle {
    transform: scale(1.08);
}

.attach-circle-photo {
    background: linear-gradient(135deg, #ec4899, #8b5cf6);
}

.attach-circle-file {
    background: linear-gradient(135deg, #0284c7, #06b6d4);
}

/* Enhanced Responsive Slideshow Top Bar & Floating Mobile Zoom Pill */
.slideshow-top-bar {
    width: 100% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    padding: 8px 14px !important;
    color: #f8fafc !important;
    z-index: 20 !important;
    box-sizing: border-box !important;
}

.slideshow-top-left {
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
    flex-shrink: 0 !important;
}

.slideshow-top-right {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    flex-shrink: 0 !important;
}

.slideshow-mobile-zoom-bar {
    display: none;
    position: absolute;
    bottom: 90px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(15, 23, 42, 0.94);
    backdrop-filter: blur(16px);
    border: 1px solid rgba(56, 189, 248, 0.55);
    border-radius: 28px;
    padding: 4px 12px;
    z-index: 25;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.8);
    align-items: center;
    gap: 6px;
}

@media (max-width: 768px) {
    .slideshow-top-right .slideshow-zoom-tools {
        display: none !important;
    }
    .slideshow-mobile-zoom-bar {
        display: flex !important;
    }
}

.btn-photo-view-zoom {
    background: rgba(56, 189, 248, 0.2) !important;
    color: #38bdf8 !important;
    border: 1px solid rgba(56, 189, 248, 0.4) !important;
    border-radius: 8px !important;
    font-weight: 700 !important;
    padding: 4px 10px !important;
    cursor: pointer !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 4px !important;
}

.btn-photo-view-zoom:hover, .btn-photo-view-zoom:focus {
    background: #0284c7 !important;
    color: white !important;
}

/* ========================================================
   WHATSAPP-STYLE ON-DEMAND FILE BUBBLE & CIRCULAR DOWNLOAD
   ======================================================== */
.chat-file-bubble-wa {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(17, 27, 33, 0.92);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 12px;
    padding: 10px 14px;
    min-width: 250px;
    max-width: 380px;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}

.chat-file-bubble-wa:hover {
    background: rgba(30, 42, 51, 0.98);
    border-color: rgba(0, 168, 132, 0.45);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.45);
    transform: translateY(-1px);
}

.chat-file-icon-wrap {
    width: 44px;
    height: 48px;
    border-radius: 9px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.4);
    position: relative;
    overflow: hidden;
}

.chat-file-badge-text {
    font-size: 0.62rem;
    font-weight: 800;
    letter-spacing: 0.6px;
    text-transform: uppercase;
    line-height: 1;
    margin-bottom: 2px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.chat-file-badge-icon {
    font-size: 1.15rem;
    line-height: 1;
}

.chat-file-details {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.chat-file-name {
    font-size: 0.88rem;
    font-weight: 600;
    color: #e9edef;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
}

.chat-file-size-meta {
    font-size: 0.72rem;
    color: #8696a0;
    display: flex;
    align-items: center;
    gap: 4px;
}

.chat-file-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.btn-wa-download {
    width: 38px;
    height: 38px;
    min-width: 38px;
    border-radius: 50%;
    background: rgba(0, 168, 132, 0.18);
    border: 1.5px solid #00a884;
    color: #00a884;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0;
    outline: none;
}

.btn-wa-download:hover, .btn-wa-download:focus {
    background: #00a884;
    color: #ffffff;
    transform: scale(1.08);
    box-shadow: 0 0 12px rgba(0, 168, 132, 0.5);
}

.btn-wa-download.is-downloaded {
    background: rgba(34, 197, 94, 0.22);
    border-color: #22c55e;
    color: #22c55e;
}

.btn-wa-drive-save {
    width: 34px;
    height: 34px;
    min-width: 34px;
    border-radius: 50%;
    background: rgba(5, 150, 105, 0.25);
    border: 1px solid rgba(16, 185, 129, 0.45);
    color: #34d399;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0;
    outline: none;
}

.btn-wa-drive-save:hover, .btn-wa-drive-save:focus {
    background: #059669;
    color: #ffffff;
    transform: scale(1.08);
}

.btn-wa-dl-spinner {
    width: 18px;
    height: 18px;
    border: 2.5px solid rgba(0, 168, 132, 0.25);
    border-top-color: #00a884;
    border-radius: 50%;
    animation: kanupapaSpin 0.7s linear infinite;
    display: inline-block;
}

/* ==========================================================================
   ANDROID SHARE TARGET MODAL STYLES
   ========================================================================== */
.share-preview-card {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 8px 12px;
}

.share-preview-thumb {
    width: 54px;
    height: 54px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid rgba(56, 189, 248, 0.4);
}

.share-preview-icon {
    width: 48px;
    height: 48px;
    border-radius: 8px;
    background: rgba(56, 189, 248, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.share-preview-info {
    flex: 1;
    min-width: 0;
}

.share-preview-name {
    font-size: 0.92rem;
    font-weight: 700;
    color: #f8fafc;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.share-preview-size {
    font-size: 0.78rem;
    color: #94a3b8;
    margin-top: 2px;
}

.share-recipient-section-title {
    font-size: 0.8rem;
    font-weight: 700;
    color: #38bdf8;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 8px 4px 4px 4px;
}

.share-recipient-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 12px;
    background: rgba(30, 41, 59, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.05);
    cursor: pointer;
    transition: all 0.15s ease;
    user-select: none;
}

.share-recipient-item:hover, .share-recipient-item:focus {
    background: rgba(56, 189, 248, 0.18);
    border-color: #38bdf8;
    outline: none;
    transform: translateX(4px);
}

.share-recipient-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    font-weight: 700;
    color: #ffffff;
    flex-shrink: 0;
}

.share-recipient-info {
    flex: 1;
    min-width: 0;
}

.share-recipient-name {
    font-size: 0.95rem;
    font-weight: 700;
    color: #f8fafc;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.share-recipient-sub {
    font-size: 0.78rem;
    color: #94a3b8;
    margin-top: 1px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

