/* Support Console Split-Pane Styling */
html {
    height: 100%;
    height: var(--app-height, 100dvh);
    margin: 0;
    overflow: hidden;
}

body {
    height: 100%;
    height: var(--app-height, 100dvh);
    margin: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

header.navbar {
    flex: 0 0 auto;
}

main {
    flex: 1 1 0%;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.support-dashboard-container {
    flex: 1 1 0%;
    min-height: 0;
    width: 100%;
    overflow: hidden;
}

.conversations-sidebar {
    width: 360px;
    min-width: 320px;
    max-width: 400px;
    height: 100%;
    min-height: 0;
    overflow: hidden;
}

.sidebar-header {
    flex: 0 0 auto;
}

.conversations-scroll-container {
    flex: 1 1 0%;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: calc(1.5rem + env(safe-area-inset-bottom, 0px));
}

.conversation-item {
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.conversation-item:hover {
    background-color: #f1f5f9;
}

.conversation-item.active-conversation {
    background-color: #e0f2fe !important;
    border-left: 4px solid #0284c7;
}

.conversation-item.unread-bg {
    background-color: #fef2f2;
}

.thread-pane {
    flex: 1 1 0%;
    height: 100%;
    min-height: 0;
    overflow: hidden;
}

.thread-layout {
    flex: 1 1 0%;
    height: 100%;
    min-height: 0;
    overflow: hidden;
}

.thread-header {
    flex: 0 0 auto;
}

.thread-body {
    flex: 1 1 0%;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    background-color: #f8fafc;
    scroll-behavior: smooth;
}

.thread-footer {
    flex: 0 0 auto;
    padding-bottom: calc(1rem + env(safe-area-inset-bottom, 0px)) !important;
}

/* Message Rows & Bubbles */
.message-row {
    display: flex;
    margin-bottom: 12px;
}

.admin-message-row {
    justify-content: flex-end;
}

.customer-message-row {
    justify-content: flex-start;
}

.message-bubble {
    max-width: 70%;
    padding: 10px 14px;
    border-radius: 14px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    word-break: break-word;
}

.admin-bubble {
    background-color: #2563eb;
    color: #ffffff;
    border-bottom-right-radius: 3px;
}

.admin-bubble .message-header {
    color: #bfdbfe !important;
}

.admin-bubble .message-time {
    color: #bfdbfe !important;
}

.customer-bubble {
    background-color: #ffffff;
    color: #1e293b;
    border: 1px solid #e2e8f0;
    border-bottom-left-radius: 3px;
}

.session-divider {
    position: relative;
    margin: 20px 0;
}

.session-divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 10%;
    right: 10%;
    border-top: 1px dashed #cbd5e1;
    z-index: 1;
}

.session-divider span {
    position: relative;
    z-index: 2;
}

/* Mobile Responsive Adjustments */
@media (max-width: 768px) {
    .conversations-sidebar {
        width: 100% !important;
        max-width: 100% !important;
        border-right: none !important;
    }
    .thread-pane {
        display: none !important;
    }
    body.mobile-thread-active .conversations-sidebar {
        display: none !important;
    }
    body.mobile-thread-active .thread-pane {
        display: flex !important;
        width: 100% !important;
    }
}
