/* Custom Scrollbars */
.custom-scrollbar {
    scrollbar-width: thin;
    scrollbar-color: rgba(156, 163, 175, 0.5) transparent;
}
.dark .custom-scrollbar {
    scrollbar-color: rgba(75, 85, 99, 0.5) transparent;
}
.custom-scrollbar::-webkit-scrollbar { width: 6px; height: 6px; }
.custom-scrollbar::-webkit-scrollbar-track { background: transparent; }
.custom-scrollbar::-webkit-scrollbar-thumb { background-color: rgba(156, 163, 175, 0.5); border-radius: 10px; }
.dark .custom-scrollbar::-webkit-scrollbar-thumb { background-color: rgba(75, 85, 99, 0.5); }
.custom-scrollbar::-webkit-scrollbar-thumb:hover { background-color: rgba(107, 114, 128, 0.8); }

/* Hide scrollbar for Chrome, Safari and Opera (for sidebars) */
.no-scrollbar::-webkit-scrollbar { display: none; }
.no-scrollbar { -ms-overflow-style: none; scrollbar-width: none; }

/* Messenger Background */
.message-bg {
    background-image: url('https://user-images.githubusercontent.com/15075759/28719144-86dc0f70-73b1-11e7-911d-60d70fcded21.png');
    background-repeat: repeat;
    background-size: 300px;
    background-attachment: local;
}
.light .message-bg { background-color: #efeae2; opacity: 0.9; }
.dark .message-bg { background-color: #0b141a; opacity: 0.3; }

/* ContentEditable Placeholder */
.chat-input[contenteditable]:empty::before {
    content: attr(data-placeholder);
    color: #9ca3af;
    cursor: text;
}

/* Nav Item active states */
.nav-item.active {
    background-color: rgba(0, 102, 255, 0.1);
    color: #0066ff;
}
.dark .nav-item.active {
    background-color: rgba(0, 102, 255, 0.15);
    color: #3b82f6;
}

/* Mobile Nav Active */
@media (max-width: 768px) {
    .nav-item.active i {
        color: #0066ff;
    }
    .dark .nav-item.active i {
        color: #3b82f6;
    }
}

/* Accordion transition for customer cards */
.accordion-content {
    transition: max-height 0.3s ease-in-out, opacity 0.3s ease-in-out, padding 0.3s ease-in-out;
    max-height: 0;
    opacity: 0;
    overflow: hidden;
}
.accordion-content.expanded {
    max-height: 1000px; /* arbitrary large value */
    opacity: 1;
}

/* Premium Subscription UI Refinements */
#subscriptions-module {
    font-family: 'Inter', sans-serif;
}

#subscriptions-module h2, 
#subscriptions-module th {
    font-family: 'Outfit', sans-serif;
}

#subscriptions-module .status-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 9999px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.025em;
}

#subscriptions-module .status-pill::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
}

