﻿/**
 * ============================================================================
 * MESSAGING OFF-CANVAS - FAANG-QUALITY IMPLEMENTATION
 * ============================================================================
 * 
 * Architecture: Single-panel view switching (Thread List ↔ Conversation)
 * Design System: xDocket tokens with modern interaction patterns
 * Inspiration: Slack, Linear, Gmail off-canvas patterns
 * 
 * @version 1.0.0
 * @enterprise
 * @copyright xDocket 2025
 */

/* ============================================================================
   1. DESIGN TOKENS
   ============================================================================ */

:root {
    /* Off-Canvas Dimensions */
    --offcanvas-width: 480px;
    --offcanvas-width-mobile: 100vw;
    --offcanvas-z-index: 1050;
    --offcanvas-backdrop-z: 1040;
    /* Animation & Transitions */
    --offcanvas-transition: transform 300ms cubic-bezier(0.4, 0, 0.2, 1);
    --offcanvas-fade: opacity 200ms ease;
    --view-transition: opacity 200ms ease;
    /* Spacing (inherits from xDocket tokens) */
    --oc-spacing-xs: 4px;
    --oc-spacing-sm: 8px;
    --oc-spacing-md: 16px;
    --oc-spacing-lg: 24px;
    --oc-spacing-xl: 32px;
    /* Colors */
    --oc-primary: #007AFF;
    --oc-primary-dark: #0051D5;
    --oc-primary-light: #E6F2FF;
    --oc-danger: #FF3B30;
    --oc-success: #34C759;
    --oc-success-dark: #248A3D;
    /* Grays */
    --oc-gray-50: #FAFBFC;
    --oc-gray-100: #F8F9FA;
    --oc-gray-200: #E9ECEF;
    --oc-gray-300: #DEE2E6;
    --oc-gray-400: #CED4DA;
    --oc-gray-500: #ADB5BD;
    --oc-gray-600: #6C757D;
    --oc-gray-700: #495057;
    --oc-gray-800: #343A40;
    --oc-gray-900: #212529;
    /* Shadows */
    --oc-shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.05);
    --oc-shadow-md: 0 4px 8px rgba(0, 0, 0, 0.1);
    --oc-shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);
    --oc-shadow-xl: 0 16px 48px rgba(0, 0, 0, 0.15);
    /* Border Radius */
    --oc-radius-sm: 6px;
    --oc-radius-md: 8px;
    --oc-radius-lg: 12px;
    --oc-radius-full: 9999px;
}

/* ============================================================================
   2. OFF-CANVAS CONTAINER
   ============================================================================ */

.messaging-offcanvas {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: var(--offcanvas-width);
    max-width: var(--offcanvas-width-mobile);
    background: white;
    box-shadow: var(--oc-shadow-xl);
    transform: translateX(100%);
    transition: var(--offcanvas-transition);
    z-index: var(--offcanvas-z-index);
    display: none; /* Start hidden, JS will show with flex */
    flex-direction: column;
    overflow: hidden;
}

    .messaging-offcanvas.show {
        transform: translateX(0);
    }

/* Backdrop */
.messaging-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    opacity: 0;
    visibility: hidden;
    display: none; /* Start hidden, JS will show */
    transition: opacity 300ms ease, visibility 300ms ease;
    z-index: var(--offcanvas-backdrop-z);
    backdrop-filter: blur(2px);
}

    .messaging-backdrop.show {
        opacity: 1;
        visibility: visible;
    }

/* ============================================================================
   3. PANEL HEADER (Contextual)
   ============================================================================ */

.offcanvas-header {
    flex-shrink: 0;
    background: white;
    border-bottom: 1px solid var(--oc-gray-200);
    padding: var(--oc-spacing-md) var(--oc-spacing-lg);
    display: flex;
    align-items: center;
    gap: var(--oc-spacing-md);
    min-height: 60px;
}

.offcanvas-back-btn {
    width: 36px;
    height: 36px;
    border-radius: var(--oc-radius-md);
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 150ms ease;
    background: transparent;
    border: none;
    color: var(--oc-gray-600);
    padding: 0;
}

    .offcanvas-back-btn:hover {
        background: var(--oc-gray-100);
        color: var(--oc-primary);
    }

/* Show back button in conversation view */
.messaging-offcanvas.conversation-view .offcanvas-back-btn {
    display: flex;
}

