/* ============================================================================
   Nabdi Consultations Chat - WhatsApp-style Messaging Interface
   ============================================================================
   
   Design Principles:
   - WhatsApp-inspired conversational UI
   - RTL-first responsive design  
   - Clean message bubbles with proper alignment
   - Smooth animations and transitions
   - Mobile-optimized touch targets
   ============================================================================ */

/* ============================================================================
   CSS Custom Properties - Chat Theme
   ============================================================================ */
:root {
    /* Chat Colors */
    --chat-bg: #f5f1ed;
    --chat-sidebar-bg: #ffffff;
    --chat-header-bg: #ffffff;
    --chat-messages-bg: #ebe5de;
    --chat-input-bg: #ffffff;
    
    /* Message Bubbles */
    --chat-bubble-mine: #dcf8c6;
    --chat-bubble-mine-border: #c5e1a5;
    --chat-bubble-theirs: #ffffff;
    --chat-bubble-theirs-border: #e0e0e0;
    --chat-bubble-shadow: rgba(0, 0, 0, 0.05);
    
    /* Status Colors */
    --chat-status-new: #3b82f6;
    --chat-status-review: #f59e0b;
    --chat-status-answered: #10b981;
    --chat-status-closed: #6b7280;
    
    /* Text */
    --chat-text-primary: #1a1a1a;
    --chat-text-secondary: #5a5a5a;
    --chat-text-muted: #8a8a8a;
    --chat-text-time: #667781;
    
    /* Unread */
    --chat-unread-bg: var(--chat-send-btn);
    --chat-unread-text: #ffffff;
    
    /* Input */
    --chat-input-border: #e0ddd8;
    --chat-send-btn: #c4a882;
    --chat-send-btn-hover: #a88b63;
    
    /* Sizing */
    --chat-sidebar-width: 380px;
    --chat-header-height: 64px;
    --chat-input-height: 72px;
    --chat-avatar-size: 48px;
}

/* ============================================================================
   Privacy Banner - Subtle footer notice in sidebar
   ============================================================================ */
.chat-privacy-banner {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    background: rgba(196, 168, 130, 0.06);
    border-top: 1px solid rgba(196, 168, 130, 0.15);
    font-size: 0.75rem;
    color: var(--chat-text-muted);
    line-height: 1.4;
    margin-top: auto;
    transition: all 0.3s ease;
}

.chat-privacy-banner svg {
    color: var(--chat-send-btn);
    flex-shrink: 0;
    opacity: 0.7;
}

.chat-privacy-banner span {
    flex: 1;
    font-size: 0.75rem;
}

.privacy-banner-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border: none;
    background: transparent;
    color: var(--chat-text-muted);
    cursor: pointer;
    border-radius: 50%;
    transition: all 0.2s ease;
    flex-shrink: 0;
    opacity: 0.6;
}

.privacy-banner-close:hover {
    background: rgba(0, 0, 0, 0.05);
    opacity: 1;
}

.chat-privacy-banner.hidden {
    display: none;
}

/* ============================================================================
   Main Layout - Split View
   ============================================================================ */
.consultations-layout {
    display: flex;
    height: calc(100vh - 70px);
    background: var(--chat-bg);
    overflow: hidden;
    position: relative;
}

/* ============================================================================
   Sidebar - Conversation List
   ============================================================================ */
.chat-sidebar {
    width: var(--chat-sidebar-width);
    max-width: 100%;
    background: var(--chat-sidebar-bg);
    border-left: 1px solid var(--dash-border);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    transition: transform 0.3s ease;
}

.chat-sidebar-header {
    padding: 16px 20px;
    background: var(--chat-header-bg);
    border-bottom: 1px solid var(--dash-border-light);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    min-height: var(--chat-header-height);
}

.chat-sidebar-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--chat-text-primary);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.chat-sidebar-title .unread-badge {
    background: var(--chat-unread-bg);
    color: var(--chat-unread-text);
    font-size: 0.75rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 12px;
    min-width: 20px;
    text-align: center;
}

.new-chat-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--chat-send-btn) 0%, var(--chat-send-btn-hover) 100%);
    color: white;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 8px rgba(196, 168, 130, 0.3);
    position: relative;
    overflow: hidden;
}

