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

    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;
}

/* ========================================================
   RESPONSIVE OVERRIDES: MOBILE VS SMART TV
   ======================================================== */

@media (max-width: 768px) {
    /* Hide top bar bulky items on mobile */
    .top-bar {
        padding: 0 12px;
        height: 56px;
    }

    .logo-img {
        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 {
        display: none !important;
    }

    .mobile-only-btn {
        display: inline-flex !important;
    }

    /* Contacts View on Mobile: 100% full screen WhatsApp List */
    .unified-main-layout {
        display: flex !important;
        flex-direction: column !important;
        width: 100% !important;
        max-width: 100% !important;
        height: 100% !important;
        gap: 0 !important;
        padding: 0 !important;
    }

    .unified-contacts-panel {
        width: 100% !important;
        height: 100% !important;
        padding: 0 !important;
        background: transparent !important;
        border: none !important;
        box-shadow: none !important;
        display: flex !important;
        flex-direction: column !important;
    }

    .unified-panel-header {
        display: none !important;
    }

    .chat-panel {
        display: none !important;
    }

    #tv-desktop-sections {
        display: none !important;
    }

    .mobile-search-section {
        display: flex !important;
    }

    .unified-mobile-list {
        display: flex !important;
    }

    .fab-btn {
        display: flex !important;
    }
}

/* Desktop & Laptop Browser: Centered WhatsApp Web Style Unified List */
@media (min-width: 769px) {
    .unified-main-layout {
        display: flex !important;
        justify-content: center !important;
        align-items: flex-start !important;
        padding: 24px 16px !important;
        min-height: calc(100vh - 70px) !important;
        box-sizing: border-box !important;
    }

    .unified-contacts-panel {
        width: 100% !important;
        max-width: 700px !important;
        background: #0f172a !important;
        border: 1px solid rgba(255, 255, 255, 0.08) !important;
        border-radius: 16px !important;
        box-shadow: 0 12px 36px rgba(0, 0, 0, 0.45) !important;
        display: flex !important;
        flex-direction: column !important;
        overflow: hidden !important;
    }

    .unified-panel-header {
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
        padding: 14px 18px !important;
        background: rgba(30, 41, 59, 0.5) !important;
        border-bottom: 1px solid rgba(255, 255, 255, 0.06) !important;
    }

    .mobile-search-section {
        display: flex !important;
    }

    .unified-mobile-list {
        display: flex !important;
        max-height: 72vh !important;
    }

    .chat-panel {
        display: none !important;
    }

    #tv-desktop-sections {
        display: none !important;
    }
}

/* Explicit body.role-mobile (even on tablet or landscape mobile) */
body.role-mobile .logo-img {
    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 {
    display: none !important;
}

body.role-mobile .mobile-only-btn {
    display: inline-flex !important;
}

body.role-mobile .unified-panel-header {
    display: none !important;
}

body.role-mobile .chat-panel {
    display: none !important;
}

body.role-mobile #tv-desktop-sections {
    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;
}

/* SMART TV UNIFIED LAYOUT (Accessible D-Pad, Large Text, Clear Highlighting) */
body.role-tv .logo-img {
    display: inline-block !important;
}

body.role-tv .unified-main-layout {
    display: flex !important;
    justify-content: center !important;
    width: 100% !important;
    padding: 14px 24px !important;
    box-sizing: border-box !important;
}

body.role-tv .unified-contacts-panel {
    width: 100% !important;
    max-width: 1050px !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;
}

body.role-tv .unified-panel-header {
    display: flex !important;
    padding: 14px 20px !important;
}

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

body.role-tv .unified-mobile-list {
    display: flex !important;
    max-height: 72vh !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 {
    display: none !important;
}

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

body.role-tv .fab-btn {
    display: none !important;
}

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

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

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

.contact-chat-view {
    display: flex;
    flex-direction: column;
    height: 100vh;
    max-height: 100vh;
    width: 100%;
    max-width: 900px;
    margin: 0 auto;
    background: #0b141a;
    position: relative;
    overflow: hidden;
}

/* 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 {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #ffffff;
    width: 38px;
    height: 38px;
    min-width: 38px;
    border-radius: 50%;
    display: flex !important;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    padding: 0;
    transition: all 0.15s ease;
}

.btn-chat-back:hover, .btn-chat-back:focus {
    background: rgba(0, 168, 132, 0.3);
    border-color: #00a884;
    outline: none;
}

.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;
}

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

.chat-action-btn {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #e9edef;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.chat-action-btn:hover, .chat-action-btn:focus {
    background: rgba(0, 168, 132, 0.25);
    border-color: #00a884;
    transform: scale(1.05);
    outline: none;
}

/* 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;
}

.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;
}