.offcanvas-title {
    flex: 1;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--oc-gray-900);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.offcanvas-close-btn {
    width: 36px;
    height: 36px;
    border-radius: var(--oc-radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 150ms ease;
    background: transparent;
    border: none;
    color: var(--oc-gray-600);
    padding: 0;
}

    .offcanvas-close-btn:hover {
        background: var(--oc-gray-100);
        color: var(--oc-danger);
    }

/* ============================================================================
   4. PANEL CONTENT (Single Container for View Switching)
   ============================================================================ */

.offcanvas-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

/* View Container - Only One Active at a Time */
.offcanvas-view {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    opacity: 0;
    visibility: hidden;
    transition: var(--view-transition);
}

    .offcanvas-view.active {
        opacity: 1;
        visibility: visible;
        position: relative;
        height: 100%; /* Ensure proper height for scroll container */
    }

/* ============================================================================
   5. THREAD LIST VIEW
   ============================================================================ */

/* Search & Filters */
.thread-list-controls {
    padding: var(--oc-spacing-md) var(--oc-spacing-lg);
    background: white;
    border-bottom: 1px solid var(--oc-gray-200);
    flex-shrink: 0;
}

.thread-search-box {
    position: relative;
    margin-bottom: var(--oc-spacing-md);
}

.thread-search-input {
    width: 100%;
    padding: var(--oc-spacing-sm) var(--oc-spacing-sm) var(--oc-spacing-sm) 36px;
    border: 1px solid var(--oc-gray-300);
    border-radius: var(--oc-radius-md);
    font-size: 0.875rem;
    transition: all 150ms ease;
}

    .thread-search-input:focus {
        outline: none;
        border-color: var(--oc-primary);
        box-shadow: 0 0 0 3px var(--oc-primary-light);
    }

.thread-search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--oc-gray-500);
    pointer-events: none;
}

/* Filter Tabs */
.thread-filter-tabs {
    display: flex;
    gap: var(--oc-spacing-sm);
}

.thread-filter-tab {
    flex: 1;
    padding: var(--oc-spacing-sm);
    background: transparent;
    border: 1px solid var(--oc-gray-300);
    border-radius: var(--oc-radius-md);
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 150ms ease;
    color: var(--oc-gray-700);
    text-align: center;
}

    .thread-filter-tab:hover {
        background: var(--oc-gray-100);
    }

    .thread-filter-tab.active {
        background: var(--oc-primary);
        color: white;
        border-color: var(--oc-primary);
    }

.thread-filter-badge {
    display: inline-block;
    background: var(--oc-danger);
    color: white;
    border-radius: var(--oc-radius-full);
    padding: 2px 6px;
    font-size: 0.7rem;
    margin-left: 4px;
    font-weight: 600;
}

.thread-filter-tab.active .thread-filter-badge {
    background: white;
    color: var(--oc-primary);
}

/* Thread List */
.thread-list {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: var(--oc-spacing-sm);
    min-height: 0; /* Critical for flex child scrolling */
}

/* Empty State */
.thread-list-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: var(--oc-spacing-xl);
    text-align: center;
    color: var(--oc-gray-500);
}

.thread-list-empty-icon {
    font-size: 3rem;
    color: var(--oc-gray-300);
    margin-bottom: var(--oc-spacing-md);
}

.thread-list-empty-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--oc-gray-700);
    margin-bottom: var(--oc-spacing-sm);
}

.thread-list-empty-text {
    font-size: 0.9rem;
    color: var(--oc-gray-500);
}

/* Thread Item */
.thread-item {
    padding: var(--oc-spacing-md);
    border-radius: var(--oc-radius-md);
    cursor: pointer;
    transition: all 150ms ease;
    margin-bottom: var(--oc-spacing-xs);
    border: 1px solid transparent;
    display: flex;
    align-items: center;
    gap: var(--oc-spacing-sm);
}

    .thread-item:hover {
        background: var(--oc-gray-50);
    }

    .thread-item.unread {
        background: var(--oc-primary-light);
    }

    .thread-item.selected {
        background: var(--oc-primary-light);
        border-color: var(--oc-primary);
    }

/* Thread Avatar */
.thread-avatar {
    width: 40px;
    height: 40px;
    border-radius: var(--oc-radius-full);
    background: var(--oc-primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.875rem;
    flex-shrink: 0;
}

    .thread-avatar img {
        width: 100%;
        height: 100%;
        border-radius: var(--oc-radius-full);
        object-fit: cover;
    }

/* Thread Info */
.thread-info {
    flex: 1;
    min-width: 0;
}

.thread-title {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--oc-gray-900);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 2px;
}