/* Status Colors - Light Mode */
.sub-status-pending { background-color: #FEF3C7; color: #92400E; }
.sub-status-pending::before { background-color: #F59E0B; }

.sub-status-paid { background-color: #DBEAFE; color: #1E40AF; }
.sub-status-paid::before { background-color: #3B82F6; }

.sub-status-completed { background-color: #E0F2FE; color: #075985; }
.sub-status-completed::before { background-color: #0EA5E9; }

.sub-status-active { background-color: #D1FAE5; color: #065F46; }
.sub-status-active::before { background-color: #10B981; }

.sub-status-cancelled { background-color: #FEE2E2; color: #991B1B; }
.sub-status-cancelled::before { background-color: #EF4444; }

/* Status Colors - Dark Mode */
.dark .sub-status-pending { background-color: rgba(245, 158, 11, 0.1); color: #FBBF24; }
.dark .sub-status-paid { background-color: rgba(59, 130, 246, 0.1); color: #60A5FA; }
.dark .sub-status-completed { background-color: rgba(14, 165, 233, 0.1); color: #38BDF8; }
.dark .sub-status-active { background-color: rgba(16, 185, 129, 0.1); color: #34D399; }
.dark .sub-status-cancelled { background-color: rgba(239, 68, 68, 0.1); color: #F87171; }

/* Table Row Hover & Animation */
#subscriptions-module tbody tr.sub-main-row {
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

#subscriptions-module tbody tr.sub-main-row:hover {
    background-color: #F8FAFC;
}

.dark #subscriptions-module tbody tr.sub-main-row:hover {
    background-color: rgba(255, 255, 255, 0.03);
}

#subscriptions-module .detail-container {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 0;
    transform: translateY(-10px);
}

#subscriptions-module tr.expanded .detail-container {
    opacity: 1;
    transform: translateY(0);
}

/* Premium Card Overrides */
.dark .sub-card-container {
    background-color: #000000;
    border-color: #111;
    color: white;
}



/* GLOBAL DARK MODE OVERRIDES - TRUE BLACK THEME */
.dark body, .dark .module-view {
    background-color: #000000 !important;
    color: #ffffff !important;
}

/* Force all card-like backgrounds to pure black */
.dark .bg-white, 
.dark .bg-slate-50, 
.dark .bg-gray-50,
.dark .sub-card-container,
.dark .module-card,
.dark #inventory-content {
    background-color: #000000 !important;
    border-color: #1a1a1a !important;
}

/* Force all text to high contrast white */
.dark .text-slate-900, 
.dark .text-gray-900,
.dark .text-slate-700,
.dark .text-gray-700,
.dark .text-slate-600 {
    color: #ffffff !important;
}

.dark .text-slate-500, 
.dark .text-gray-500,
.dark .text-slate-400 {
    color: #a1a1aa !important;
}

/* Modal Specific Dark Mode - True Black */
.dark .bg-white.w-full.max-w-md,
.dark .bg-white.w-full.max-w-2xl,
.dark .bg-white.w-full.max-w-lg,
.dark .bg-white.w-full.max-w-3xl {
    background-color: #000000 !important;
    border: 1px solid #222 !important;
    box-shadow: 0 0 40px rgba(0,0,0,1) !important;
}

.premium-modal-header {
    background: linear-gradient(135deg, #0a0a0a 0%, #000 100%);
    padding: 3rem 2.5rem 2rem 2.5rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    color: white;
    position: relative;
    border-bottom: 1px solid #111;
}

.premium-modal-close {
    position: absolute !important;
    top: 2rem !important;
    right: 2.5rem !important;
    width: 3rem;
    height: 3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 9999px;
    background-color: rgba(239, 68, 68, 0.1);
    transition: all 0.2s;
    color: #ef4444;
    z-index: 100;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.premium-modal-close:hover {
    background-color: #ef4444;
    color: white;
    border-color: #ef4444;
    box-shadow: 0 0 15px rgba(239, 68, 68, 0.4);
}

.premium-modal-header h3, 
.premium-modal-header h2 {
    font-size: 1.125rem;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.25em;
    line-height: 1.2;
    margin-bottom: 0.5rem;
    text-shadow: 0 2px 15px rgba(0,0,0,0.8);
    padding-right: 4rem; /* Prevent overlap with close button */
}

.premium-modal-header p {
    font-size: 10px;
    color: #94a3b8;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    opacity: 0.8;
    padding-right: 4rem; /* Prevent overlap with close button */
}

/* Form Inputs - Absolutely No White in Dark Mode */
.dark input, 
.dark select, 
.dark textarea,
input.dark-input {
    @apply bg-black border-gray-800 text-white focus:border-blue-500 focus:ring-blue-500/10 placeholder-gray-600 !important;
    background-color: #000000 !important;
}

/* Special fix for the 'undefined' looking inputs in screenshot */
input[readonly], 
select[disabled],
.dark input[readonly] {
    @apply opacity-60 cursor-not-allowed bg-black border-dashed border-gray-800 text-slate-400 !important;
}

.dark input:focus, 
.dark select:focus, 
.dark textarea:focus {
    border-color: #444 !important;
    ring-color: transparent !important;
}

.dark input::placeholder,
.dark textarea::placeholder {
    color: #555 !important;
}

/* Table Enhancements */
.dark table thead tr {
    background-color: #050505 !important;
    border-bottom: 1px solid #1a1a1a !important;
}

.dark table tbody tr {
    border-bottom: 1px solid #111 !important;
}

.dark table tbody tr:hover {
    background-color: #080808 !important;
}

/* Action Buttons - Maintain High Contrast */
.btn-inv-action {
    @apply px-4 py-2 rounded-xl text-xs font-bold uppercase transition-all;
}

.dark .btn-stock-in { background-color: #064e3b !important; color: #34d399 !important; }
.dark .btn-product { background-color: #1e3a8a !important; color: #93c5fd !important; }
.dark .btn-kit { background-color: #4c1d95 !important; color: #c4b5fd !important; }

/* Status Pills in True Black */
.dark .status-pill {
    border: 1px solid currentColor !important;
}

.modal-title-bar {
    background-color: #111;
    color: white;
    padding: 8px 16px;
    font-size: 14px;
    font-weight: bold;
}

.mobile-nav.active {
    color: #3b82f6 !important; /* Primary blue for active state */
}

.mobile-nav.active i {
    transform: translateY(-2px);
    transition: transform 0.2s ease;
}

/* Mobile Responsiveness & Table Refinements */
@media (max-width: 768px) {
    /* Subscription Hub & Inventory Tables */
    .dark #subscriptions-list-body tr,
    .dark #inventory-content table tbody tr {
        display: block;
        padding: 1.25rem;
        margin-bottom: 1rem;
        border: 1px solid #1a1a1a !important;
        border-radius: 1.5rem;
        background-color: #000000 !important;
        box-shadow: 0 4px 20px rgba(0,0,0,0.4);
    }

    #subscriptions-list-body tr,
    #inventory-content table tbody tr {
        display: block;
        padding: 1rem;
        margin-bottom: 0.75rem;
        border: 1px solid #e2e8f0;
        border-radius: 1rem;
        background-color: #ffffff;
    }

    /* Ensure hidden rows stay hidden despite specificity */
    #subscriptions-list-body tr.hidden,
    #inventory-content table tbody tr.hidden,
    .dark #subscriptions-list-body tr.hidden,
    .dark #inventory-content table tbody tr.hidden {
        display: none !important;
    }

    #subscriptions-module table thead,
    #inventory-content table thead {
        display: none;
    }

    #subscriptions-list-body td,
    #inventory-content table tbody td {
        display: block;
        padding: 0.5rem 0 !important;
        width: 100% !important;
        text-align: left !important;
        border: none !important;
    }

    #subscriptions-list-body td:first-child,
    #inventory-content table tbody td:first-child {
        border-bottom: 1px solid #f1f5f9 !important;
        margin-bottom: 0.5rem;
        padding-bottom: 0.75rem !important;
    }

    .dark #subscriptions-list-body td:first-child,
    .dark #inventory-content table tbody td:first-child {
        border-bottom-color: #111 !important;
    }

    #subscriptions-list-body td.text-right,
    #inventory-content table tbody td.text-right {
        text-align: left !important;
    }

    /* Modal Tweaks */
    .fixed.inset-0.p-4 {
        padding: 0 !important;
    }

    .fixed.inset-0:not(#serials-full-view) > .bg-white,
    .fixed.inset-0:not(#serials-full-view) > .dark\:bg-slate-900,
    .fixed.inset-0:not(#serials-full-view) > div {
        max-width: 100% !important;
        height: 100%;
        border-radius: 0 !important;
    }

    .premium-modal-header {
        border-radius: 0 !important;
    }

    /* Padding adjustments for mobile containers */
    #subscriptions-module,
    #inventory-module {
        padding: 1rem !important;
    }
}

/* Fix for horizontal overflow in detail view */
.detail-container .grid {
    @apply gap-6 md:gap-10;
}


.active-tab {
    border-color: #4f46e5 !important;
    color: #4f46e5 !important;
    font-weight: 900 !important;
}

/* Global Modal Scroll Fix (project-wide) */
.fixed.inset-0 {
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}

.fixed.inset-0:not(#serials-full-view) > div {
    max-height: min(92vh, 92dvh);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

@media (max-width: 768px) {
    .fixed.inset-0 {
        align-items: flex-start !important;
        justify-content: center !important;
        padding: 12px !important;
        padding-top: calc(12px + env(safe-area-inset-top, 0px)) !important;
        padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px)) !important;
    }

    .fixed.inset-0:not(#serials-full-view) > div {
        width: 100% !important;
        max-width: 100% !important;
        max-height: calc(100dvh - 24px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px)) !important;
        border-radius: 16px !important;
        overflow-y: auto !important;
    }

    /* Universal Header safe area support for iPhone status bar & Dynamic Island */
    header.sticky.top-0 {
        padding-top: calc(0.75rem + env(safe-area-inset-top, 0px)) !important;
        height: calc(3.75rem + env(safe-area-inset-top, 0px)) !important;
        display: flex !important;
        align-items: flex-end !important;
        padding-bottom: 0.75rem !important;
    }

    /* Stack multi-column modal internals on mobile */
    .fixed.inset-0 .grid-cols-2,
    .fixed.inset-0 .grid-cols-3,
    .fixed.inset-0 .grid-cols-4 {
        grid-template-columns: minmax(0, 1fr) !important;
    }

    /* Reduce heavy modal paddings for small screens */
    .fixed.inset-0 .p-8 {
        padding: 1rem !important;
    }
    .fixed.inset-0 .p-6 {
        padding: 0.875rem !important;
    }

    /* Keep modal table sections scrollable instead of overflowing */
    .fixed.inset-0 .overflow-x-auto {
        -webkit-overflow-scrolling: touch;
        overflow-x: auto !important;
    }

    /* Notification Dropdown - Fixed full-width centered card on mobile */
    #notifications-dropdown {
        position: fixed !important;
        top: 60px !important;
        left: 12px !important;
        right: 12px !important;
        width: auto !important;
        max-height: 70vh !important;
    }

    /* Notification Banner Toasts - Full width on mobile */
    .notif-banner {
        width: calc(100vw - 24px) !important;
        right: 12px !important;
        left: 12px !important;
    }
}

/* Calendar Picker Indicator Styling (Make visible in light & dark modes with a red/crimson hue) */
input[type="date"]::-webkit-calendar-picker-indicator,
input[type="month"]::-webkit-calendar-picker-indicator,
input[type="datetime-local"]::-webkit-calendar-picker-indicator {
    filter: invert(30%) sepia(100%) saturate(5000%) hue-rotate(345deg) brightness(95%) contrast(90%) !important;
    cursor: pointer;
}

/* ==========================================================================
   WHATSAPP MODULE MODERNIZATION OVERRIDES (PREMIUM UI - CYBER INDIGO THEME)
   ========================================================================== */

#whatsapp-module {
    font-family: 'Outfit', 'Inter', sans-serif !important;
}

/* Custom Scrollbars for WhatsApp Module */
#whatsapp-module #chat-list::-webkit-scrollbar,
#whatsapp-module #chat-messages-container::-webkit-scrollbar,
#whatsapp-module #contact-list::-webkit-scrollbar,
#whatsapp-module #chat-input::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
#whatsapp-module #chat-list::-webkit-scrollbar-track,
#whatsapp-module #chat-messages-container::-webkit-scrollbar-track,
#whatsapp-module #contact-list::-webkit-scrollbar-track,
#whatsapp-module #chat-input::-webkit-scrollbar-track {
    background: transparent;
}
#whatsapp-module #chat-list::-webkit-scrollbar-thumb,
#whatsapp-module #chat-messages-container::-webkit-scrollbar-thumb,
#whatsapp-module #contact-list::-webkit-scrollbar-thumb,
#whatsapp-module #chat-input::-webkit-scrollbar-thumb {
    background: rgba(99, 102, 241, 0.15);
    border-radius: 10px;
}
.dark #whatsapp-module #chat-list::-webkit-scrollbar-thumb,
.dark #whatsapp-module #chat-messages-container::-webkit-scrollbar-thumb,
.dark #whatsapp-module #contact-list::-webkit-scrollbar-thumb,
.dark #whatsapp-module #chat-input::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.08);
}

/* Avatar Gradients */
.avatar-gradient-0 { background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%) !important; }
.avatar-gradient-1 { background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%) !important; }
.avatar-gradient-2 { background: linear-gradient(135deg, #06b6d4 0%, #0891b2 100%) !important; }
.avatar-gradient-3 { background: linear-gradient(135deg, #ec4899 0%, #db2777 100%) !important; }
.avatar-gradient-4 { background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%) !important; }
.avatar-gradient-5 { background: linear-gradient(135deg, #10b981 0%, #059669 100%) !important; }

/* Dynamic Class Color Overrides for green elements injected by JS */
#whatsapp-module .text-emerald-500 { color: #6366f1 !important; }
#whatsapp-module .text-emerald-600 { color: #4f46e5 !important; }
#whatsapp-module .dark\:text-emerald-400 { color: #818cf8 !important; }
#whatsapp-module .bg-emerald-500\/10 { background-color: rgba(99, 102, 241, 0.1) !important; }
#whatsapp-module .bg-emerald-500\/20 { background-color: rgba(99, 102, 241, 0.2) !important; }
#whatsapp-module .bg-emerald-500 { background-color: #4f46e5 !important; }

/* Sidebar Header */
#whatsapp-module #chat-sidebar > div:first-child {
    background: #f8fafc !important;
    border-bottom: 1px solid #e2e8f0 !important;
    padding: 0 16px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    height: 59px !important;
}
.dark #whatsapp-module #chat-sidebar > div:first-child {
    background: #05070c !important;
    border-bottom: 1px solid #111b27 !important;
}

/* Sidebar Profile Avatar initials */
#sidebar-user-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    font-weight: 700;
    font-size: 13.5px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
}
#sidebar-user-avatar:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 10px rgba(99, 102, 241, 0.2);
}

/* Sidebar New Chat Button */
#chat-sidebar button[title="New Chat"] {
    width: 36px !important;
    height: 36px !important;
    background: #f0f2f5 !important;
    color: #475569 !important;
    border-radius: 50% !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    border: 1px solid transparent !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}