.new-chat-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle, rgba(255,255,255,0.3) 0%, transparent 70%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.new-chat-btn:hover {
    background: linear-gradient(135deg, var(--chat-send-btn-hover) 0%, #9a7b5a 100%);
    transform: scale(1.08) rotate(90deg);
    box-shadow: 0 4px 16px rgba(196, 168, 130, 0.45);
}

.new-chat-btn:hover::before {
    opacity: 1;
}

.new-chat-btn:active {
    transform: scale(0.98) rotate(90deg);
}

.new-chat-btn svg {
    width: 20px;
    height: 20px;
    transition: transform 0.3s ease;
}

.new-chat-btn:hover svg {
    transform: rotate(-90deg);
}

/* Search Box */
.chat-search-box {
    padding: 8px 16px;
    background: var(--chat-sidebar-bg);
    border-bottom: 1px solid var(--dash-border-light);
}

.chat-search-input {
    width: 100%;
    padding: 10px 16px;
    border: 1px solid var(--chat-input-border);
    border-radius: 24px;
    font-size: 0.9375rem;
    background: var(--chat-bg);
    color: var(--chat-text-primary);
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.chat-search-input:focus {
    border-color: var(--chat-send-btn);
    box-shadow: 0 0 0 3px rgba(196, 168, 130, 0.15);
}

.chat-search-input::placeholder {
    color: var(--chat-text-muted);
}

/* Filter Tabs */
.chat-filter-tabs {
    display: flex;
    padding: 8px 16px;
    gap: 8px;
    background: var(--chat-sidebar-bg);
    border-bottom: 1px solid var(--dash-border-light);
    overflow-x: auto;
    scrollbar-width: none;
}

.chat-filter-tabs::-webkit-scrollbar {
    display: none;
}

.chat-filter-tab {
    padding: 6px 14px;
    border: 1px solid var(--dash-border);
    border-radius: 20px;
    background: transparent;
    color: var(--chat-text-secondary);
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s ease;
}

.chat-filter-tab:hover {
    background: var(--chat-bg);
    border-color: var(--chat-send-btn);
}

.chat-filter-tab.active {
    background: var(--chat-send-btn);
    border-color: var(--chat-send-btn);
    color: white;
}

/* Conversation List */
.chat-list {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
}

.chat-list-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    text-align: center;
    color: var(--chat-text-muted);
}

.chat-list-empty svg {
    width: 64px;
    height: 64px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.chat-list-empty h3 {
    font-size: 1rem;
    color: var(--chat-text-secondary);
    margin: 0 0 8px 0;
}

.chat-list-empty p {
    font-size: 0.875rem;
    margin: 0;
}

/* Conversation Item */
.chat-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    cursor: pointer;
    border-bottom: 1px solid var(--dash-border-light);
    transition: background-color 0.15s ease;
    position: relative;
}

.chat-item:hover {
    background: var(--chat-bg);
}

.chat-item.active {
    background: rgba(196, 168, 130, 0.12);
}

.chat-item.unread {
    background: rgba(37, 211, 102, 0.05);
}

.chat-item.unread::before {
    content: '';
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 60%;
    background: var(--chat-unread-bg);
    border-radius: 0 4px 4px 0;
}

/* Chat Avatar */
.chat-avatar {
    width: var(--chat-avatar-size);
    height: var(--chat-avatar-size);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
    background: linear-gradient(135deg, var(--dash-accent-light) 0%, rgba(196, 168, 130, 0.2) 100%);
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(93, 64, 55, 0.1);
}

.chat-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

/* Chat Info */
.chat-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.chat-info-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}

.chat-topic {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--chat-text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-time {
    font-size: 0.75rem;
    color: var(--chat-text-time);
    flex-shrink: 0;
}

.chat-item.unread .chat-time {
    color: var(--chat-unread-bg);
    font-weight: 600;
}

.chat-info-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}

.chat-preview {
    font-size: 0.8125rem;
    color: var(--chat-text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}

.chat-item.unread .chat-preview {
    color: var(--chat-text-primary);
    font-weight: 500;
}

.chat-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.chat-unread-count {
    background: var(--chat-unread-bg);
    color: var(--chat-unread-text);
    font-size: 0.6875rem;
    font-weight: 700;
    min-width: 20px;
    height: 20px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 6px;
}

.chat-status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.chat-status-dot.new { background: var(--chat-status-new); }
.chat-status-dot.in_review { background: var(--chat-status-review); }
.chat-status-dot.answered { background: var(--chat-status-answered); }
.chat-status-dot.closed { background: var(--chat-status-closed); }

/* ============================================================================
   Main Chat Area
   ============================================================================ */
.chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--chat-messages-bg);
    min-width: 0;
    position: relative;
    overflow: hidden;
}

/* Chat View Container */
.chat-view {
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100%;
}

/* Empty State */
.chat-empty-state {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 24px;
    text-align: center;
    background: linear-gradient(180deg, var(--chat-messages-bg) 0%, #e8e2d9 100%);
}

.chat-empty-state svg {
    width: 100px;
    height: 100px;
    margin-bottom: 28px;
    color: var(--chat-send-btn);
    opacity: 0.4;
    stroke-width: 1.2;
}

.chat-empty-state h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--chat-text-primary);
    margin: 0 0 12px 0;
    font-family: 'Scheherazade New', serif;
}

.chat-empty-state p {
    font-size: 1rem;
    color: var(--chat-text-secondary);
    margin: 0 0 32px 0;
    max-width: 380px;
    line-height: 1.7;
}

.chat-empty-state .btn-start-chat {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px 32px;
    background: transparent;
    color: var(--chat-send-btn-hover);
    border: 2px solid var(--chat-send-btn);
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    font-family: 'Scheherazade New', serif;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    min-height: 52px;
}

.chat-empty-state .btn-start-chat::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, var(--chat-send-btn) 0%, var(--chat-send-btn-hover) 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: -1;
}

.chat-empty-state .btn-start-chat svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    transition: transform 0.3s ease;
}

.chat-empty-state .btn-start-chat:hover {
    color: white;
    border-color: transparent;
    box-shadow: 0 8px 24px rgba(196, 168, 130, 0.4);
    transform: translateY(-2px);
}

