/* 
 * Vigthoria Neural Nexus - Mobile CSS
 * Mobile-specific styles for responsive design
 * Version: 3.0.0
 */

/* ===== Mobile Breakpoints ===== */
@media screen and (max-width: 992px) {
  .header-title span {
    display: none;
  }
  
  .connection-status {
    display: none;
  }
  
  .dashboard-content {
    grid-template-columns: 270px 1fr;
  }
}

@media screen and (max-width: 768px) {
  /* Improved header layout for mobile */
  .dashboard-header {
    padding: 0.5rem;
    gap: 0.5rem;
    height: auto;
    min-height: 60px;
    flex-wrap: wrap;
  }
  
  .header-left {
    gap: 0.5rem;
  }
  
  .header-title {
    font-size: 1rem;
  }
  
  .header-right {
    gap: 0.25rem;
  }
  
  .header-button {
    padding: 0.25rem 0.5rem;
    font-size: 0.8rem;
  }
  
  /* Hide lesser important elements on mobile */
  .connection-status,
  .version-badge,
  .header-center {
    display: none;
  }
    /* Base mobile styling */
  .dashboard-content {
    display: block;
    position: relative;
    transition: transform 0.3s ease;
  }
  
  .mobile-toggle {
    display: flex;
  }
  
  .dashboard-panel {
    padding: 0.5rem;
  }
  
  .panel-row {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .templates, .export-buttons {
    width: 100%;
  }
}

/* Mobile panel system - STRICT MOBILE-ONLY */
.mobile-panels,
.mobile-navigation,
.mobile-panel,
.mobile-footer,
.mobile-nav,
.mobile-tabs,
#mobile-container {
  display: none !important; /* Completely hidden on desktop - no exceptions */
}
  
@media screen and (max-width: 768px) {
  #mobile-container {
    display: block !important; /* Shown on mobile */
    position: fixed;
    top: 60px; /* Header height */
    left: 0;
    width: 100%;
    height: calc(100vh - 110px); /* Full height minus header and nav */
    /* overflow: hidden; */ /* Allow child panels to manage their own overflow */
    z-index: 90;
    background-color: var(--bg-primary);
  }
  
  .mobile-panels,
  .mobile-navigation,
  .mobile-panel,
  .mobile-footer,
  .mobile-nav,
  .mobile-tabs {
    display: flex !important; /* Shown on mobile */
  }
}
.mobile-panel {
    flex: 1;
    width: 33.333%;
    height: 100%;
    overflow-y: auto;
    background-color: var(--bg-secondary);
    border-radius: 4px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    position: relative;
    display: flex;
    flex-direction: column;
  }
  
  .panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    background-color: var(--bg-header);
    border-bottom: 1px solid var(--border-primary);
    height: 60px;
  }
  
  .panel-header h2 {
    font-size: 1.25rem;
    margin: 0;
  }
  
  .panel-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1rem;
    cursor: pointer;
    padding: 0.5rem;
  }
  
  .panel-content {
    flex: 1;
    padding: 1rem;
    overflow-y: auto;
    height: calc(100% - 60px);
  }
  
  .dashboard-sidebar {
    height: calc(100vh - 60px);
    width: 100%;
    position: relative;
    border-right: none;
  }
    .dashboard-main {
    height: calc(100vh - 60px);
    width: 100%;
  }
  
  /* Panel navigation */
  .mobile-navigation {
    display: none; /* Hidden on desktop */
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 60px;
    background-color: var(--bg-header);
    border-top: 1px solid var(--border-primary);
    z-index: 100;
  }
  