.dark #chat-sidebar button[title="New Chat"] {
    background: #0f172a !important;
    color: #94a3b8 !important;
    border: 1px solid rgba(255, 255, 255, 0.03) !important;
}
#chat-sidebar button[title="New Chat"]:hover {
    background: #4f46e5 !important;
    color: white !important;
    transform: scale(1.08);
    box-shadow: 0 0 12px rgba(99, 102, 241, 0.4) !important;
}
#chat-sidebar button[title="New Chat"]:hover i {
    transform: rotate(90deg);
}
#chat-sidebar button[title="New Chat"] i {
    transition: transform 0.3s ease;
}

/* Search Container Styling */
#chat-search-container {
    background: #f1f5f9 !important;
    border: 1px solid transparent !important;
    border-radius: 12px !important;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex !important;
    align-items: center !important;
    height: 38px !important;
}
.dark #chat-search-container {
    background: #0f172a !important;
    border: 1px solid rgba(255, 255, 255, 0.03) !important;
}
#chat-search-container:focus-within {
    border-color: #6366f1 !important;
    background: #ffffff !important;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15) !important;
}
.dark #chat-search-container:focus-within {
    background: #030712 !important;
    border-color: #6366f1 !important;
}
#chat-search {
    font-size: 14px !important;
    font-weight: 500 !important;
}
#chat-search-container i {
    color: #64748b !important;
    transition: color 0.25s ease;
}
.dark #chat-search-container i {
    color: #475569 !important;
}
#chat-search-container:focus-within i {
    color: #6366f1 !important;
}

