/* Chat Modal Layout Fix - Ensures AI Chat tab uses full vertical space */

/* Modal dialog should take up most of the viewport height */
#chatModal .modal-dialog {
    display: flex;
    flex-direction: column;
    height: 85vh; /* Slightly reduced from 90vh for better appearance */
    max-height: 85vh;
    margin: 7.5vh auto; /* Center vertically */
}

/* Modal content should fill the dialog */
#chatModal .modal-content {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    height: 100%;
    overflow: hidden;
}

/* Modal header should not shrink */
#chatModal .modal-header {
    flex-shrink: 0;
}

/* Nav tabs should not shrink */
#chatModal .nav-tabs {
    flex-shrink: 0;
}

/* Modal body should grow to fill available space */
#chatModal .modal-body {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    padding: 0;
    overflow: hidden;
}

/* Tab content container should fill modal body */
#chatModal .tab-content {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    height: 100%;
}

/* All tab panes should be ready to flex when active */
#chatModal .tab-pane {
    display: none;
    flex-direction: column;
    min-height: 0;
}

/* Active tab pane should display as flex and fill space */
#chatModal .tab-pane.show.active {
    display: flex !important;
    flex: 1 1 auto;
    height: 100%;
}

/* AI Chat tab specific layout */
#aiChatTabPane {
    padding: 0 !important;
}

/* Chat messages area should grow to fill available space */
#aiChatTabPane #chatMessages {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    padding: 1rem;
    margin: 0;
}

/* Input container and other controls should not shrink */
#aiChatTabPane .chat-input-container {
    flex-shrink: 0;
    margin: 0;
    padding: 1rem;
    background-color: var(--bs-dark);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

#aiChatTabPane .deep-research-toggle-container {
    flex-shrink: 0;
    margin: 0.75rem 1rem;
}

#aiChatTabPane #extendedContextAccordion {
    flex-shrink: 0;
    margin: 0.5rem 1rem 0.75rem 1rem;
}

#aiChatTabPane .text-muted.small {
    flex-shrink: 0;
/*    margin: 0 1rem 0.5rem 1rem; */
}

/* Remove any extra spacing at the bottom */
#aiChatTabPane > *:last-child {
    margin-bottom: 0;
}

/* Responsive adjustments */
@media (max-height: 768px) {
    #chatModal .modal-dialog {
        height: 90vh;
        max-height: 90vh;
        margin: 5vh auto;
    }
}

@media (max-height: 600px) {
    #chatModal .modal-dialog {
        height: 95vh;
        max-height: 95vh;
        margin: 2.5vh auto;
    }
}

/* Ensure other tab panes also work correctly */
#chatSummaryTabPane,
#extendedContextTabPane,
#chatNotesTabPane {
    padding: 1rem;
}

#chatSummaryTabPane #directChatSummaryContent,
#extendedContextTabPane #directExtendedContextContent {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
}

#chatNotesTabPane .notes-container {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
}

#chatNotesTabPane textarea {
    flex: 1 1 auto;
    min-height: 0;
    resize: none;
} 