/*
 * Multi-Select Enhancement for BalasChat Conversation List
 * Version: 3.9.0
 * Brand Color: Blue #007bff
 */

/* ==========================================
   CHECKBOX - Hidden by default, show on hover/select mode
   ========================================== */

.bc-multi-select-checkbox {
    position: absolute;
    left: 8px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
    opacity: 0;
    transition: opacity 0.2s ease;
    width: 20px;
    height: 20px;
}

/* Show checkbox on hover or in multi-select mode */
.bc-admin-list ul li:hover .bc-multi-select-checkbox,
.bc-admin-list ul.bc-multi-select-mode .bc-multi-select-checkbox {
    opacity: 1;
}

/* Custom checkbox styling with checkmark */
.bc-multi-select-checkbox input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    border: 2px solid #D1D5DB;
    border-radius: 4px;
    background: white;
    position: relative;
    transition: all 0.2s ease;
}

.bc-multi-select-checkbox input[type="checkbox"]:hover {
    border-color: #007bff;
}

/* Checked state - Blue background with checkmark */
.bc-multi-select-checkbox input[type="checkbox"]:checked {
    background: #007bff;
    border-color: #007bff;
}

/* Checkmark icon */
.bc-multi-select-checkbox input[type="checkbox"]:checked::after {
    content: '✓';
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 14px;
    font-weight: bold;
}

/* ==========================================
   SELECTED STATE - Visual Feedback (BLUE #007bff)
   ========================================== */

.bc-admin-list ul li.bc-selected {
    background: linear-gradient(to right, rgba(0, 123, 255, 0.12), rgba(0, 123, 255, 0.02)) !important;
    border-left: 3px solid #007bff !important;
}

.bc-admin-list ul li.bc-selected .bc-multi-select-checkbox {
    opacity: 1;
}

/* Shift content when checkbox visible in multi-select mode */
.bc-admin-list ul.bc-multi-select-mode li .bc-profile {
    padding-left: 28px;
}

.bc-admin-list ul.bc-multi-select-mode li > p {
    padding-left: 28px;
}

/* ==========================================
   BULK ACTION TOOLBAR (BLUE #007bff)
   ========================================== */

.bc-bulk-actions-toolbar {
    background: #007bff;
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    opacity: 0;
    max-height: 0;
    overflow: hidden;
    transition: all 0.3s ease;
}

.bc-bulk-actions-toolbar.bc-active {
    opacity: 1;
    max-height: 60px;
}

.bc-bulk-actions-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.bc-bulk-actions-left .bc-selected-count {
    color: white;
    font-weight: 600;
    font-size: 14px;
}

.bc-bulk-actions-left .bc-btn-text {
    color: white;
    font-size: 13px;
    text-decoration: underline;
    cursor: pointer;
    padding: 0;
    background: transparent;
}

.bc-bulk-actions-left .bc-btn-text:hover {
    opacity: 0.8;
}

.bc-bulk-actions-right {
    display: flex;
    gap: 8px;
}

.bc-bulk-actions-right .bc-btn-icon {
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    cursor: pointer;
    transition: all 0.2s ease;
}

.bc-bulk-actions-right .bc-btn-icon:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-1px);
}

.bc-bulk-actions-right .bc-btn-icon.bc-btn-red {
    background: rgba(239, 68, 68, 0.2);
    border-color: rgba(239, 68, 68, 0.4);
}

.bc-bulk-actions-right .bc-btn-icon.bc-btn-red:hover {
    background: rgba(239, 68, 68, 0.4);
}

/* ==========================================
   MOBILE - Touch Feedback
   ========================================== */

@media (max-width: 768px) {
    /* Always show checkbox in multi-select mode on mobile */
    .bc-admin-list ul.bc-multi-select-mode .bc-multi-select-checkbox {
        opacity: 1;
    }
    
    /* Haptic feedback visual */
    .bc-admin-list ul li.bc-selecting {
        animation: pulse 0.3s ease;
    }
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(0.98);
        background: rgba(0, 123, 255, 0.08);
    }
}

/* ==========================================
   ACCESSIBILITY
   ========================================== */

.bc-multi-select-checkbox input[type="checkbox"]:focus {
    outline: 2px solid #007bff;
    outline-offset: 2px;
}

/* ==========================================
   NOTIFICATION COUNTER - Fix Positioning
   ========================================== */

.bc-admin-list ul li .bc-notification-counter {
    position: absolute;
    top: 8px;
    right: 8px;
    background: #007bff !important;
    color: white;
    font-size: 11px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 10px;
    min-width: 20px;
    text-align: center;
    box-shadow: 0 2px 6px rgba(0, 123, 255, 0.3);
    z-index: 10;
}

/* Don't overlap with tags - add padding to conversation item */
.bc-admin-list ul li:has(.bc-notification-counter) {
    padding-right: 42px;
}

/* Alternative: if :has() not supported, use this approach */
.bc-admin-list ul li .bc-tags-bottom-container {
    margin-right: 42px; /* Space for notification counter */
}

/* ==========================================
   TAGS DISPLAY - Below Message (Horizontal Scroll)
   ========================================== */

.bc-tags-bottom-container {
    margin-top: 8px;
    padding-left: 52px; /* Align with message text */
    padding-right: 0; /* Will be overridden by notification counter space */
    overflow: hidden;
}