/* Filter Chips styling */
.chat-filter {
    font-size: 12px !important;
    font-weight: 600 !important;
    padding: 6px 14px !important;
    border: 1px solid transparent !important;
    background: #f1f5f9 !important;
    color: #475569 !important;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
    border-radius: 9999px !important;
}
.dark .chat-filter {
    background: #0f172a !important;
    color: #94a3b8 !important;
    border: 1px solid rgba(255, 255, 255, 0.02) !important;
}
.chat-filter:hover {
    background: #e2e8f0 !important;
    color: #0f172a !important;
}
.dark .chat-filter:hover {
    background: #1e293b !important;
    color: #f8fafc !important;
}
.chat-filter.active {
    background: #4f46e5 !important;
    color: #ffffff !important;
    font-weight: 700 !important;
    box-shadow: 0 3px 10px rgba(79, 70, 229, 0.3) !important;
}
.dark .chat-filter.active {
    background: #6366f1 !important;
    color: #ffffff !important;
    font-weight: 700 !important;
    box-shadow: 0 3px 12px rgba(99, 102, 241, 0.4) !important;
}

#chat-franchise-filter {
    font-size: 12px !important;
    padding: 6px 30px 6px 14px !important;
    border-radius: 9999px !important;
    background: #f1f5f9 !important;
    color: #475569 !important;
    border: 1px solid transparent !important;
    transition: all 0.2s ease !important;
}
.dark #chat-franchise-filter {
    background: #0f172a !important;
    color: #94a3b8 !important;
    border: 1px solid rgba(255, 255, 255, 0.02) !important;
}
#chat-franchise-filter:hover {
    background: #e2e8f0 !important;
}
.dark #chat-franchise-filter:hover {
    background: #1e293b !important;
}

