/**
 * Comprehensive Messaging Styles for Dezipp
 * Modern, responsive design with smooth animations
 */

/* ===== MESSAGING CONTAINER ===== */
.dezipp-messaging {
    display: flex;
    flex-direction: column;
    height: 100vh;
    max-height: 100vh;
    background: #ffffff;
    position: relative;
    overflow: hidden;
}

/* ===== MESSAGING HEADER ===== */
.messaging-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px; /* Increased padding for better symmetry */
    background: #ffffff;
    border-bottom: 1px solid #e5e7eb;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    flex-shrink: 0;
    z-index: 10;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.back-btn {
    display: none;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
    background: #ffffff;
    color: #374151;
    cursor: pointer;
    transition: all 0.2s ease;
}

.back-btn:hover {
    background: #f3f4f6;
    transform: translateX(-2px);
}

.messaging-title {
    font-size: 20px;
    font-weight: 600;
    color: #111827;
    margin: 0;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
    background: #ffffff;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.action-btn:hover {
    background: #f3f4f6;
    color: #374151;
    transform: translateY(-1px);
}

.action-btn:active {
    transform: translateY(0);
}

/* ===== MAIN CONTENT ===== */
.messaging-content {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* ===== CONVERSATIONS PANEL ===== */
.conversations-panel {
    width: 320px;
    min-width: 280px;
    max-width: 400px;
    background: #ffffff;
    border-right: 1px solid #e5e7eb;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: width 220ms ease, min-width 220ms ease;
}

/* Topbar with collapse/expand toggle */
.conversations-topbar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border-bottom: 1px solid #f3f4f6;
    background: #fff;
}
.conversations-title { margin: 0; font-size: 14px; font-weight: 600; color: #111827; }
.sidebar-toggle {
    width: 28px; height: 28px; border-radius: 50%; border: 1px solid #e5e7eb;
    background: #f8fafb; color: #64748b; display: inline-flex; align-items: center; justify-content: center;
    cursor: pointer; transition: all .2s ease; flex-shrink: 0;
}
.sidebar-toggle:hover { background: #eef2f7; color: #374151; transform: translateY(-1px); }

.conversations-search {
    padding: 16px;
    border-bottom: 1px solid #f3f4f6;
}

.search-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.search-icon {
    position: absolute;
    left: 12px;
    color: #9ca3af;
    font-size: 14px;
    z-index: 2;
}

#conversations-search {
    width: 100%;
    padding: 10px 12px 10px 36px;
    border: 1px solid #e5e7eb;
    border-radius: 20px;
    background: #f9fafb;
    font-size: 14px;
    color: #374151;
    transition: all 0.2s ease;
}

#conversations-search:focus {
    outline: none;
    border-color: #3b82f6;
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.clear-search {
    position: absolute;
    right: 8px;
    width: 24px;
    height: 24px;
    border: none;
    background: #e5e7eb;
    border-radius: 50%;
    color: #6b7280;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 12px;
}

.clear-search:hover {
    background: #d1d5db;
}

/* ===== CONVERSATION FILTERS ===== */
.conversation-filters {
    display: flex;
    padding: 8px 16px;
    gap: 4px;
    border-bottom: 1px solid #f3f4f6;
}

.filter-tab {
    padding: 6px 12px;
    border: none;
    background: transparent;
    color: #6b7280;
    font-size: 13px;
    font-weight: 500;
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.filter-tab:hover {
    background: #f3f4f6;
    color: #374151;
}

.filter-tab.active {
    background: #3b82f6;
    color: #ffffff;
}

/* ===== CONVERSATIONS LIST ===== */
.conversations-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px 0;
}

.loading-conversations {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    color: #6b7280;
}

.spinner {
    width: 24px;
    height: 24px;
    border: 2px solid #e5e7eb;
    border-top: 2px solid #3b82f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 12px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ===== CONVERSATION ITEM ===== */
.conversation-item {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    border-left: 3px solid transparent;
}

.conversation-item:hover {
    background: #f9fafb;
}

.conversation-item.has-unread {
    border-left-color: #3b82f6;
    background: rgba(59, 130, 246, 0.05);
}

.conversation-item.active {
    background: #eff6ff;
    border-left-color: #3b82f6;
}

.conversations-view .conversation-avatar {
    position: relative !important;
    margin-right: 12px !important;
    flex-shrink: 0 !important;
    width: 48px !important;
    height: 48px !important;
    border-radius: 50% !important;
    overflow: hidden !important;
}

.conversations-view .conversation-avatar img {
    width: 100% !important;
    height: 100% !important;
    border-radius: 50% !important;
    object-fit: cover !important;
    border: 2px solid #ffffff !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15) !important;
}

.status-indicator {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid #ffffff;
}

.status-indicator.online {
    background: #10b981;
}

.status-indicator.offline {
    background: #6b7280;
}

.status-indicator.group {
    background: #8b5cf6;
}

.conversation-content {
    flex: 1;
    min-width: 0;
}

.conversation-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 4px;
}

.conversation-name {
    font-size: 15px;
    font-weight: 600;
    color: #111827;
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.conversation-time {
    font-size: 12px;
    color: #6b7280;
    flex-shrink: 0;
}

.conversation-preview {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.last-message {
    font-size: 13px;
    color: #6b7280;
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
}

.conversation-item.has-unread .last-message {
    color: #374151;
    font-weight: 500;
}

.unread-badge {
    background: #3b82f6;
    color: #ffffff;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
    flex-shrink: 0;
}

.conversation-actions {
    display: none;
    gap: 4px;
    margin-left: 8px;
}

.conversation-item:hover .conversation-actions {
    display: flex;
}

.conversation-actions .action-btn {
    width: 28px;
    height: 28px;
    font-size: 12px;
}

/* ===== EMPTY CONVERSATIONS ===== */
.empty-conversations {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    text-align: center;
}

.empty-icon {
    width: 64px;
    height: 64px;
    background: #f3f4f6;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
    color: #9ca3af;
    font-size: 24px;
}

.empty-conversations h3 {
    font-size: 16px;
    font-weight: 600;
    color: #374151;
    margin: 0 0 8px 0;
}

.empty-conversations p {
    font-size: 14px;
    color: #6b7280;
    margin: 0 0 16px 0;
}

/* ===== CHAT PANEL ===== */
.chat-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: #ffffff;
    transition: flex-basis 220ms ease;
}

/* ===== WELCOME STATE ===== */
.welcome-state {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #ffffff;
}

.welcome-content {
    text-align: center;
    max-width: 400px;
    padding: 40px;
}

.welcome-icon {
    width: 80px;
    height: 80px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 24px auto;
    font-size: 32px;
}

.welcome-content h2 {
    font-size: 24px;
    font-weight: 600;
    margin: 0 0 12px 0;
}

.welcome-content p {
    font-size: 16px;
    opacity: 0.9;
    margin: 0 0 24px 0;
    line-height: 1.5;
}

/* ===== ACTIVE CHAT ===== */
.active-chat {
    display: none;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

/* ===== CHAT HEADER ===== */
.chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: #ffffff;
    border-bottom: 1px solid #e5e7eb;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    flex-shrink: 0;
}

.chat-user-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.chat-view .chat-avatar {
    position: relative !important;
    width: 44px !important;
    height: 44px !important;
    border-radius: 50% !important;
    object-fit: cover !important;
    border: 2px solid #ffffff !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15) !important;
}

.chat-view .chat-avatar img {
    width: 100% !important;
    height: 100% !important;
    border-radius: 50% !important;
    object-fit: cover !important;
}

/* ===== Collapsed Sidebar (avatar-only) ===== */
.dezipp-messaging.sidebar-collapsed .conversations-panel {
    width: 72px;
    min-width: 72px;
}
.dezipp-messaging.sidebar-collapsed .conversations-title,
.dezipp-messaging.sidebar-collapsed .conversations-search,
.dezipp-messaging.sidebar-collapsed .conversation-filters,
.dezipp-messaging.sidebar-collapsed .conversation-actions,
.dezipp-messaging.sidebar-collapsed .conversation-content { display: none !important; }

.dezipp-messaging.sidebar-collapsed .conversations-list { padding: 8px 6px; }
.dezipp-messaging.sidebar-collapsed .conversation-item {
    padding: 6px !important;
    justify-content: center;
}
.dezipp-messaging.sidebar-collapsed .conversation-avatar { margin: 0 auto !important; }
.dezipp-messaging.sidebar-collapsed .sidebar-toggle i { transform: none; }

/* Smooth fade of hidden text when collapsing */
.conversation-content, .conversations-title, .conversation-filters { transition: opacity 180ms ease; }
.dezipp-messaging.sidebar-collapsed .conversation-content,
.dezipp-messaging.sidebar-collapsed .conversations-title,
.dezipp-messaging.sidebar-collapsed .conversation-filters { opacity: 0; }

.chat-user-details h2 {
    font-size: 16px;
    font-weight: 600;
    color: #111827;
    margin: 0 0 2px 0;
}

.chat-user-status {
    font-size: 12px;
    color: #6b7280;
    margin: 0;
}

.chat-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.action-btn {
    width: 36px;
    height: 36px;
    border: none;
    background: transparent;
    color: #6b7280;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.action-btn:hover {
    background: #f3f4f6;
    color: #374151;
}

.action-btn:active {
    background: #e5e7eb;
}

.action-btn i {
    font-size: 16px;
}

/* ===== MESSAGES CONTAINER ===== */
.messages-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: #f9fafb;
    position: relative;
}

.messages-list {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    scroll-behavior: smooth;
    background: #f8fafc;
    position: relative;
}

/* Scroll boundary shadow */
.messages-list::before {
    content: '';
    position: sticky;
    top: 0;
    left: 0;
    right: 0;
    height: 8px;
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.1), transparent);
    pointer-events: none;
    z-index: 1;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.messages-list.scrolled::before {
    opacity: 1;
}