.chat-empty-state .btn-start-chat:hover::before {
    opacity: 1;
}

.chat-empty-state .btn-start-chat:hover svg {
    transform: rotate(90deg);
}

.chat-empty-state .btn-start-chat:active {
    transform: translateY(0);
    box-shadow: 0 4px 12px rgba(196, 168, 130, 0.3);
}

/* Chat Header */
.chat-header {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 24px;
    background: var(--chat-header-bg);
    border-bottom: 1px solid var(--dash-border-light);
    min-height: var(--chat-header-height);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    position: relative;
    z-index: 5;
    flex-shrink: 0;
}

.chat-back-btn {
    display: none;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: none;
    background: transparent;
    color: var(--chat-text-secondary);
    cursor: pointer;
    border-radius: 50%;
    transition: all 0.2s ease;
    margin-inline-end: -4px;
}

.chat-back-btn:hover {
    background: var(--chat-bg);
    color: var(--chat-text-primary);
}

.chat-back-btn:active {
    transform: scale(0.95);
}

.chat-header-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    background: linear-gradient(135deg, #f8f4ef 0%, #efe8dd 100%);
    border: 2px solid rgba(196, 168, 130, 0.2);
    flex-shrink: 0;
    overflow: hidden;
}

.chat-header-avatar img,
.chat-header-avatar .chat-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.chat-header-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.chat-header-title {
    font-size: 1.0625rem;
    font-weight: 700;
    color: var(--chat-text-primary);
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

.chat-header-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8125rem;
    color: var(--chat-text-muted);
}

.chat-header-status .status-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.01em;
}

.chat-header-status .status-badge::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
}

.chat-header-status .status-badge.new {
    background: rgba(59, 130, 246, 0.12);
    color: var(--chat-status-new);
}

.chat-header-status .status-badge.new::before {
    background: var(--chat-status-new);
}

.chat-header-status .status-badge.in_review {
    background: rgba(245, 158, 11, 0.12);
    color: var(--chat-status-review);
}

.chat-header-status .status-badge.in_review::before {
    background: var(--chat-status-review);
}

.chat-header-status .status-badge.answered {
    background: rgba(16, 185, 129, 0.12);
    color: var(--chat-status-answered);
}

.chat-header-status .status-badge.answered::before {
    background: var(--chat-status-answered);
}

.chat-header-status .status-badge.closed {
    background: rgba(107, 114, 128, 0.12);
    color: var(--chat-status-closed);
}

.chat-header-status .status-badge.closed::before {
    background: var(--chat-status-closed);
}

.chat-header-actions {
    display: flex;
    gap: 4px;
    margin-inline-start: auto;
}

.chat-header-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: none;
    background: transparent;
    color: var(--chat-text-muted);
    cursor: pointer;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.chat-header-btn:hover {
    background: var(--chat-bg);
    color: var(--chat-text-primary);
}

.chat-header-btn:active {
    transform: scale(0.95);
}

/* ============================================================================
   Messages Area
   ============================================================================ */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 20px 24px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    background: linear-gradient(180deg, #ebe5de 0%, #e5dfd6 100%);
    background-attachment: fixed;
    scroll-behavior: smooth;
}

/* Custom scrollbar for messages */
.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.15);
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.25);
}

/* Messages loading state */
.chat-messages-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    gap: 16px;
    color: var(--chat-text-muted);
}

/* Message Date Separator */
.message-date-separator {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px 0;
    margin: 8px 0;
}

.message-date-separator span {
    background: rgba(255, 255, 255, 0.95);
    padding: 8px 16px;
    border-radius: 10px;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--chat-text-secondary);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