/* Chat Thread Cards in Sidebar */
.chat-thread-card {
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1) !important;
    border-radius: 14px !important;
    border: 1px solid rgba(0, 0, 0, 0.02) !important;
    margin: 8px 12px !important;
    padding: 12px !important;
}
.dark .chat-thread-card {
    border: 1px solid rgba(255, 255, 255, 0.01) !important;
}
.chat-thread-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05) !important;
    background-color: #f8fafc !important;
}
.dark .chat-thread-card:hover {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4) !important;
    background-color: #0c111d !important;
}
.active-chat-card {
    border-left: 4px solid #6366f1 !important;
    background: linear-gradient(90deg, rgba(99, 102, 241, 0.08) 0%, rgba(59, 130, 246, 0.02) 100%) !important;
    border-color: rgba(99, 102, 241, 0.4) !important;
}
.dark .active-chat-card {
    background: linear-gradient(90deg, rgba(99, 102, 241, 0.15) 0%, rgba(59, 130, 246, 0.03) 100%) !important;
    border-color: #6366f1 !important;
}

/* Chat Header (Top Middle) */
#chat-header-bar {
    background: #f8fafc !important;
    border-bottom: 1px solid #e2e8f0 !important;
    padding: 0 20px !important;
    align-items: center !important;
    justify-content: space-between !important;
    height: 59px !important;
}
.dark #chat-header-bar {
    background: #05070c !important;
    border-bottom: 1px solid #111b27 !important;
}
#active-chat-name {
    font-size: 15.5px !important;
    font-weight: 700 !important;
    letter-spacing: -0.01em;
    color: #0f172a !important;
}
.dark #active-chat-name {
    color: #f8fafc !important;
}
#chat-header-bar p {
    font-size: 12px !important;
    color: #64748b !important;
    transition: color 0.2s ease;
}
.dark #chat-header-bar p {
    color: #475569 !important;
}
#chat-header-bar .cursor-pointer:hover p {
    color: #6366f1 !important;
}
#active-chat-status-dot {
    box-shadow: 0 0 0 2px white;
}
.dark #active-chat-status-dot {
    box-shadow: 0 0 0 2px #05070c;
}