.loading-messages {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    color: #6b7280;
}

/* ===== TYPING INDICATORS ===== */
.typing-indicators {
    padding: 12px 20px;
    background: #ffffff;
    border-top: 1px solid rgba(0, 0, 0, 0.04);
    min-height: 44px;
    display: flex;
    align-items: center;
}

.typing-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #6b7280;
    font-style: italic;
    padding: 8px 16px;
    background: #f8fafc;
    border-radius: 20px;
    animation: fadeInUp 0.3s ease-out;
}

.typing-dots {
    display: flex;
    gap: 2px;
}

.typing-dot {
    width: 4px;
    height: 4px;
    background: #9ca3af;
    border-radius: 50%;
    animation: typing-pulse 1.5s infinite;
}

.typing-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing-pulse {
    0%, 60%, 100% {
        opacity: 0.3;
        transform: scale(1);
    }
    30% {
        opacity: 1;
        transform: scale(1.2);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===== MESSAGE INPUT AREA ===== */
.message-input-area {
    background: #ffffff;
    border-top: 1px solid rgba(0, 0, 0, 0.04);
    flex-shrink: 0;
    padding: 18px 20px; /* Increased vertical padding for better breathing space */
    box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.02); /* Subtle shadow to clarify scroll boundary */
}

/* Legacy message input container - disabled for modern composer */
.legacy-message-input-container {
    padding: 16px 20px;
}

/* ===== MEDIA PREVIEW ===== */
.media-preview {
    background: #f3f4f6;
    border-radius: 12px;
    padding: 12px;
    margin-bottom: 12px;
    position: relative;
}

.preview-content {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.preview-item {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    max-width: 80px;
    max-height: 80px;
}

.preview-item img,
.preview-item video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.preview-item .file-icon {
    width: 80px;
    height: 80px;
    background: #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: #6b7280;
}

.remove-media {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 24px;
    height: 24px;
    background: rgba(0, 0, 0, 0.6);
    color: #ffffff;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
}

/* ===== REPLY PREVIEW ===== */
.reply-preview {
    background: #eff6ff;
    border-left: 3px solid #3b82f6;
    border-radius: 0 8px 8px 0;
    padding: 12px;
    margin-bottom: 12px;
    position: relative;
}

.reply-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.reply-label {
    font-size: 12px;
    color: #3b82f6;
    font-weight: 600;
}

.reply-sender {
    font-size: 12px;
    color: #6b7280;
}

.reply-message {
    font-size: 13px;
    color: #374151;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cancel-reply {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 20px;
    height: 20px;
    background: #e5e7eb;
    color: #6b7280;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
}

/* ===== INPUT ROW ===== */
.input-row {
    display: flex;
    align-items: flex-end;
    gap: 8px;
}

.input-actions-left,
.input-actions-right {
    display: flex;
    align-items: center;
    gap: 4px;
}

.input-action {
    width: 36px;
    height: 36px;
    border: 1px solid #e5e7eb;
    background: #ffffff;
    color: #6b7280;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.input-action:hover {
    background: #f3f4f6;
    color: #374151;
    transform: translateY(-1px);
}

.input-action.active {
    background: #3b82f6;
    color: #ffffff;
    border-color: #3b82f6;
}

/* ===== MESSAGE INPUT ===== */
/* Legacy input styles - disabled for modern composer 
.legacy-message-input-wrapper {
    flex: 1;
    position: relative;
}

.legacy-message-input {
    width: 100%;
    min-height: 36px;
    max-height: 120px;
    padding: 8px 16px;
    border: 1px solid #e5e7eb;
    border-radius: 18px;
    background: #ffffff;
    font-size: 14px;
    font-family: inherit;
    color: #374151;
    resize: none;
    transition: all 0.2s ease;
    line-height: 1.4;
}

.legacy-message-input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.legacy-message-input::placeholder {
    color: #9ca3af;
}
*/

/* ===== SEND BUTTON ===== */
.send-button {
    width: 36px;
    height: 36px;
    background: #e5e7eb;
    color: #9ca3af;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    transform: scale(0.9);
}

.send-button:not(:disabled) {
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    color: #ffffff;
    transform: scale(1);
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

.send-button:not(:disabled):hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.send-button:not(:disabled):active {
    transform: scale(0.95);
}

/* ===== BUTTONS ===== */
.primary-btn {
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    color: #ffffff;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
}

.primary-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.primary-btn:active {
    transform: translateY(0);
}

.primary-btn:disabled {
    background: #d1d5db;
    color: #9ca3af;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.secondary-btn {
    background: #ffffff;
    color: #374151;
    border: 1px solid #e5e7eb;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
}

.secondary-btn:hover {
    background: #f9fafb;
    border-color: #d1d5db;
}

/* ===== MODALS ===== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
    animation: modal-fade-in 0.2s ease;
}

@keyframes modal-fade-in {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.modal-content {
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    max-width: 90vw;
    max-height: 90vh;
    overflow: hidden;
    animation: modal-slide-up 0.3s ease;
}

@keyframes modal-slide-up {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid #e5e7eb;
}

.modal-header h2 {
    font-size: 18px;
    font-weight: 600;
    color: #111827;
    margin: 0;
}

.modal-close {
    width: 32px;
    height: 32px;
    border: none;
    background: #f3f4f6;
    color: #6b7280;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.modal-close:hover {
    background: #e5e7eb;
    color: #374151;
}

.modal-body {
    padding: 24px;
    max-height: 60vh;
    overflow-y: auto;
}

.modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    padding: 20px 24px;
    border-top: 1px solid #e5e7eb;
    background: #f9fafb;
}

/* ===== NEW CONVERSATION MODAL ===== */
.new-conversation-content {
    width: 500px;
}

.participant-search .search-input-wrapper {
    margin-bottom: 16px;
}

.selected-participants {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
    padding: 12px;
    background: #f3f4f6;
    border-radius: 8px;
}

.participant-chip {
    display: flex;
    align-items: center;
    gap: 6px;
    background: #3b82f6;
    color: #ffffff;
    padding: 4px 8px;
    border-radius: 16px;
    font-size: 12px;
}

.participant-chip .remove {
    width: 16px;
    height: 16px;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 50%;
    color: #ffffff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
}

.search-results {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #ffffff;
}

.search-result-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    cursor: pointer;
    transition: background 0.2s ease;
}

.search-result-item:hover {
    background: #f9fafb;
}

.search-result-item.selected {
    background: #eff6ff;
}

.search-result-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
}

.search-result-info h4 {
    font-size: 14px;
    font-weight: 600;
    color: #111827;
    margin: 0 0 2px 0;
}

.search-result-info p {
    font-size: 12px;
    color: #6b7280;
    margin: 0;
}

.conversation-options {
    margin-top: 16px;
}

.option-group {
    margin-bottom: 16px;
}

.option-group label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 6px;
}