/* Message Wrapper for proper spacing */
.message-wrapper {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.message-wrapper + .message-wrapper {
    margin-top: 2px;
}

.message-wrapper.same-sender {
    margin-top: 2px;
}

.message-wrapper.new-sender {
    margin-top: 16px;
}

/* Message Bubble */
.message {
    display: flex;
    flex-direction: column;
    max-width: 70%;
    animation: messageIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes messageIn {
    from {
        opacity: 0;
        transform: translateY(12px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.message.mine {
    align-self: flex-end;
    margin-inline-start: auto;
}

.message.theirs {
    align-self: flex-start;
    margin-inline-end: auto;
}

.message-bubble {
    padding: 10px 14px 8px;
    border-radius: 16px;
    position: relative;
    word-wrap: break-word;
    word-break: break-word;
    line-height: 1.55;
    font-size: 0.9375rem;
    min-width: 80px;
}

/* My messages (user's own messages - warm theme bubble) */
.message.mine .message-bubble {
    background: linear-gradient(135deg, #f5ede3 0%, #ebe0d4 100%);
    border-radius: 16px 16px 6px 16px;
    box-shadow: 0 1px 3px rgba(93, 64, 55, 0.1);
    border: 1px solid rgba(196, 168, 130, 0.2);
}

[dir="rtl"] .message.mine .message-bubble {
    border-radius: 16px 16px 16px 6px;
}

/* Their messages (owner/admin messages - white bubble) */
.message.theirs .message-bubble {
    background: #ffffff;
    border-radius: 16px 16px 16px 6px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
}

[dir="rtl"] .message.theirs .message-bubble {
    border-radius: 16px 16px 6px 16px;
}

/* Message text content */
.message-text {
    color: var(--chat-text-primary);
    white-space: pre-wrap;
    word-break: break-word;
}

/* Message footer with time */
.message-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
    margin-top: 4px;
    padding-top: 2px;
}

.message-time {
    font-size: 0.6875rem;
    color: rgba(0, 0, 0, 0.45);
    font-weight: 400;
    white-space: nowrap;
}

.message.theirs .message-time {
    color: var(--chat-text-time);
}

/* Message read status indicator */
.message-status {
    display: flex;
    align-items: center;
    color: rgba(0, 0, 0, 0.35);
}

.message-status.read {
    color: #53bdeb;
}

.message-status svg {
    width: 16px;
    height: 16px;
}

/* Initial Message (first message in conversation) */
.message.initial-message .message-bubble {
    background: linear-gradient(135deg, #fff9e6 0%, #fff5d6 100%);
    border: 1px solid rgba(245, 158, 11, 0.2);
}

/* Message Label */
.message-label {
    font-size: 0.75rem;
    color: var(--chat-text-muted);
    margin-bottom: 6px;
    font-weight: 500;
    padding-inline-start: 4px;
}

/* Owner Badge - shown above owner messages */
.owner-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    color: var(--chat-send-btn-hover);
    margin-bottom: 6px;
    font-weight: 600;
    padding-inline-start: 4px;
}

.owner-badge svg {
    width: 14px;
    height: 14px;
}

/* Typing indicator */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 12px 16px;
    background: #ffffff;
    border-radius: 16px 16px 16px 6px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
    max-width: fit-content;
    animation: messageIn 0.3s ease;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    background: var(--chat-text-muted);
    border-radius: 50%;
    animation: typingBounce 1.4s ease-in-out infinite;
}

.typing-indicator span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typingBounce {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.6;
    }
    30% {
        transform: translateY(-6px);
        opacity: 1;
    }
}

/* ============================================================================
   Attachment Previews in Messages
   ============================================================================ */

/* Image Attachment */
.message-image {
    max-width: 280px;
    border-radius: 12px;
    margin-bottom: 6px;
    cursor: pointer;
    transition: transform 0.2s ease;
    display: block;
}

.message-image:hover {
    transform: scale(1.02);
}

/* File Attachment */
.message-file {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: rgba(0, 0, 0, 0.04);
    border-radius: 10px;
    margin-bottom: 6px;
    text-decoration: none;
    color: inherit;
    transition: background 0.2s ease;
}

.message-file:hover {
    background: rgba(0, 0, 0, 0.08);
}

.message-file-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--chat-send-btn);
    color: white;
    border-radius: 10px;
    flex-shrink: 0;
}

.message-file-info {
    flex: 1;
    min-width: 0;
}

.message-file-name {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--chat-text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.message-file-size {
    font-size: 0.75rem;
    color: var(--chat-text-muted);
}

/* Voice Message */
.message-voice {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.04);
    border-radius: 24px;
    min-width: 200px;
    margin-bottom: 6px;
}

.voice-play-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--chat-send-btn);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.2s ease;
}

.voice-play-btn:hover {
    background: var(--chat-send-btn-hover);
    transform: scale(1.05);
}

.voice-play-btn svg {
    width: 16px;
    height: 16px;
}

.voice-waveform {
    flex: 1;
    height: 24px;
    display: flex;
    align-items: center;
    gap: 2px;
}

.voice-waveform-bar {
    width: 3px;
    background: var(--chat-send-btn);
    border-radius: 2px;
    opacity: 0.4;
    transition: opacity 0.1s ease;
}

.voice-waveform-bar.active {
    opacity: 1;
}

.voice-duration {
    font-size: 0.75rem;
    color: var(--chat-text-muted);
    min-width: 35px;
    text-align: left;
}

[dir="rtl"] .voice-duration {
    text-align: right;
}

/* ============================================================================
   Input Area
   ============================================================================ */
.chat-input-area {
    padding: 16px 24px;
    background: var(--chat-input-bg);
    border-top: 1px solid rgba(0, 0, 0, 0.06);
    display: flex;
    align-items: flex-end;
    gap: 10px;
    min-height: var(--chat-input-height);
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.04);
    position: relative;
    z-index: 5;
    flex-shrink: 0;
}

/* Attachment buttons container */
.chat-attachment-btns {
    display: flex;
    align-items: center;
    gap: 4px;
    padding-bottom: 8px;
}

.chat-attachment-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: var(--chat-text-muted);
    cursor: pointer;
    transition: all 0.2s ease;
}

.chat-attachment-btn:hover {
    background: var(--chat-bg);
    color: var(--chat-send-btn);
}

.chat-attachment-btn svg {
    width: 22px;
    height: 22px;
}

/* Hidden file input */
.chat-file-input {
    display: none;
}

.chat-input-wrapper {
    flex: 1;
    position: relative;
    display: flex;
    align-items: flex-end;
}