.bc-tags-bottom-scroll {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: 4px;
    padding-right: 4px; /* Breathing room */
    -webkit-overflow-scrolling: touch; /* Smooth scroll on iOS */
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 123, 255, 0.3) transparent;
}

/* Hide scrollbar but keep functionality */
.bc-tags-bottom-scroll::-webkit-scrollbar {
    height: 3px;
}

.bc-tags-bottom-scroll::-webkit-scrollbar-track {
    background: transparent;
}

.bc-tags-bottom-scroll::-webkit-scrollbar-thumb {
    background: rgba(0, 123, 255, 0.3);
    border-radius: 2px;
}

.bc-tags-bottom-scroll::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 123, 255, 0.5);
}

/* Tag Pills */
.bc-tag-pill {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
    color: white;
    white-space: nowrap;
    flex-shrink: 0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: all 0.2s ease;
}

.bc-tag-pill:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

/* Multi-select mode - adjust padding */
.bc-admin-list ul.bc-multi-select-mode .bc-tags-bottom-container {
    padding-left: 80px; /* More padding when checkbox visible */
}

/* ==========================================
   CONVERSATION STATUS VISUAL INDICATORS
   ========================================== */

/* Status 2: UNREAD/NEW - Bold, highlighted, blue dot */
.bc-admin-list ul li[data-conversation-status="2"] {
    background: rgba(0, 123, 255, 0.05) !important;
    border-left: 3px solid #007bff;
    position: relative;
}

.bc-admin-list ul li[data-conversation-status="2"] .bc-name {
    font-weight: 700 !important;
    color: #1F293A !important;
}

.bc-admin-list ul li[data-conversation-status="2"] > p {
    font-weight: 600 !important;
    color: #374151 !important;
}

/* Blue dot indicator for unread */
.bc-admin-list ul li[data-conversation-status="2"]::before {
    content: '';
    position: absolute;
    left: -3px;
    top: 50%;
    transform: translateY(-50%);
    width: 8px;
    height: 8px;
    background: #007bff;
    border-radius: 50%;
    border: 2px solid white;
    box-shadow: 0 0 0 1px #007bff;
}

/* Status 1: READ - Normal, muted */
.bc-admin-list ul li[data-conversation-status="1"],
.bc-admin-list ul li[data-conversation-status="0"] {
    background: transparent !important;
    opacity: 0.85;
}

.bc-admin-list ul li[data-conversation-status="1"] .bc-name,
.bc-admin-list ul li[data-conversation-status="0"] .bc-name {
    font-weight: 500 !important;
    color: #6B7280 !important;
}

.bc-admin-list ul li[data-conversation-status="1"] > p,
.bc-admin-list ul li[data-conversation-status="0"] > p {
    font-weight: 400 !important;
    color: #9CA3AF !important;
}

/* Hover state for read conversations */
.bc-admin-list ul li[data-conversation-status="1"]:hover,
.bc-admin-list ul li[data-conversation-status="0"]:hover {
    opacity: 1;
    background: rgba(0, 0, 0, 0.02) !important;
}

/* Status 3: ARCHIVED - Dimmed with archive icon */
.bc-admin-list ul li[data-conversation-status="3"] {
    opacity: 0.6;
    background: rgba(0, 0, 0, 0.02) !important;
}

.bc-admin-list ul li[data-conversation-status="3"] .bc-name::after {
    content: '📁';
    margin-left: 6px;
    font-size: 12px;
    opacity: 0.7;
}

/* Active conversation override */
.bc-admin-list ul li.bc-active {
    background: linear-gradient(to right, rgba(0, 123, 255, 0.15), rgba(0, 123, 255, 0.03)) !important;
    border-left: 3px solid #007bff !important;
    opacity: 1 !important;
}

.bc-admin-list ul li.bc-active .bc-name,
.bc-admin-list ul li.bc-active > p {
    color: #1F293A !important;
}

/* ==========================================
   REPLY INDICATOR - Green check for agent replied
   ========================================== */

.bc-admin-list ul li.bc-has-reply {
    position: relative;
}

.bc-admin-list ul li.bc-has-reply::after {
    content: '✓';
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 22px;
    height: 22px;
    background: #10B981;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: bold;
    line-height: 22px;
    text-align: center;
    box-shadow: 0 2px 6px rgba(16, 185, 129, 0.4);
    z-index: 5;
}

/* Shift time when has reply badge */
.bc-admin-list ul li.bc-has-reply .bc-time {
    padding-right: 32px;
}

/* ==========================================
   TIME DISPLAY - Different colors by status
   ========================================== */

/* Unread - Blue time */
.bc-admin-list ul li[data-conversation-status="2"] .bc-time {
    color: #007bff !important;
    font-weight: 600 !important;
}

/* Read - Grey time */
.bc-admin-list ul li[data-conversation-status="1"] .bc-time,
.bc-admin-list ul li[data-conversation-status="0"] .bc-time {
    color: #9CA3AF !important;
    font-weight: 400 !important;
}

/* ==========================================
   TRANSITIONS
   ========================================== */

.bc-admin-list ul li {
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.bc-admin-list ul li.bc-selected {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