.option-group input,
.option-group textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    font-size: 14px;
    color: #374151;
    transition: border-color 0.2s ease;
}

.option-group input:focus,
.option-group textarea:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.option-group textarea {
    resize: vertical;
    min-height: 60px;
}

/* ===== MEDIA VIEWER MODAL ===== */
.media-viewer-content {
    width: 90vw;
    height: 90vh;
    display: flex;
    flex-direction: column;
    background: #000000;
    border-radius: 12px;
    overflow: hidden;
}

.media-viewer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: rgba(0, 0, 0, 0.8);
    color: #ffffff;
}

.media-info .sender-name {
    font-weight: 600;
    margin-right: 8px;
}

.media-info .send-time {
    opacity: 0.7;
    font-size: 14px;
}

.media-viewer-header .modal-close {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
}

.media-viewer-header .modal-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

.media-viewer-body {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.media-viewer-body img,
.media-viewer-body video {
    max-width: 100%;
    max-height: 100%;
    border-radius: 8px;
}

.media-viewer-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 16px 20px;
    background: rgba(0, 0, 0, 0.8);
}

.media-viewer-actions .action-btn {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
    border-color: rgba(255, 255, 255, 0.2);
}

.media-viewer-actions .action-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 768px) {
    .dezipp-messaging {
        height: 100vh;
    }
    
    .messaging-header {
        padding: 12px 16px;
    }
    
    .conversations-panel {
        width: 100%;
        max-width: none;
    }
    
    .conversations-panel.hidden {
        display: none;
    }
    
    .chat-panel.hidden {
        display: none;
    }
    
    .back-btn {
        display: flex !important;
    }
    
    .messaging-title {
        font-size: 18px;
    }
    
    .header-actions .action-btn {
        width: 32px;
        height: 32px;
    }
    
    .modal-content {
        margin: 16px;
        width: calc(100vw - 32px);
    }
    
    .new-conversation-content {
        width: auto;
    }
}