.thread-preview {
    font-size: 0.8125rem;
    color: var(--oc-gray-600);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.thread-item.unread .thread-preview {
    font-weight: 500;
    color: var(--oc-gray-800);
}

/* Thread Meta */
.thread-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
    flex-shrink: 0;
}

.thread-time {
    font-size: 0.75rem;
    color: var(--oc-gray-500);
}

.thread-item.unread .thread-time {
    color: var(--oc-primary);
    font-weight: 600;
}

.thread-unread-dot {
    width: 8px;
    height: 8px;
    background: var(--oc-primary);
    border-radius: var(--oc-radius-full);
}

/* New Thread FAB */
.new-thread-fab {
    position: absolute;
    bottom: var(--oc-spacing-lg);
    right: var(--oc-spacing-lg);
    width: 56px;
    height: 56px;
    border-radius: var(--oc-radius-full);
    background: var(--oc-success);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    cursor: pointer;
    border: none;
    box-shadow: var(--oc-shadow-md);
    transition: all 150ms ease;
    z-index: 10;
}

    .new-thread-fab:hover {
        transform: scale(1.1);
        box-shadow: var(--oc-shadow-lg);
        background: var(--oc-success-dark);
    }

/* Hide FAB in conversation view */
.messaging-offcanvas.conversation-view .new-thread-fab {
    display: none;
}

/* ============================================================================
   6. CONVERSATION VIEW
   ============================================================================ */

/* Conversation Header */
.conversation-header {
    padding: var(--oc-spacing-md) var(--oc-spacing-lg);
    background: white;
    border-bottom: 1px solid var(--oc-gray-200);
    flex-shrink: 0;
}

.conversation-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--oc-gray-900);
    margin-bottom: 4px;
}

.conversation-subtitle {
    font-size: 0.8125rem;
    color: var(--oc-gray-600);
}

/* Messages Area */
.conversation-messages {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: var(--oc-spacing-lg);
    background: var(--oc-gray-50);
    min-height: 0; /* Critical for flex child scrolling */
}

/* Message Groups (collapse consecutive messages from same user) */
.message-group {
    margin-bottom: var(--oc-spacing-lg);
}

.message {
    display: flex;
    gap: var(--oc-spacing-sm);
    margin-bottom: var(--oc-spacing-sm);
}

    .message.own {
        flex-direction: row-reverse;
    }

    /* Only show avatar on first message in group */
    .message.grouped .message-avatar {
        visibility: hidden;
    }

/* Message Avatar */
.message-avatar {
    width: 32px;
    height: 32px;
    border-radius: var(--oc-radius-full);
    background: var(--oc-gray-300);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.75rem;
    flex-shrink: 0;
}

.message.own .message-avatar {
    background: var(--oc-primary);
}

/* Message Content */
.message-content {
    max-width: 70%;
}

