/**
 * Consolidated Mobile Fixes
 * Comprehensive CSS fixes for mobile display issues in Vigthoria LLM Chat
 * Version: 1.0.0 (May 13, 2025)
 */

/* Base mobile fixes */
@media (max-width: 767px) {
    /* Mobile header adjustments */
    .dashboard-header {
        padding: 10px;
        height: auto;
        min-height: 60px;
    }
    
    .header-title {
        font-size: 1rem;
    }
    
    .header-right .header-button {
        padding: 6px 8px;
        font-size: 0.8rem;
    }
    
    /* Mobile panels core fixes */
    .mobile-panel {
        position: fixed;
        top: 60px;
        left: 0;
        right: 0;
        bottom: 50px;
        z-index: 100;
        background-color: var(--bg-color);
        overflow-y: auto;
        display: none;
    }
    
    .mobile-panel.active {
        display: block !important;
    }
    
    .panel-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 10px 15px;
        background-color: rgba(0, 0, 0, 0.2);
        border-bottom: 1px solid rgba(var(--accent-rgb), 0.3);
    }
    
    .panel-content {
        padding: 15px;
        height: calc(100% - 50px);
        overflow-y: auto;
    }
    
    /* Mobile navigation */
    .mobile-navigation {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        height: 50px;
        display: flex;
        justify-content: space-around;
        align-items: center;
        background-color: rgba(0, 0, 0, 0.8);
        border-top: 1px solid rgba(var(--accent-rgb), 0.5);
        z-index: 101;
    }
    
    .panel-tab {
        flex: 1;
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        color: rgba(255, 255, 255, 0.7);
        cursor: pointer;
        transition: all 0.2s ease;
    }
    
    .panel-tab:hover,
    .panel-tab.active {
        color: var(--accent-color);
    }
    
    .panel-tab-icon {
        font-size: 1.2rem;
        margin-bottom: 3px;
    }
    
    .panel-tab-label {
        font-size: 0.7rem;
        text-transform: uppercase;
    }
    
    /* Fix the chat container display in mobile chat panel */
    #mobile-chat-panel .chat-container,
    #mobile-chat-panel .panel-content .chat-container,
    #mobile-chat-panel .mobile-chat-wrapper .chat-container {
        display: flex !important;
        flex-direction: column;
        height: calc(100vh - 110px);
        width: 100%;
        padding: 5px;
        overflow: hidden;
    }
    
    /* Fix chat messages display */
    #mobile-chat-panel .chat-messages {
        flex: 1;
        display: block !important;
        height: auto !important;
        min-height: 200px;
        overflow-y: auto;
        padding: 10px 5px;
    }
    
    /* Fix chat form */
    #mobile-chat-panel .chat-form {
        width: 100%;
        padding: 10px 0;
        margin-top: auto;
        display: flex !important;
        flex-direction: column;
    }
    
    /* Fix input container */
    #mobile-chat-panel .input-container {
        width: 100%;
        display: flex !important;
        position: relative;
    }
    
    /* Fix chat input */
    #mobile-chat-panel .chat-input {
        flex: 1;
        width: 100%;
        min-height: 60px;
        border-radius: 8px;
        resize: none;
        padding-right: 40px;
    }
    
    /* Fix send button positioning */
    #mobile-chat-panel .send-icon-button {
        position: absolute;
        right: 10px;
        top: 50%;
        transform: translateY(-50%);
        background: none;
        border: none;
        color: var(--accent-color);
        font-size: 20px;
        z-index: 2;
    }
    
    /* Fix chat buttons */
    #mobile-chat-panel .chat-buttons {
        display: flex !important;
        justify-content: space-between;
        margin-top: 10px;
        width: 100%;
    }
    
    #mobile-chat-panel .chat-buttons button {
        flex: 1;
        margin: 0 5px;
        padding: 8px 12px;
        font-size: 0.8rem;
    }
    
    /* Settings modal fixes */
    #settings-modal {
        z-index: 1000;
    }
    
    #settings-modal .modal-content {
        width: 95%;
        max-width: 95%;
        max-height: 90vh;
        overflow-y: auto;
        margin: 20px auto;
    }
    
    /* Fix message rendering */
    .message {
        padding: 10px;
        margin-bottom: 10px;
    }
    
    .message-content {
        max-width: 100%;
        overflow-x: auto;
    }
    
    /* Fix code blocks in messages */
    .message pre {
        max-width: 100%;
        overflow-x: auto;
    }
    
    /* Fix sidebar at mobile sizes */
    .dashboard-sidebar {
        display: none;
    }
    
    /* Make sure the main dashboard is full-width */
    .dashboard-main {
        width: 100%;
    }
    
    /* Hide elements that don't work well on mobile */
    .dashboard-panel {
        display: none;
    }
}

/* Tablet adjustments */
@media (min-width: 768px) and (max-width: 1024px) {
    .dashboard-sidebar {
        width: 250px;
    }
    
    .mobile-panels, 
    .mobile-navigation {
        display: none;
    }
}