.chat-input {
    width: 100%;
    padding: 14px 20px;
    border: 2px solid transparent;
    border-radius: 28px;
    font-size: 0.9375rem;
    font-family: inherit;
    background: var(--chat-bg);
    color: var(--chat-text-primary);
    resize: none;
    min-height: 52px;
    max-height: 140px;
    outline: none;
    transition: all 0.2s ease;
    line-height: 1.5;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.04);
}

.chat-input:hover:not(:disabled):not(:focus) {
    background: #f0ece6;
}

.chat-input:focus {
    background: #ffffff;
    border-color: var(--chat-send-btn);
    box-shadow: 0 0 0 4px rgba(196, 168, 130, 0.12);
}

.chat-input::placeholder {
    color: var(--chat-text-muted);
}

.chat-input:disabled {
    background: #f5f5f5;
    cursor: not-allowed;
    opacity: 0.7;
}

.chat-send-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 52px;
    border: none;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--chat-send-btn) 0%, var(--chat-send-btn-hover) 100%);
    color: white;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(196, 168, 130, 0.35);
}

.chat-send-btn:hover:not(:disabled) {
    transform: scale(1.08);
    box-shadow: 0 6px 20px rgba(196, 168, 130, 0.45);
}

.chat-send-btn:active:not(:disabled) {
    transform: scale(0.98);
    box-shadow: 0 2px 8px rgba(196, 168, 130, 0.35);
}

.chat-send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    box-shadow: none;
    background: #ccc;
}

.chat-send-btn svg {
    width: 24px;
    height: 24px;
    transform: rotate(180deg);
    transition: transform 0.2s ease;
}

[dir="rtl"] .chat-send-btn svg {
    transform: rotate(0deg);
}

.chat-send-btn:hover:not(:disabled) svg {
    transform: rotate(180deg) translateX(2px);
}

[dir="rtl"] .chat-send-btn:hover:not(:disabled) svg {
    transform: rotate(0deg) translateX(-2px);
}

/* Voice Recording UI */
.voice-recording-ui {
    display: none;
    flex: 1;
    align-items: center;
    gap: 12px;
    padding: 8px 16px;
    background: rgba(239, 68, 68, 0.08);
    border-radius: 28px;
    animation: recordingPulse 1.5s ease-in-out infinite;
}

.voice-recording-ui.active {
    display: flex;
}

@keyframes recordingPulse {
    0%, 100% { background: rgba(239, 68, 68, 0.06); }
    50% { background: rgba(239, 68, 68, 0.12); }
}

.voice-recording-indicator {
    width: 12px;
    height: 12px;
    background: #ef4444;
    border-radius: 50%;
    animation: recordingBlink 1s ease-in-out infinite;
}

@keyframes recordingBlink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

.voice-recording-timer {
    font-size: 0.9375rem;
    font-weight: 600;
    color: #ef4444;
    font-variant-numeric: tabular-nums;
    min-width: 45px;
}

.voice-recording-text {
    flex: 1;
    font-size: 0.875rem;
    color: var(--chat-text-secondary);
}

.voice-cancel-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 50%;
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    cursor: pointer;
    transition: all 0.2s ease;
}

.voice-cancel-btn:hover {
    background: rgba(239, 68, 68, 0.2);
}

.voice-cancel-btn svg {
    width: 18px;
    height: 18px;
}

/* Voice Record Button (replaces send when input is empty) */
.chat-voice-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 52px;
    border: none;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--chat-send-btn) 0%, var(--chat-send-btn-hover) 100%);
    color: white;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(196, 168, 130, 0.35);
}

.chat-voice-btn:hover:not(:disabled) {
    transform: scale(1.08);
    box-shadow: 0 6px 20px rgba(196, 168, 130, 0.45);
}

.chat-voice-btn.recording {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.35);
    animation: voiceBtnPulse 1s ease-in-out infinite;
}

@keyframes voiceBtnPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.chat-voice-btn svg {
    width: 24px;
    height: 24px;
}

/* File/Image preview before sending */
.attachment-preview {
    display: none;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--chat-bg);
    border-top: 1px solid rgba(0, 0, 0, 0.06);
    margin-bottom: -1px;
}

.attachment-preview.active {
    display: flex;
}

.attachment-preview-image {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 8px;
}

.attachment-preview-file {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
}

.attachment-preview-icon {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--chat-send-btn);
    color: white;
    border-radius: 10px;
}

.attachment-preview-info {
    flex: 1;
    min-width: 0;
}

.attachment-preview-name {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--chat-text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.attachment-preview-size {
    font-size: 0.75rem;
    color: var(--chat-text-muted);
}

.attachment-preview-remove {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 50%;
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.attachment-preview-remove:hover {
    background: rgba(239, 68, 68, 0.2);
}

.attachment-preview-remove svg {
    width: 16px;
    height: 16px;
}

/* Image lightbox/modal */
.image-lightbox {
    position: fixed;
    inset: 0;
    z-index: 1100;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.9);
    padding: 20px;
}

.image-lightbox.active {
    display: flex;
}

.image-lightbox img {
    max-width: 100%;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 8px;
}

.image-lightbox-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: background 0.2s ease;
}