/* Hide standard WhatsApp image background pattern */
#whatsapp-module #chat-window > div.absolute.inset-0.opacity-\[0\.08\],
#whatsapp-module #chat-window > div.absolute.inset-0.opacity-\[0\.05\],
#whatsapp-module #chat-window > div.bg-repeat {
    display: none !important;
}

/* Chat Wallpaper Vignette & Cyber Depth */
.chat-window-premium-bg {
    background-color: #f8fafc !important;
    background-image: 
        radial-gradient(at 0% 0%, rgba(99, 102, 241, 0.04) 0px, transparent 50%),
        radial-gradient(at 100% 0%, rgba(59, 130, 246, 0.04) 0px, transparent 50%),
        radial-gradient(circle at center, #ffffff 0%, #f1f5f9 100%) !important;
    position: relative;
    overflow: hidden;
}
.dark .chat-window-premium-bg {
    background-color: #020408 !important;
    background-image: 
        radial-gradient(at 0% 0%, rgba(99, 102, 241, 0.08) 0px, transparent 50%),
        radial-gradient(at 100% 0%, rgba(139, 92, 246, 0.06) 0px, transparent 50%),
        radial-gradient(circle at center, #070a13 0%, #020408 100%) !important;
}
.chat-window-premium-bg::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at center, transparent 40%, rgba(0, 0, 0, 0.02) 100%);
    pointer-events: none;
    z-index: 1;
}
.dark .chat-window-premium-bg::before {
    background: radial-gradient(circle at center, transparent 50%, rgba(0, 0, 0, 0.3) 100%);
}

/* Date separator pills */
.chat-date-pill {
    background: rgba(255, 255, 255, 0.9) !important;
    backdrop-filter: blur(8px) !important;
    border: 1px solid rgba(99, 102, 241, 0.1) !important;
    color: #475569 !important;
    font-weight: 700 !important;
    font-size: 11px !important;
    padding: 6px 14px !important;
    border-radius: 9999px !important;
    margin: 12px auto !important;
    display: inline-block !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.03) !important;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.dark .chat-date-pill {
    background: rgba(15, 23, 42, 0.8) !important;
    border: 1px solid rgba(255, 255, 255, 0.05) !important;
    color: #94a3b8 !important;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3) !important;
}

/* Premium Speech Bubbles with Smooth Layouts */
.msg-bubble-outbound {
    background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%) !important;
    color: #ffffff !important;
    border-radius: 16px 16px 0px 16px !important;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.2) !important;
    position: relative;
    z-index: 2;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
}
.dark .msg-bubble-outbound {
    background: linear-gradient(135deg, #4f46e5 0%, #3b82f6 100%) !important;
    color: #ffffff !important;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.25) !important;
    border: 1px solid rgba(255, 255, 255, 0.05) !important;
}
.msg-bubble-outbound::before {
    content: '';
    position: absolute;
    top: 0;
    right: -6px;
    width: 6px;
    height: 10px;
    background: #6366f1;
    clip-path: polygon(0 0, 0 100%, 100% 0);
    z-index: 1;
}
.dark .msg-bubble-outbound::before {
    background: #4f46e5;
}

.msg-bubble-inbound {
    background: #ffffff !important;
    color: #0f172a !important;
    border-radius: 16px 16px 16px 0px !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03) !important;
    border: 1px solid rgba(0, 0, 0, 0.05) !important;
    position: relative;
    z-index: 2;
}
.dark .msg-bubble-inbound {
    background: rgba(15, 23, 42, 0.8) !important;
    backdrop-filter: blur(8px) !important;
    border: 1px solid rgba(255, 255, 255, 0.05) !important;
    color: #f8fafc !important;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3) !important;
}
.msg-bubble-inbound::before {
    content: '';
    position: absolute;
    top: 0;
    left: -6px;
    width: 6px;
    height: 10px;
    background: #ffffff;
    clip-path: polygon(100% 0, 0 0, 100% 100%);
    z-index: 1;
}
.dark .msg-bubble-inbound::before {
    background: rgba(15, 23, 42, 0.8);
}

/* Message entry animation */
@keyframes bubble-appear {
    from {
        opacity: 0;
        transform: translateY(10px) scale(0.97);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}
.message-animate {
    animation: bubble-appear 0.22s cubic-bezier(0.16, 1, 0.3, 1) forwards !important;
}

/* Notification Dropdown Slide-in */
@keyframes notifSlideIn {
    from {
        opacity: 0;
        transform: translateY(-8px) scale(0.97);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Notification List custom scrollbar */
#notifications-list::-webkit-scrollbar {
    width: 5px;
}
#notifications-list::-webkit-scrollbar-track {
    background: transparent;
}
#notifications-list::-webkit-scrollbar-thumb {
    background: rgba(156, 163, 175, 0.3);
    border-radius: 10px;
}
.dark #notifications-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
}

