/* Enhanced Conversations UI - Matches Orders Tab Quality */

/* Container Structure with Fixed Scrolling */
.dashboard-content {
    height: calc(100vh - 70px) !important;
    overflow: hidden !important;
}

.conversations-section {
    height: 100%;
    overflow: hidden;
    display: flex;
    flex-direction: row;
}

.conversations-sidebar {
    width: 320px;
    background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
    border-right: 1px solid #e2e8f0;
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
    position: relative;
}

.sidebar-header {
    padding: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.2);
    flex-shrink: 0;
}

.sidebar-header h2 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

.conversation-count {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 500;
    display: inline-block;
    margin-top: 8px;
}

/* Scrollable List Container */
.conversations-list {
    flex: 1 1 auto;
    overflow-y: auto !important;
    overflow-x: hidden;
    min-height: 0;
    max-height: calc(100vh - 170px);
    padding: 12px;
    scroll-behavior: smooth;
    position: relative;

    /* Custom Scrollbar */
    scrollbar-width: thin;
    scrollbar-color: #cbd5e0 #f1f5f9;
}

.conversations-list::-webkit-scrollbar {
    width: 8px;
}

.conversations-list::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 4px;
}

.conversations-list::-webkit-scrollbar-thumb {
    background: #cbd5e0;
    border-radius: 4px;
}

.conversations-list::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Enhanced Conversation Cards */
.conversation-item {
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    padding: 14px 16px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    position: relative;
    overflow: hidden;
}

.conversation-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
    border-color: #94a3b8;
}

.conversation-item:active {
    transform: translateY(0);
}

/* Active Conversation */
.conversation-item.active {
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
    border-color: #3b82f6;
    box-shadow: 0 4px 16px rgba(59, 130, 246, 0.2);
}

.conversation-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: #3b82f6;
}

/* Status-Based Styling */
.conversation-item.session-not_started {
    background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
    border-color: #fca5a5;
}

.conversation-item.session-not_started .conversation-id {
    color: #dc2626;
}

.conversation-item.session-started {
    background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
    border-color: #fbbf24;
    animation: activeConversation 3s ease-in-out infinite;
}

.conversation-item.session-started::after {
    content: '🔴';
    position: absolute;
    top: 12px;
    right: 12px;
    font-size: 10px;
    animation: recording 1.5s ease-in-out infinite;
}

.conversation-item.session-completed {
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
    border-color: #86efac;
}

.conversation-item.session-completed .conversation-id {
    color: #16a34a;
}

/* New Conversation Animation */
.conversation-item.new-conversation {
    animation: slideInRight 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

/* Unread/Updated Conversation */
.conversation-item.unread {
    border-color: #22c55e;
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
}

.conversation-item.unread::before {
    content: '';
    position: absolute;
    top: 8px;
    right: 8px;
    width: 8px;
    height: 8px;
    background: #22c55e;
    border-radius: 50%;
    animation: unreadPulse 2s ease-in-out infinite;
}

/* Conversation Content */
.conversation-id {
    font-weight: 600;
    font-size: 0.9rem;
    color: #1e293b;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.conversation-preview {
    font-size: 0.85rem;
    color: #64748b;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin: 6px 0;
}

.conversation-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.75rem;
    color: #94a3b8;
    margin-top: 8px;
}

.conversation-time {
    font-weight: 500;
}

.message-count {
    background: #f1f5f9;
    color: #475569;
    padding: 2px 8px;
    border-radius: 12px;
    font-weight: 600;
}

/* Animations */
@keyframes activeConversation {
    0%, 100% {
        box-shadow: 0 4px 16px rgba(251, 191, 36, 0.2);
    }
    50% {
        box-shadow: 0 4px 20px rgba(251, 191, 36, 0.4);
    }
}

@keyframes recording {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.3;
    }
}

@keyframes unreadPulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.2);
        opacity: 0.7;
    }
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Empty State */
.no-conversations {
    text-align: center;
    padding: 40px 20px;
    color: #64748b;
}

.no-conversations-icon {
    font-size: 3rem;
    margin-bottom: 16px;
    opacity: 0.5;
}

.no-conversations h3 {
    margin: 0 0 8px;
    color: #475569;
    font-size: 1.1rem;
}

.no-conversations p {
    margin: 0;
    font-size: 0.9rem;
    color: #94a3b8;
}

/* Responsive Adjustments */
@media (max-width: 1200px) {
    .conversations-sidebar {
        width: 280px;
    }
}

@media (max-width: 768px) {
    .conversations-sidebar {
        width: 100%;
        height: 40vh;
        border-right: none;
        border-bottom: 1px solid #e2e8f0;
    }

    .conversations-list {
        max-height: calc(40vh - 80px);
    }
}