/* Fix all layout and functionality issues */

/* 1. Fix chat window height and borders */
#askMode {
    height: 100% !important;
    border: 1px solid #e0e0e0 !important;
    border-radius: 8px !important;
    overflow: hidden !important;
}

.chat-container {
    height: 100% !important;
    display: flex !important;
    flex-direction: column !important;
    padding: 0 !important;
}

.chat-header {
    flex-shrink: 0 !important;
    border-bottom: 1px solid #e0e0e0 !important;
    padding: 1rem !important;
    background: #f8f9fa !important;
}

.chat-messages {
    flex: 1 !important;
    overflow-y: auto !important;
    padding: 1.5rem !important;
    min-height: 0 !important;
    background: white !important;
}

.chat-input-container {
    flex-shrink: 0 !important;
    border-top: 1px solid #e0e0e0 !important;
    padding: 1rem !important;
    background: #f8f9fa !important;
    margin-top: 0 !important;
}

/* 2. Fix teach mode scrolling */
#teachMode {
    height: 100% !important;
    overflow-y: auto !important;
    border: 1px solid #e0e0e0 !important;
    border-radius: 8px !important;
}

.teach-container {
    height: 100% !important;
    overflow-y: auto !important;
    padding: 2rem !important;
}

/* Ensure file upload section is visible */
.file-upload-section {
    display: block !important;
    margin-top: 2rem !important;
}

.upload-area {
    display: block !important;
    border: 2px dashed #ccc !important;
    border-radius: 8px !important;
    padding: 2rem !important;
    text-align: center !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
}

.upload-area:hover {
    border-color: #2E7D32 !important;
    background: rgba(46, 125, 50, 0.05) !important;
}

/* 3. Fix expert mode */
#expertMode {
    height: 100% !important;
    overflow-y: auto !important;
    border: 1px solid #e0e0e0 !important;
    border-radius: 8px !important;
}

/* 4. Fix user button */
.user-btn {
    pointer-events: auto !important;
    cursor: pointer !important;
    z-index: 1000 !important;
    position: relative !important;
}

.header-controls {
    position: relative !important;
    z-index: 1000 !important;
}

/* 5. Fix content area height */
.content-area {
    height: calc(100vh - 80px) !important;
    padding: 1rem !important;
}

.mode-content {
    height: 100% !important;
}

.mode-content.active {
    height: 100% !important;
}

/* 6. Add clear visual segmentation */
.sidebar {
    border-right: 2px solid #e0e0e0 !important;
    background: #f8f9fa !important;
}

.fred-header {
    border-bottom: 2px solid #e0e0e0 !important;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1) !important;
}

/* 7. Fix sidebar sections */
.sidebar-section {
    border-top: 1px solid #e0e0e0 !important;
    padding: 1rem !important;
}

/* 8. Ensure proper z-index for dropdowns */
.user-dropdown {
    z-index: 9999 !important;
}

/* 9. Fix modal z-index */
.modal {
    z-index: 10000 !important;
}

/* 10. Performance improvements */
* {
    will-change: auto !important;
}

.chat-messages {
    will-change: scroll-position !important;
}

/* 11. Fix input widths */
#questionInput {
    width: 100% !important;
}

/* 12. Better visual hierarchy */
.nav-item.active {
    background: rgba(46, 125, 50, 0.15) !important;
    font-weight: 600 !important;
}

/* 13. Fix profile mode */
#profileMode {
    height: 100% !important;
    overflow-y: auto !important;
    border: 1px solid #e0e0e0 !important;
    border-radius: 8px !important;
    padding: 2rem !important;
}

/* 14. Ensure teach form elements are visible */
.teach-form {
    display: block !important;
}

.input-group {
    margin-bottom: 1.5rem !important;
}

/* 15. Fix button hover states */
button:hover:not(:disabled) {
    opacity: 0.9 !important;
    transform: translateY(-1px) !important;
}

/* 16. Debug helper - remove after testing */
.debug-border {
    border: 2px solid red !important;
}