/* Input Footer */
#chat-input-footer {
    background: #f8fafc !important;
    border-top: 1px solid #e2e8f0 !important;
    padding: 12px 20px !important;
    align-items: center !important;
    gap: 14px !important;
    min-height: 66px !important;
}
.dark #chat-input-footer {
    background: #05070c !important;
    border-top: 1px solid #111b27 !important;
}

/* Decorative Footer icons (Emoji & Paperclip) */
.chat-footer-action-icon {
    color: #64748b !important;
    cursor: pointer;
    font-size: 20px !important;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 50%;
}
.dark .chat-footer-action-icon {
    color: #475569 !important;
}
.chat-footer-action-icon:hover {
    color: #6366f1 !important;
    background: rgba(99, 102, 241, 0.08);
    transform: scale(1.06);
}

/* Input Bar Container Capsule */
#chat-input-container {
    background: #ffffff !important;
    border: 1px solid #cbd5e1 !important;
    border-radius: 22px !important;
    padding: 4px 18px !important;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1) !important;
}
.dark #chat-input-container {
    background: #0f172a !important;
    border: 1px solid rgba(255, 255, 255, 0.03) !important;
}
#chat-input-container:focus-within {
    border-color: #6366f1 !important;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15) !important;
}
.dark #chat-input-container:focus-within {
    background: #030712 !important;
    border-color: #6366f1 !important;
}

#chat-input {
    font-size: 14.5px !important;
    line-height: 22px !important;
    padding: 8px 0 !important;
}

/* Floating Violet Send Action Circle */
#send-btn {
    width: 42px !important;
    height: 42px !important;
    border-radius: 50% !important;
    background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%) !important;
    color: white !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    box-shadow: 0 3px 10px rgba(99, 102, 241, 0.3) !important;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1) !important;
    border: none !important;
    cursor: pointer !important;
    padding: 0 !important;
    flex-shrink: 0 !important;
}
#send-btn:hover {
    background: linear-gradient(135deg, #4f46e5 0%, #3730a3 100%) !important;
    transform: scale(1.08);
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.5) !important;
}
#send-btn:active {
    transform: scale(0.95);
}
#send-btn i {
    font-size: 15px !important;
    margin-left: 2px !important;
    color: white !important;
}
#send-btn:disabled, #send-btn.opacity-50 {
    background: #f1f5f9 !important;
    color: #94a3b8 !important;
    box-shadow: none !important;
    transform: none !important;
    cursor: not-allowed !important;
}
.dark #send-btn:disabled, .dark #send-btn.opacity-50 {
    background: #0f172a !important;
    color: #334155 !important;
}
#send-btn:disabled i, #send-btn.opacity-50 i {
    color: #94a3b8 !important;
}
.dark #send-btn:disabled i, .dark #send-btn.opacity-50 i {
    color: #334155 !important;
}

/* Floating Scroll Down Button and Unread Messages Separator */
#chat-scroll-down-btn {
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) !important;
}
#chat-scroll-down-btn.visible {
    transform: scale(1) translateY(0) !important;
    opacity: 1 !important;
}
#chat-scroll-down-btn.hidden-btn {
    transform: scale(0) translateY(16px) !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

.unread-messages-separator span {
    transition: all 0.2s ease;
}

/* WhatsApp Mobile Layout Enhancements */
@media (max-width: 768px) {
    #chat-info-pane {
        bottom: calc(65px + env(safe-area-inset-bottom, 0px)) !important;
        height: auto !important;
    }
    
    #chat-info-pane .flex-1 {
        padding-bottom: 36px !important; /* Ensure breathing room above the mobile nav */
    }
}

/* Frosted Glass Placeholder Card for Security branding */
.placeholder-card {
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(226, 232, 240, 0.8);
    border-radius: 24px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.02);
    max-width: 420px;
    transition: all 0.3s ease;
}
.dark .placeholder-card {
    background: rgba(15, 23, 42, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.03);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
}

/* Red alert badge for unread threads */
#chat-list span.bg-emerald-500,
#chat-scroll-down-badge.bg-emerald-500 {
    background-color: #ef4444 !important;
    color: #ffffff !important;
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.5) !important;
}

/* Navigation Tabs Scroll & Responsiveness */
.scrollbar-none::-webkit-scrollbar {
    display: none !important;
}
.scrollbar-none {
    -ms-overflow-style: none !important;
    scrollbar-width: none !important;
}

/* Make inventory tabs premium and smooth-scrolling */
#inventory-module .overflow-x-auto {
    -webkit-overflow-scrolling: touch !important;
    scroll-behavior: smooth !important;
}