.image-lightbox-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Closed Chat Notice */
.chat-closed-notice {
    padding: 20px 24px;
    background: linear-gradient(180deg, rgba(107, 114, 128, 0.08) 0%, rgba(107, 114, 128, 0.12) 100%);
    text-align: center;
    color: var(--chat-text-secondary);
    font-size: 0.9375rem;
    border-top: 1px solid rgba(107, 114, 128, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.chat-closed-notice svg {
    width: 18px;
    height: 18px;
    opacity: 0.7;
}

/* Character counter for input */
.chat-input-counter {
    position: absolute;
    bottom: -20px;
    left: 16px;
    font-size: 0.6875rem;
    color: var(--chat-text-muted);
}

.chat-input-counter.warning {
    color: var(--chat-status-review);
}

.chat-input-counter.danger {
    color: #ef4444;
}

/* ============================================================================
   New Consultation Modal
   ============================================================================ */
.new-consultation-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.new-consultation-modal.active {
    display: flex;
}

.new-consultation-content {
    width: 100%;
    max-width: 520px;
    background: white;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
    animation: modalIn 0.3s ease;
}

@keyframes modalIn {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.new-consultation-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--dash-border-light);
}

.new-consultation-header h2 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--chat-text-primary);
    margin: 0;
}

.modal-close-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: none;
    background: transparent;
    color: var(--chat-text-muted);
    cursor: pointer;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.modal-close-btn:hover {
    background: var(--chat-bg);
    color: var(--chat-text-primary);
}

.new-consultation-body {
    padding: 24px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group:last-child {
    margin-bottom: 0;
}

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--chat-text-primary);
    margin-bottom: 8px;
}

.form-select,
.form-textarea {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--chat-input-border);
    border-radius: 12px;
    font-size: 0.9375rem;
    font-family: inherit;
    background: white;
    color: var(--chat-text-primary);
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-select:focus,
.form-textarea:focus {
    border-color: var(--chat-send-btn);
    box-shadow: 0 0 0 3px rgba(196, 168, 130, 0.15);
}

.form-textarea {
    min-height: 140px;
    resize: vertical;
    line-height: 1.5;
}

.form-hint {
    font-size: 0.75rem;
    color: var(--chat-text-muted);
    margin-top: 6px;
}

.topic-options {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.topic-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 14px 10px;
    border: 2px solid var(--dash-border);
    border-radius: 12px;
    background: transparent;
    cursor: pointer;
    transition: all 0.2s ease;
}

.topic-option:hover {
    border-color: var(--chat-send-btn);
    background: rgba(196, 168, 130, 0.05);
}

.topic-option.selected {
    border-color: var(--chat-send-btn);
    background: rgba(196, 168, 130, 0.1);
}

.topic-option .topic-icon {
    font-size: 1.5rem;
}

.topic-option .topic-name {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--chat-text-secondary);
}

.topic-option.selected .topic-name {
    color: var(--chat-send-btn-hover);
}

.new-consultation-footer {
    display: flex;
    gap: 12px;
    padding: 20px 24px;
    border-top: 1px solid var(--dash-border-light);
    background: var(--chat-bg);
}

.btn-cancel,
.btn-submit {
    flex: 1;
    padding: 14px 20px;
    border: none;
    border-radius: 12px;
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-cancel {
    background: white;
    color: var(--chat-text-secondary);
    border: 1px solid var(--dash-border);
}

.btn-cancel:hover {
    background: var(--chat-bg);
}

.btn-submit {
    background: var(--chat-send-btn);
    color: white;
}

.btn-submit:hover:not(:disabled) {
    background: var(--chat-send-btn-hover);
}

.btn-submit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ============================================================================
   Loading States
   ============================================================================ */
.chat-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    gap: 12px;
    color: var(--chat-text-muted);
}

.chat-loading-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--dash-border);
    border-top-color: var(--chat-send-btn);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Skeleton Loaders */
.chat-item-skeleton {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    border-bottom: 1px solid var(--dash-border-light);
}

.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 4px;
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.skeleton-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
}

.skeleton-content {
    flex: 1;
}

.skeleton-line {
    height: 14px;
    margin-bottom: 8px;
}

.skeleton-line:last-child {
    width: 60%;
    margin-bottom: 0;
}

/* ============================================================================
   Mobile Bottom Nav - Hide when chat is active
   ============================================================================ */
@media (max-width: 768px) {
    /* Add transition to mobile nav for smooth hide/show */
    .mobile-profile-nav {
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), 
                    opacity 0.3s ease;
    }
    
    .mobile-profile-nav.chat-active {
        transform: translateY(100%);
        opacity: 0;
        pointer-events: none;
    }
    
    /* When chat is active, expand layout to use full height (no bottom nav space needed) */
    .consultations-layout.chat-active {
        height: calc(100vh - 60px);
        height: calc(100dvh - 60px);
    }
    
    /* Ensure chat input area has proper padding when bottom nav is hidden */
    .consultations-layout.chat-active .chat-input-area {
        padding-bottom: calc(12px + env(safe-area-inset-bottom, 16px));
    }
}

/* ============================================================================
   Desktop Layout Override
   ============================================================================ */
@media (min-width: 769px) {
    /* Ensure hidden classes don't affect desktop layout */
    .chat-sidebar.hidden,
    .chat-main.hidden {
        visibility: visible !important;
        opacity: 1 !important;
        transform: none !important;
        pointer-events: auto !important;
    }
}