.message.own .message-content {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.message-bubble {
    padding: var(--oc-spacing-sm) var(--oc-spacing-md);
    border-radius: var(--oc-radius-md);
    background: white;
    box-shadow: var(--oc-shadow-sm);
    word-wrap: break-word;
}

.message.own .message-bubble {
    background: var(--oc-primary);
    color: white;
}

.message-text {
    font-size: 0.9375rem;
    line-height: 1.5;
}

.message-meta {
    margin-top: 4px;
    font-size: 0.75rem;
    color: var(--oc-gray-500);
    display: flex;
    align-items: center;
    gap: 4px;
}

.message.own .message-meta {
    color: var(--oc-gray-400);
}

/* Date Dividers */
.message-date-divider {
    text-align: center;
    margin: var(--oc-spacing-lg) 0;
}

.message-date-divider-text {
    display: inline-block;
    padding: var(--oc-spacing-xs) var(--oc-spacing-md);
    background: var(--oc-gray-200);
    color: var(--oc-gray-600);
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: var(--oc-radius-full);
}

/* Message Composer */
.message-composer {
    padding: var(--oc-spacing-md) var(--oc-spacing-lg);
    background: white;
    border-top: 1px solid var(--oc-gray-200);
    flex-shrink: 0;
}

.composer-input-area {
    display: flex;
    gap: var(--oc-spacing-sm);
    align-items: flex-end;
}

.composer-input {
    flex: 1;
    padding: var(--oc-spacing-sm) var(--oc-spacing-md);
    border: 1px solid var(--oc-gray-300);
    border-radius: var(--oc-radius-md);
    font-size: 0.9375rem;
    font-family: inherit;
    resize: none;
    max-height: 120px;
    transition: all 150ms ease;
    min-height: 40px;
}

    .composer-input:focus {
        outline: none;
        border-color: var(--oc-primary);
        box-shadow: 0 0 0 3px var(--oc-primary-light);
    }

.composer-send-btn {
    width: 40px;
    height: 40px;
    border-radius: var(--oc-radius-md);
    background: var(--oc-primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    cursor: pointer;
    transition: all 150ms ease;
    flex-shrink: 0;
}

    .composer-send-btn:hover {
        background: var(--oc-primary-dark);
        transform: translateY(-2px);
    }

    .composer-send-btn:disabled {
        background: var(--oc-gray-300);
        cursor: not-allowed;
        transform: none;
    }

/* ============================================================================
   7. KEYBOARD SHORTCUTS HINT
   ============================================================================ */

.keyboard-hint {
    padding: var(--oc-spacing-sm) var(--oc-spacing-md);
    background: var(--oc-gray-100);
    border-radius: var(--oc-radius-md);
    font-size: 0.75rem;
    color: var(--oc-gray-600);
    text-align: center;
    margin-bottom: var(--oc-spacing-sm);
}

    .keyboard-hint kbd {
        padding: 2px 6px;
        background: white;
        border: 1px solid var(--oc-gray-300);
        border-radius: 4px;
        font-family: monospace;
        font-size: 0.7rem;
        color: var(--oc-gray-700, #374151);
    }

/* ============================================================================
   8. LOADING STATES & SKELETONS
   ============================================================================ */

.offcanvas-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
}

.offcanvas-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--oc-gray-200);
    border-top-color: var(--oc-primary);
    border-radius: var(--oc-radius-full);
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Skeleton Loaders */
.thread-skeleton,
.message-skeleton {
    padding: var(--oc-spacing-md);
    margin-bottom: var(--oc-spacing-sm);
}

.skeleton {
    background: linear-gradient(90deg, var(--oc-gray-200) 25%, var(--oc-gray-100) 50%, var(--oc-gray-200) 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s ease-in-out infinite;
    border-radius: var(--oc-radius-sm);
}

@keyframes skeleton-loading {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

.skeleton-circle {
    width: 40px;
    height: 40px;
    border-radius: var(--oc-radius-full);
}

.skeleton-text {
    height: 12px;
    margin-bottom: 8px;
}

    .skeleton-text.short {
        width: 60%;
    }

/* ============================================================================
   9. RESPONSIVE DESIGN
   ============================================================================ */

@media (max-width: 768px) {
    .messaging-offcanvas {
        width: 100vw;
        max-width: 100vw;
    }

    .message-content {
        max-width: 85%;
    }

    .new-thread-fab {
        bottom: var(--oc-spacing-md);
        right: var(--oc-spacing-md);
    }
}

/* ============================================================================
   10. ACCESSIBILITY
   ============================================================================ */

/* Focus visible for keyboard navigation */
.offcanvas-back-btn:focus-visible,
.offcanvas-close-btn:focus-visible,
.thread-filter-tab:focus-visible,
.thread-item:focus-visible,
.composer-send-btn:focus-visible,
.new-thread-fab:focus-visible {
    outline: 2px solid var(--oc-primary);
    outline-offset: 2px;
}

/* Screen reader only content */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .messaging-offcanvas,
    .messaging-backdrop,
    .offcanvas-view,
    .thread-item,
    .message,
    .offcanvas-back-btn,
    .offcanvas-close-btn,
    .thread-filter-tab,
    .composer-send-btn,
    .new-thread-fab {
        transition: none;
    }

    .offcanvas-spinner,
    .skeleton {
        animation: none;
    }
}

/* High contrast mode */
@media (prefers-contrast: high) {
    .messaging-offcanvas {
        border-left: 2px solid currentColor;
    }

    .thread-item,
    .message-bubble {
        border: 1px solid currentColor;
    }
}

/* ============================================================
   MESSAGING OFF-CANVAS - ENHANCED CONVERSATION HEADER
   Beautiful, contextually appropriate header design
   ============================================================ */

/* Conversation Header Container */
.conversation-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    background: var(--msg-bg-primary, #ffffff);
    border-bottom: 1px solid var(--msg-border-color, #e5e7eb);
    position: relative;
    z-index: 10;
    /* Add relative positioning for dropdown */
}

    /* Back Button */
    .conversation-header .back-btn {
        flex-shrink: 0;
        width: 36px;
        height: 36px;
        display: flex;
        align-items: center;
        justify-content: center;
        background: transparent;
        border: none;
        border-radius: 8px;
        color: var(--msg-text-secondary, #6b7280);
        cursor: pointer;
        transition: all 0.2s ease;
    }

        .conversation-header .back-btn:hover {
            background: var(--msg-bg-hover, #f3f4f6);
            color: var(--msg-text-primary, #111827);
        }

        .conversation-header .back-btn:active {
            transform: scale(0.95);
        }

        .conversation-header .back-btn i {
            font-size: 20px;
        }

    /* Conversation Avatar */
    .conversation-header .conversation-avatar {
        flex-shrink: 0;
        width: 40px;
        height: 40px;
        border-radius: 50%;
        overflow: hidden;
        background: var(--msg-bg-secondary, #f9fafb);
        display: flex;
        align-items: center;
        justify-content: center;
        font-weight: 600;
        font-size: 14px;
        color: var(--msg-text-primary, #111827);
    }

        .conversation-header .conversation-avatar img {
            width: 100%;
            height: 100%;
            object-fit: cover;
        }

    /* Conversation Info Section */
    .conversation-header .conversation-info {
        flex: 1;
        min-width: 0; /* Allow text truncation */
        display: flex;
        flex-direction: column;
        gap: 2px;
    }

    .conversation-header .conversation-title {
        font-size: 15px;
        font-weight: 600;
        color: var(--msg-text-primary, #111827);
        line-height: 1.4;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .conversation-header .conversation-status {
        display: flex;
        align-items: center;
        gap: 8px;
        font-size: 13px;
        color: var(--msg-text-tertiary, #9ca3af);
        line-height: 1.4;
    }

        .conversation-header .conversation-status .participants-count {
            white-space: nowrap;
        }

        .conversation-header .conversation-status .online-indicator {
            display: flex;
            align-items: center;
            gap: 5px;
            white-space: nowrap;
        }

        .conversation-header .conversation-status .online-dot {
            width: 6px;
            height: 6px;
            border-radius: 50%;
            background: #10b981;
            display: inline-block;
            animation: pulse-online 2s ease-in-out infinite;
        }

/* Matter Context Badge */
.matter-context-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.08) 0%, rgba(5, 150, 105, 0.12) 100%);
    border: 1px solid rgba(16, 185, 129, 0.2);
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    color: #059669;
    margin-top: 4px;
    transition: all 0.2s ease;
}

    .matter-context-badge:hover {
        background: linear-gradient(135deg, rgba(16, 185, 129, 0.12) 0%, rgba(5, 150, 105, 0.16) 100%);
        border-color: rgba(16, 185, 129, 0.3);
        transform: translateY(-1px);
        box-shadow: 0 2px 4px rgba(16, 185, 129, 0.1);
    }

    .matter-context-badge i {
        font-size: 14px;
        color: #059669;
    }

    .matter-context-badge .matter-link {
        color: #059669;
        text-decoration: none;
        font-weight: 600;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 180px;
    }

        .matter-context-badge .matter-link:hover {
            color: #047857;
            text-decoration: underline;
        }

@keyframes pulse-online {
    0%, 100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

/* Conversation Actions */
.conversation-header .conversation-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.conversation-header .action-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: 8px;
    color: var(--msg-text-secondary, #6b7280);
    cursor: pointer;
    transition: all 0.2s ease;
}

    .conversation-header .action-btn:hover {
        background: var(--msg-bg-hover, #f3f4f6);
        color: var(--msg-text-primary, #111827);
    }

    .conversation-header .action-btn:active {
        transform: scale(0.95);
    }

    .conversation-header .action-btn i {
        font-size: 18px;
    }

/* Responsive Adjustments */
@media (max-width: 480px) {
    .conversation-header {
        padding: 12px 16px;
        gap: 10px;
    }

        .conversation-header .conversation-avatar {
            width: 36px;
            height: 36px;
            font-size: 13px;
        }

        .conversation-header .conversation-title {
            font-size: 14px;
        }

        .conversation-header .conversation-status {
            font-size: 12px;
        }

        .conversation-header .back-btn,
        .conversation-header .action-btn {
            width: 32px;
            height: 32px;
        }

            .conversation-header .back-btn i,
            .conversation-header .action-btn i {
                font-size: 18px;
            }
}

/* Dark Mode Support (if applicable) */
@media (prefers-color-scheme: dark) {
    .conversation-header {
        background: var(--msg-bg-primary-dark, #1f2937);
        border-bottom-color: var(--msg-border-color-dark, #374151);
    }

        .conversation-header .back-btn,
        .conversation-header .action-btn {
            color: var(--msg-text-secondary-dark, #9ca3af);
        }

            .conversation-header .back-btn:hover,
            .conversation-header .action-btn:hover {
                background: var(--msg-bg-hover-dark, #374151);
                color: var(--msg-text-primary-dark, #f9fafb);
            }

        .conversation-header .conversation-title {
            color: var(--msg-text-primary-dark, #f9fafb);
        }

        .conversation-header .conversation-status {
            color: var(--msg-text-tertiary-dark, #6b7280);
        }

        .conversation-header .conversation-avatar {
            background: var(--msg-bg-secondary-dark, #374151);
            color: var(--msg-text-primary-dark, #f9fafb);
        }
}

/* Enhanced States */
.conversation-header .action-btn[aria-pressed="true"],
.conversation-header .action-btn.active {
    background: var(--msg-accent-bg, #eff6ff);
    color: var(--msg-accent-color, #3b82f6);
}

.conversation-header .action-btn:focus-visible {
    outline: 2px solid var(--msg-accent-color, #3b82f6);
    outline-offset: 2px;
}

.conversation-header .back-btn:focus-visible {
    outline: 2px solid var(--msg-accent-color, #3b82f6);
    outline-offset: 2px;
}

/* Separator between status items */
.conversation-header .conversation-status > *:not(:last-child)::after {
    content: '•';
    margin-left: 8px;
    color: var(--msg-text-quaternary, #d1d5db);
}

/* ============================================================
   INFO DROPDOWN
   Contextual information panel for thread details
   ============================================================ */

.info-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    width: 320px;
    max-width: calc(100vw - 40px);
    background: var(--msg-bg-primary, #ffffff);
    border: 1px solid var(--msg-border-color, #e5e7eb);
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1), 0 4px 10px rgba(0, 0, 0, 0.05);
    z-index: 1000;
    animation: dropdownSlideIn 0.2s ease-out;
    margin-top: 8px;
}

@keyframes dropdownSlideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.info-dropdown-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    border-bottom: 1px solid var(--msg-border-color, #e5e7eb);
}

    .info-dropdown-header h6 {
        margin: 0;
        font-size: 15px;
        font-weight: 600;
        color: var(--msg-text-primary, #111827);
    }

.info-dropdown-close {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: 6px;
    color: var(--msg-text-secondary, #6b7280);
    cursor: pointer;
    transition: all 0.2s ease;
}

    .info-dropdown-close:hover {
        background: var(--msg-bg-hover, #f3f4f6);
        color: var(--msg-text-primary, #111827);
    }

    .info-dropdown-close i {
        font-size: 16px;
    }

.info-dropdown-content {
    padding: 16px;
    max-height: 60vh;
    overflow-y: auto;
    scrollbar-width: thin;
}

    .info-dropdown-content::-webkit-scrollbar {
        width: 6px;
    }

    .info-dropdown-content::-webkit-scrollbar-track {
        background: transparent;
    }

    .info-dropdown-content::-webkit-scrollbar-thumb {
        background: var(--msg-border-color, #e5e7eb);
        border-radius: 3px;
    }

.info-dropdown-section {
    margin-bottom: 16px;
}

    .info-dropdown-section:last-child {
        margin-bottom: 0;
    }

.info-dropdown-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--msg-text-tertiary, #9ca3af);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.info-dropdown-value {
    font-size: 14px;
    color: var(--msg-text-primary, #111827);
    line-height: 1.5;
    word-break: break-word;
}

    .info-dropdown-value.thread-id {
        font-family: 'Courier New', monospace;
        font-size: 13px;
        color: var(--msg-text-secondary, #6b7280);
    }

.info-dropdown-divider {
    height: 1px;
    background: var(--msg-border-color, #e5e7eb);
    margin: 16px 0;
}

/* Participants List */
.info-dropdown-participants {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 8px;
}

.info-dropdown-participant {
    display: flex;
    align-items: center;
    gap: 10px;
}

    .info-dropdown-participant .participant-avatar {
        width: 36px;
        height: 36px;
        border-radius: 50%;
        background: var(--msg-bg-secondary, #f9fafb);
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 13px;
        font-weight: 600;
        color: var(--msg-text-primary, #111827);
        flex-shrink: 0;
    }

    .info-dropdown-participant .participant-details {
        flex: 1;
        min-width: 0;
    }

    .info-dropdown-participant .participant-name {
        font-size: 14px;
        font-weight: 500;
        color: var(--msg-text-primary, #111827);
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .info-dropdown-participant .participant-status {
        font-size: 12px;
        color: var(--msg-text-tertiary, #9ca3af);
        margin-top: 2px;
    }

        .info-dropdown-participant .participant-status.online {
            color: #10b981;
        }

        .info-dropdown-participant .participant-status.offline {
            color: var(--msg-text-tertiary, #9ca3af);
        }

/* Mobile Responsive */
@media (max-width: 480px) {
    .info-dropdown {
        width: 280px;
        max-width: calc(100vw - 32px);
    }

    .info-dropdown-header,
    .info-dropdown-content {
        padding: 12px;
    }

    .info-dropdown-section {
        margin-bottom: 12px;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .info-dropdown {
        background: var(--msg-bg-primary-dark, #1f2937);
        border-color: var(--msg-border-color-dark, #374151);
        box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3), 0 4px 10px rgba(0, 0, 0, 0.2);
    }

    .info-dropdown-header {
        border-bottom-color: var(--msg-border-color-dark, #374151);
    }

        .info-dropdown-header h6 {
            color: var(--msg-text-primary-dark, #f9fafb);
        }

    .info-dropdown-close {
        color: var(--msg-text-secondary-dark, #9ca3af);
    }

        .info-dropdown-close:hover {
            background: var(--msg-bg-hover-dark, #374151);
            color: var(--msg-text-primary-dark, #f9fafb);
        }

    .info-dropdown-label {
        color: var(--msg-text-tertiary-dark, #6b7280);
    }

    .info-dropdown-value {
        color: var(--msg-text-primary-dark, #f9fafb);
    }

        .info-dropdown-value.thread-id {
            color: var(--msg-text-secondary-dark, #9ca3af);
        }

    .info-dropdown-divider {
        background: var(--msg-border-color-dark, #374151);
    }

    .info-dropdown-participant .participant-avatar {
        background: var(--msg-bg-secondary-dark, #374151);
        color: var(--msg-text-primary-dark, #f9fafb);
    }

    .info-dropdown-participant .participant-name {
        color: var(--msg-text-primary-dark, #f9fafb);
    }

    .info-dropdown-participant .participant-status.offline {
        color: var(--msg-text-tertiary-dark, #6b7280);
    }
}
/* ============================================================
   INFO DROPDOWN TABS & ENHANCED FEATURES
   Tabbed navigation and advanced dropdown features
   ============================================================ */

/* Info Dropdown Tabs */
.info-dropdown-tabs {
    display: flex;
    border-bottom: 1px solid var(--msg-border-color, #e5e7eb);
    padding: 0 16px;
    gap: 4px;
}

.info-dropdown-tab {
    flex: 1;
    padding: 10px 12px;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--msg-text-secondary, #6b7280);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

    .info-dropdown-tab:hover {
        color: var(--msg-text-primary, #111827);
        background: var(--msg-bg-hover, #f9fafb);
    }

    .info-dropdown-tab.active {
        color: var(--msg-accent-color, #3b82f6);
        border-bottom-color: var(--msg-accent-color, #3b82f6);
    }

/* Loading State */
.info-dropdown-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 32px 16px;
    gap: 12px;
}

    .info-dropdown-loading .spinner {
        width: 24px;
        height: 24px;
        border: 2px solid var(--msg-border-color, #e5e7eb);
        border-top-color: var(--msg-accent-color, #3b82f6);
        border-radius: 50%;
        animation: spinDropdown 0.8s linear infinite;
    }

    .info-dropdown-loading .loading-text {
        font-size: 13px;
        color: var(--msg-text-tertiary, #9ca3af);
    }

@keyframes spinDropdown {
    to {
        transform: rotate(360deg);
    }
}

/* Error State */
.info-dropdown-error {
    padding: 16px;
    text-align: center;
    color: #ef4444;
    font-size: 13px;
}

/* Empty State */
.info-dropdown-empty {
    padding: 32px 16px;
    text-align: center;
    color: var(--msg-text-tertiary, #9ca3af);
    font-size: 13px;
}

/* Settings List */
.info-dropdown-settings {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.info-dropdown-setting-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px;
    background: var(--msg-bg-secondary, #f9fafb);
    border-radius: 8px;
}

    .info-dropdown-setting-item .setting-info {
        flex: 1;
    }

    .info-dropdown-setting-item .setting-label {
        font-size: 14px;
        font-weight: 500;
        color: var(--msg-text-primary, #111827);
    }

    .info-dropdown-setting-item .setting-description {
        font-size: 12px;
        color: var(--msg-text-tertiary, #9ca3af);
        margin-top: 2px;
    }

.info-dropdown-toggle {
    position: relative;
    width: 44px;
    height: 24px;
}

    .info-dropdown-toggle input {
        opacity: 0;
        width: 0;
        height: 0;
    }

    .info-dropdown-toggle .toggle-slider {
        position: absolute;
        cursor: pointer;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: var(--msg-border-color, #e5e7eb);
        transition: 0.3s;
        border-radius: 24px;
    }

        .info-dropdown-toggle .toggle-slider:before {
            position: absolute;
            content: "";
            height: 18px;
            width: 18px;
            left: 3px;
            bottom: 3px;
            background: white;
            transition: 0.3s;
            border-radius: 50%;
        }

    .info-dropdown-toggle input:checked + .toggle-slider {
        background: var(--msg-accent-color, #3b82f6);
    }

        .info-dropdown-toggle input:checked + .toggle-slider:before {
            transform: translateX(20px);
        }

.info-dropdown-danger-btn {
    width: 100%;
    padding: 10px 16px;
    background: transparent;
    border: 1px solid #ef4444;
    border-radius: 8px;
    color: #ef4444;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

    .info-dropdown-danger-btn:hover {
        background: #ef4444;
        color: white;
    }

/* Files List */
.info-dropdown-files {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.info-dropdown-file-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--msg-bg-secondary, #f9fafb);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

    .info-dropdown-file-item:hover {
        background: var(--msg-bg-hover, #f3f4f6);
    }

    .info-dropdown-file-item .file-icon {
        width: 40px;
        height: 40px;
        display: flex;
        align-items: center;
        justify-content: center;
        background: white;
        border: 1px solid var(--msg-border-color, #e5e7eb);
        border-radius: 8px;
        font-size: 20px;
        flex-shrink: 0;
    }

    .info-dropdown-file-item .file-info {
        flex: 1;
        min-width: 0;
    }

    .info-dropdown-file-item .file-name {
        font-size: 13px;
        font-weight: 500;
        color: var(--msg-text-primary, #111827);
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .info-dropdown-file-item .file-meta {
        font-size: 11px;
        color: var(--msg-text-tertiary, #9ca3af);
        margin-top: 2px;
    }

    .info-dropdown-file-item .participant-role {
        font-size: 12px;
        color: var(--msg-text-tertiary, #9ca3af);
        margin-top: 2px;
    }

/* Message Notification Progress Bar - High Specificity Override */
.msg-notification .msg-notification-progress {
    height: 3px !important;
    background: linear-gradient(90deg, #3b82f6 0%, #8b5cf6 100%) !important;
    width: 100% !important;
    transition: width 5000ms linear !important;
}

/* Ensure container positioning */
.message-notification-container {
    position: fixed !important;
    bottom: 20px !important;
    right: 20px !important;
    z-index: 10998 !important;
}
/* NUCLEAR FIX - Message Notification Progress Bar */
.msg-notification .msg-notification-progress {
    display: block !important;
    height: 3px !important;
    background: linear-gradient(90deg, #3b82f6 0%, #8b5cf6 100%) !important;
    width: 100% !important;
    transition: width 5000ms linear !important;
    position: relative !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    opacity: 1 !important;
    visibility: visible !important;
    z-index: 1 !important;
}

/* FORCE Message Notification Container to Bottom Right */
.message-notification-container {
    position: fixed !important;
    bottom: 20px !important;
    right: 20px !important;
    top: auto !important;
    left: auto !important;
    z-index: 9998 !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 12px !important;
    pointer-events: none !important;
}

/* Mobile positioning */
@media (max-width: 640px) {
    .message-notification-container {
        bottom: 12px !important;
        right: 12px !important;
        left: 12px !important;
        top: auto !important;
    }
}