@media (max-width: 480px) {
    .messaging-header {
        padding: 10px 12px;
    }
    
    .conversations-search {
        padding: 12px;
    }
    
    .conversation-item {
        padding: 10px 12px;
    }
    
    .conversation-avatar img {
        width: 42px;
        height: 42px;
    }
    
    .chat-header {
        padding: 12px 16px;
    }
    
    /* Legacy mobile input container - disabled for modern composer */
    .legacy-message-input-container {
        padding: 12px 16px;
    }
    
    .modal-header,
    .modal-body,
    .modal-footer {
        padding: 16px;
    }
}

/* ===== ANIMATIONS ===== */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ===== SCROLLBARS ===== */
.conversations-list::-webkit-scrollbar,
.messages-list::-webkit-scrollbar,
.modal-body::-webkit-scrollbar,
.search-results::-webkit-scrollbar {
    width: 6px;
}

.conversations-list::-webkit-scrollbar-track,
.messages-list::-webkit-scrollbar-track,
.modal-body::-webkit-scrollbar-track,
.search-results::-webkit-scrollbar-track {
    background: transparent;
}

.conversations-list::-webkit-scrollbar-thumb,
.messages-list::-webkit-scrollbar-thumb,
.modal-body::-webkit-scrollbar-thumb,
.search-results::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 3px;
}

.conversations-list::-webkit-scrollbar-thumb:hover,
.messages-list::-webkit-scrollbar-thumb:hover,
.modal-body::-webkit-scrollbar-thumb:hover,
.search-results::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

/* ===== DARK MODE SUPPORT (Optional) ===== */
@media (prefers-color-scheme: dark) {
    .dezipp-messaging {
        background: #111827;
        color: #f9fafb;
    }
    
    .messaging-header,
    .conversations-panel,
    .chat-panel,
    .chat-header {
        background: #1f2937;
        border-color: #374151;
    }
    
    .conversation-item:hover {
        background: #374151;
    }
    
    .conversation-item.has-unread,
    .conversation-item.active {
        background: rgba(59, 130, 246, 0.1);
    }
    
    #conversations-search {
        background: #374151;
        border-color: #4b5563;
        color: #f9fafb;
    }
    
    #conversations-search::placeholder {
        color: #9ca3af;
    }
    
    /* Modern composer will handle its own dark mode styles */
}

/* ===== UTILITY CLASSES ===== */
.hidden {
    display: none !important;
}

.truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}