/* ============================================================================
   Mobile Responsive
   ============================================================================ */
@media (max-width: 768px) {
    :root {
        --chat-header-height: 56px;
        --chat-input-height: 64px;
    }
    
    .consultations-layout {
        position: fixed;
        inset: 0;
        top: 60px; /* Account for header */
        height: calc(100vh - 60px);
        height: calc(100dvh - 60px); /* Dynamic viewport height for mobile */
    }
    
    .chat-sidebar {
        position: absolute;
        inset: 0;
        width: 100%;
        max-width: 100%;
        z-index: 10;
        transform: translateX(0);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        background: var(--chat-sidebar-bg);
    }
    
    .chat-sidebar.hidden {
        transform: translateX(100%);
        pointer-events: none;
    }
    
    /* RTL support for sidebar slide */
    [dir="rtl"] .chat-sidebar.hidden {
        transform: translateX(-100%);
    }
    
    .chat-main {
        position: absolute;
        inset: 0;
        z-index: 5;
        display: flex;
        flex-direction: column;
        background: var(--chat-messages-bg);
        transition: opacity 0.2s ease, visibility 0.2s ease;
    }
    
    .chat-main.hidden {
        visibility: hidden;
        opacity: 0;
        pointer-events: none;
    }
    
    /* Ensure chat view fills mobile screen */
    .chat-view {
        position: absolute;
        inset: 0;
        display: flex;
        flex-direction: column;
        height: 100%;
    }
    
    /* When chat view is shown, ensure it's visible */
    .chat-view[style*="display: flex"],
    .chat-view[style*="display:flex"] {
        z-index: 1;
    }
    
    .chat-messages {
        flex: 1;
        min-height: 0; /* Important for flex scroll */
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .chat-input-area {
        flex-shrink: 0;
        padding-bottom: env(safe-area-inset-bottom, 16px); /* Account for iOS safe area */
    }
    
    .chat-back-btn {
        display: flex;
    }
    
    /* Privacy banner mobile */
    .chat-privacy-banner {
        font-size: 0.75rem;
        padding: 8px 12px;
    }
    
    /* Chat Header - Mobile */
    .chat-header {
        padding: 12px 16px;
        gap: 12px;
    }
    
    .chat-header-avatar {
        width: 42px;
        height: 42px;
        font-size: 1.25rem;
    }
    
    .chat-header-title {
        font-size: 1rem;
    }
    
    .chat-header-status .status-badge {
        padding: 3px 10px;
        font-size: 0.6875rem;
    }
    
    .chat-header-btn {
        width: 36px;
        height: 36px;
    }
    
    /* Messages - Mobile */
    .chat-messages {
        padding: 16px;
    }
    
    .message {
        max-width: 88%;
    }
    
    .message-bubble {
        padding: 10px 14px 8px;
        font-size: 0.9375rem;
    }
    
    .message-date-separator {
        padding: 12px 0;
        margin: 6px 0;
    }
    
    .message-date-separator span {
        padding: 6px 14px;
        font-size: 0.75rem;
    }
    
    /* Input Area - Mobile */
    .chat-input-area {
        padding: 12px 16px;
        gap: 12px;
    }
    
    .chat-input {
        min-height: 48px;
        padding: 12px 18px;
        font-size: 1rem;
        border-radius: 24px;
    }
    
    .chat-send-btn {
        width: 48px;
        height: 48px;
    }
    
    .chat-send-btn svg {
        width: 22px;
        height: 22px;
    }
    
    /* Empty State - Mobile */
    .chat-empty-state {
        padding: 32px 20px;
    }
    
    .chat-empty-state svg {
        width: 80px;
        height: 80px;
        margin-bottom: 20px;
    }
    
    .chat-empty-state h2 {
        font-size: 1.25rem;
    }
    
    .chat-empty-state p {
        font-size: 0.9375rem;
        max-width: 100%;
    }
    
    .chat-empty-state .btn-start-chat {
        padding: 12px 28px;
        font-size: 0.9375rem;
    }
    
    /* Modal - Mobile */
    .topic-options {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .new-consultation-content {
        max-height: 90vh;
        overflow-y: auto;
    }
}

@media (max-width: 480px) {
    .chat-sidebar-header {
        padding: 12px 14px;
    }
    
    .chat-item {
        padding: 12px 14px;
        gap: 10px;
    }
    
    .chat-avatar {
        width: 44px;
        height: 44px;
        font-size: 1.25rem;
    }
    
    .chat-topic {
        font-size: 0.875rem;
    }
    
    .chat-preview {
        font-size: 0.8125rem;
    }
    
    /* Chat Header - Small Mobile */
    .chat-header {
        padding: 10px 14px;
        gap: 10px;
    }
    
    .chat-back-btn {
        width: 36px;
        height: 36px;
        margin-inline-end: -6px;
    }
    
    .chat-header-avatar {
        width: 38px;
        height: 38px;
        font-size: 1.125rem;
    }
    
    .chat-header-title {
        font-size: 0.9375rem;
    }
    
    .chat-header-actions {
        gap: 2px;
    }
    
    .chat-header-btn {
        width: 34px;
        height: 34px;
    }
    
    /* Messages - Small Mobile */
    .chat-messages {
        padding: 14px 12px;
        gap: 3px;
    }
    
    .message {
        max-width: 90%;
    }
    
    .message-bubble {
        padding: 9px 12px 7px;
        font-size: 0.9375rem;
        border-radius: 14px;
    }
    
    .message.mine .message-bubble {
        border-radius: 14px 14px 5px 14px;
    }
    
    .message.theirs .message-bubble {
        border-radius: 14px 14px 14px 5px;
    }
    
    [dir="rtl"] .message.mine .message-bubble {
        border-radius: 14px 14px 14px 5px;
    }
    
    [dir="rtl"] .message.theirs .message-bubble {
        border-radius: 14px 14px 5px 14px;
    }
    
    /* Input Area - Small Mobile */
    .chat-input-area {
        padding: 10px 12px;
        gap: 10px;
    }
    
    .chat-input {
        min-height: 44px;
        padding: 11px 16px;
        font-size: 1rem;
        border-radius: 22px;
    }
    
    .chat-send-btn {
        width: 44px;
        height: 44px;
        box-shadow: 0 3px 10px rgba(196, 168, 130, 0.3);
    }
    
    .chat-send-btn svg {
        width: 20px;
        height: 20px;
    }
    
    /* Empty State - Small Mobile */
    .chat-empty-state {
        padding: 28px 16px;
    }
    
    .chat-empty-state svg {
        width: 70px;
        height: 70px;
        margin-bottom: 16px;
    }
    
    .chat-empty-state h2 {
        font-size: 1.125rem;
    }
    
    .chat-empty-state p {
        font-size: 0.875rem;
        margin-bottom: 24px;
        line-height: 1.6;
    }
    
    .chat-empty-state .btn-start-chat {
        padding: 12px 24px;
        font-size: 0.875rem;
        border-radius: 24px;
    }
    
    /* Closed Notice - Small Mobile */
    .chat-closed-notice {
        padding: 16px;
        font-size: 0.875rem;
    }
    
    /* Modal - Small Mobile */
    .new-consultation-modal {
        padding: 12px;
    }
    
    .new-consultation-header {
        padding: 16px;
    }
    
    .new-consultation-header h2 {
        font-size: 1.125rem;
    }
    
    .new-consultation-body {
        padding: 16px;
    }
    
    .topic-options {
        gap: 8px;
    }
    
    .topic-option {
        padding: 12px 8px;
    }
    
    .topic-option .topic-icon {
        font-size: 1.25rem;
    }
    
    .topic-option .topic-name {
        font-size: 0.75rem;
    }
    
    .form-textarea {
        min-height: 120px;
    }
    
    .new-consultation-footer {
        padding: 16px;
        gap: 10px;
    }
    
    .btn-cancel,
    .btn-submit {
        padding: 12px 16px;
        font-size: 0.875rem;
    }
}

/* ============================================================================
   RTL Adjustments
   ============================================================================ */
[dir="rtl"] .chat-sidebar {
    border-left: none;
    border-right: 1px solid var(--dash-border);
}

[dir="rtl"] .chat-item.unread::before {
    right: auto;
    left: 0;
    border-radius: 4px 0 0 4px;
}

[dir="rtl"] .chat-sidebar.hidden {
    transform: translateX(-100%);
}

/* Note: Message bubble RTL adjustments are inline with the .message styles above */

/* ============================================================================
   Accessibility
   ============================================================================ */
@media (prefers-reduced-motion: reduce) {
    .message,
    .chat-sidebar,
    .new-consultation-content,
    .typing-indicator span {
        animation: none;
    }
    
    .chat-send-btn:hover:not(:disabled),
    .chat-empty-state .btn-start-chat:hover {
        transform: none;
    }
}

/* Focus visible styles for keyboard navigation */
.chat-send-btn:focus-visible,
.chat-back-btn:focus-visible,
.chat-header-btn:focus-visible,
.new-chat-btn:focus-visible,
.chat-filter-tab:focus-visible,
.chat-item:focus-visible {
    outline: 2px solid var(--chat-send-btn);
    outline-offset: 2px;
}

.chat-input:focus-visible,
.form-textarea:focus-visible {
    outline: none; /* Using border/box-shadow instead */
}

/* ============================================================================
   Print Styles
   ============================================================================ */
@media print {
    .chat-sidebar,
    .chat-input-area,
    .new-consultation-modal,
    .chat-back-btn,
    .chat-header-actions {
        display: none !important;
    }
    
    .consultations-layout {
        display: block !important;
        height: auto !important;
    }
    
    .chat-main {
        width: 100% !important;
        position: static !important;
    }
    
    .chat-view {
        height: auto !important;
    }
    
    .chat-messages {
        overflow: visible !important;
        max-height: none !important;
        height: auto !important;
        padding: 20px !important;
        background: white !important;
    }
    
    .chat-header {
        box-shadow: none !important;
        border-bottom: 2px solid #000 !important;
    }
    
    .message-bubble {
        box-shadow: none !important;
        border: 1px solid #ccc !important;
    }
}