@media screen and (max-width: 768px) {
  .mobile-navigation {
    display: flex !important; /* Shown on mobile */
  }
}
  
  .panel-tab {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    padding: 0.5rem;
    color: var(--text-secondary);
    transition: all 0.2s ease;
  }
  
  .panel-tab.active {
    color: var(--text-accent);
  }
  
  .panel-tab-icon {
    font-size: 1.25rem;
  }
  
  .panel-tab-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.5px;
  }  /* Panel positions */
  .mobile-panels[data-active-panel="mobile-nav-panel"] {
    transform: translateX(0);
  }
  
  .mobile-panels[data-active-panel="mobile-chat-panel"] {
    transform: translateX(-33.333%);
  }
  
  .mobile-panels[data-active-panel="mobile-model-panel"] {
    transform: translateX(-66.666%);
  }
  
  /* Ensure panels are visible on mobile */
  @media screen and (max-width: 768px) {
    .dashboard-sidebar,
    .dashboard-main,
    .models-section {
      display: none !important;
    }
    
    #mobile-container {
      display: block !important;
    }
    
    .mobile-navigation {
      display: flex !important;
    }
      /* Fix panel content containers */
    .mobile-panel .panel-content {
      padding: 1rem;
      height: calc(100% - 60px); /* Allow for panel header */
      overflow-y: auto;
      position: relative;
      padding-bottom: 70px; /* Add padding to prevent content from hiding behind the chat form */
    }
    
    /* Improved chat container in mobile panels */
    #mobile-chat-panel .chat-container {
      height: 100%;
      margin: 0;
      padding: 0; /* Remove padding if chat-messages handles it */
      display: flex;
      flex-direction: column;
    }
    
    #mobile-chat-panel .chat-messages {
      flex: 1;
      overflow-y: auto;
      padding: 0.75rem;
      /* height: calc(100% - 120px); */ /* Let flexbox determine height */
      /* Remove fixed height, rely on flex-grow and parent's height */
    }
    
    #mobile-chat-panel .chat-form {
      position: sticky; /* Changed from absolute to sticky */
      bottom: 0;
      left: 0;
      width: 100%;
      background-color: var(--bg-secondary);
      border-top: 1px solid var(--border-primary);
      padding: 0.75rem;
      z-index: 5;
      /* margin-top: auto; */ /* Push to bottom of flex container if needed */
    }
  }
  
  /* Modal adjustments */
  .modal-content {
    width: 95%;
    max-height: 85vh;
  }
  
  .modal-body {
    padding: 1rem;
  }
  
  .settings-section h3 {
    font-size: 1rem;
  }
  
  .footer-buttons {
    flex-direction: column;
    gap: 0.5rem;
    width: 100%;
  }
  
  .footer-buttons button {
    width: 100%;
  }
  
  /* Models grid */
  .models-grid {
    grid-template-columns: 1fr;
    margin-bottom: 60px; /* Space for fixed navigation */
  }
  
  /* Chat container adjustments */
  .chat-container {
    /* margin-bottom: 60px; */ /* Remove this if mobile panels handle spacing */
    /* This might be conflicting with mobile panel structure */
  }
  
  .message {
    max-width: 95%;
  }
  
  /* Swipe indicators */
  .swipe-indicator {
    position: absolute;
    top: 50%;
    width: 30px;
    height: 30px;
    background-color: var(--bg-accent-transparent);
    color: var(--text-accent);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    opacity: 0.7;
    z-index: 10;
  }
  
  .swipe-left {
    left: 10px;
    transform: translateY(-50%);
  }
  
  .swipe-right {
    right: 10px;
    transform: translateY(-50%);
  }
  
  /* Mobile gestures */
  .gesture-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 5;
  }
  
  /* Additional mobile-specific styling */
  .header-title {
    font-size: 1.1rem;
    white-space: nowrap; /* Prevent title from wrapping if too long */
    overflow: hidden;
    text-overflow: ellipsis; /* Add ellipsis if title is too long */
    flex-shrink: 1; /* Allow title to shrink if space is needed */
  }
  
  .version-badge {
    display: none;
  }
  
  .chat-input-container {
    padding: 0.75rem;
  }
  
  .chat-input-wrapper {
    gap: 0.5rem;
  }
  
  .chat-control-button {
    width: 40px;
    height: 40px;
  }
  
  .chat-input-textarea {
    padding: 0.5rem 0.75rem;
  }
}

/* Small devices (under 480px) */
@media screen and (max-width: 480px) {
  .header-button span {
    display: none;
  }
  
  .header-button {
    width: 36px; /* Slightly reduce button size */
    height: 36px; /* Slightly reduce button size */
    padding: 0;
    font-size: 0.9rem; /* Adjust icon font size if necessary */
  }
  
  .header-left {
    gap: 0.25rem; /* Reduce gap in header */
    flex-shrink: 1; /* Allow left side to shrink */
    min-width: 0; /* Allow shrinking below content size */
  }
  
  .header-right {
    gap: 0.25rem; /* Reduce gap in header */
    flex-shrink: 0; /* Keep right side from shrinking too much */
  }
  
  .dashboard-header {
    padding: 0.5rem;
    height: 50px;
    justify-content: space-between; /* Ensure space is distributed */
  }
  
  .modal-header {
    padding: 0.75rem;
  }
  
  .modal-header h2 {
    font-size: 1rem;
  }
  
  .close-button {
    font-size: 1rem;
  }
  
  .dashboard-sidebar,
  .dashboard-main {
    height: calc(100vh - 50px);
  }
  
  .mobile-navigation {
    height: 50px;
  }
  
  .panel-tab-icon {
    font-size: 1rem;
  }
  
  .chat-container {
    margin-bottom: 50px;
  }
  
  .message {
    padding: 0.5rem 0.75rem;
  }
  
  .models-grid {
    margin-bottom: 50px;
  }
}

/* Portrait orientation specific adjustments */
@media screen and (max-width: 768px) and (orientation: portrait) {
  .chat-messages-container {
    padding: 0.75rem;
  }
  
  .message-content {
    font-size: 0.95rem;
  }
}

/* Landscape orientation specific adjustments */
@media screen and (max-width: 768px) and (orientation: landscape) {
  .dashboard-header {
    height: 50px;
  }
  
  .dashboard-sidebar,
  .dashboard-main {
    height: calc(100vh - 50px);
  }
  
  .mobile-navigation {
    height: 50px;
  }
  
  .chat-container {
    margin-bottom: 50px;
  }
  
  .models-grid {
    margin-bottom: 50px;
  }
}