@media (max-width: 768px) {
    /* Style inventory tabs as neat modern pills on mobile */
    #inventory-module .inv-tab-btn {
        padding: 8px 16px !important;
        border-radius: 9999px !important;
        background-color: #f1f5f9 !important;
        color: #475569 !important;
        border: 1px solid #e2e8f0 !important;
        font-size: 11px !important;
        letter-spacing: 0.05em !important;
        transition: all 0.2s ease !important;
    }
    
    .dark #inventory-module .inv-tab-btn {
        background-color: #0d1321 !important;
        color: #94a3b8 !important;
        border: 1px solid #1e293b !important;
    }

    #inventory-module .inv-tab-btn.active-tab {
        background-color: #4f46e5 !important;
        color: #ffffff !important;
        border-color: #4f46e5 !important;
        box-shadow: 0 4px 12px rgba(79, 70, 229, 0.2) !important;
    }
    
    .dark #inventory-module .inv-tab-btn.active-tab {
        background-color: #6366f1 !important;
        color: #ffffff !important;
        border-color: #6366f1 !important;
        box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3) !important;
    }

    /* Remove bottom border wrapper lines on mobile to clean up the pills style */
    #inventory-module .border-b {
        border-bottom: none !important;
        padding-bottom: 8px !important;
    }
    
    /* Make the scrolling container have a hint of overflow gradient / spacing */
    #inventory-module div.overflow-x-auto {
        padding: 4px 2px !important;
        margin-bottom: 8px !important;
    }

    /* Force tables in inventory and subscriptions modules to fit perfectly on mobile without horizontal scrolling */
    #subscriptions-module table,
    #inventory-content table {
        min-width: 100% !important;
        width: 100% !important;
    }

    /* Clean mobile layout cards for scoped RMA requests table */
    .rma-table-container table tbody td {
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
        border-bottom: 1px dashed rgba(0, 0, 0, 0.05) !important;
        padding: 0.75rem 0 !important;
    }

    .dark .rma-table-container table tbody td {
        border-bottom-color: rgba(255, 255, 255, 0.05) !important;
    }

    .rma-table-container table tbody td:first-child {
        border-bottom: 1px solid rgba(0, 0, 0, 0.1) !important;
        padding-bottom: 0.75rem !important;
    }
    
    .dark .rma-table-container table tbody td:first-child {
        border-bottom-color: rgba(255, 255, 255, 0.15) !important;
    }

    .rma-table-container table tbody td:last-child {
        border-bottom: none !important;
        justify-content: flex-end !important;
        padding-top: 1rem !important;
    }

    /* Column-specific labels on mobile cards */
    .rma-table-container table tbody td:nth-of-type(2)::before { content: "Franchise Node"; font-size: 9px; font-weight: 900; text-transform: uppercase; color: #94a3b8; letter-spacing: 0.05em; }
    .rma-table-container table tbody td:nth-of-type(3)::before { content: "Inbound Creator"; font-size: 9px; font-weight: 900; text-transform: uppercase; color: #94a3b8; letter-spacing: 0.05em; }
    .rma-table-container table tbody td:nth-of-type(4)::before { content: "Outbound Creator"; font-size: 9px; font-weight: 900; text-transform: uppercase; color: #94a3b8; letter-spacing: 0.05em; }
    .rma-table-container table tbody td:nth-of-type(5)::before { content: "Status"; font-size: 9px; font-weight: 900; text-transform: uppercase; color: #94a3b8; letter-spacing: 0.05em; }
    .rma-table-container table tbody td:nth-of-type(6)::before { content: "Created At"; font-size: 9px; font-weight: 900; text-transform: uppercase; color: #94a3b8; letter-spacing: 0.05em; }

    /* Merge details row card seamlessly with parent row card */
    #inventory-content table tbody tr[id^="rma-row-"] {
        padding: 0 !important;
        margin-top: -0.85rem !important;
        margin-bottom: 1rem !important;
        border-top: none !important;
        border-radius: 0 0 1rem 1rem !important;
        box-shadow: none !important;
        background-color: #f8fafc !important;
        border: 1px solid #e2e8f0 !important;
        border-top: 1px dashed #cbd5e1 !important;
    }
    
    .dark #inventory-content table tbody tr[id^="rma-row-"] {
        background-color: #05060b !important;
        border: 1px solid #1a1a1a !important;
        border-top: 1px dashed #334155 !important;
        border-radius: 0 0 1.5rem 1.5rem !important;
    }

    #inventory-content table tbody tr[id^="rma-row-"] > td {
        padding: 0 !important;
    }
    
    #inventory-content table tbody tr[id^="rma-row-"] > td > div {
        border: none !important;
        padding: 1.25rem !important;
        background: transparent !important;
    }
}



