/* Responsive Layout Fix
 * This CSS improves the responsive behavior of the application
 * by prioritizing the main content area when screen width is reduced
 */

/* Base layout improvements */
.social1-layout {
  display: flex;
  min-height: 100vh;
  max-width: 100%;
  margin: 0 auto;
  position: relative;
}

/* Main content area - always takes available space */
.social1-main-content {
  transition: all 0.3s ease;
  min-width: 0; /* Allows content to shrink below its minimum content size */
  flex: 1;      /* Takes up all available space */
  overflow-x: hidden; /* Prevents horizontal scrolling within the content area */
  width: calc(100% - var(--sidebar-width)); /* Ensure it takes full width minus sidebar */
  margin-left: var(--sidebar-width);
  margin-right: 0; /* No right margin since right sidebar is removed */
}

/* Right sidebar has been removed, so no need for this media query */

@media (max-width: 992px) {
  /* Collapse left sidebar to icon-only mode */
  .social1-sidebar {
    width: 70px;
  }
  
  .social1-sidebar .social1-nav-item span {
    display: none;
  }
  
  .social1-sidebar .social1-nav-item {
    justify-content: center;
    padding: 12px;
  }
  
  .social1-sidebar .social1-nav-item i {
    margin-right: 0;
  }
  
  .social1-main-content {
    margin-left: 70px;
    width: calc(100% - 70px);
    max-width: none;
    flex-basis: 0;
    flex-grow: 1;
  }
  
  .social1-logo {
    font-size: 1.2rem;
    text-align: center;
    margin-bottom: 16px;
  }
  
  .social1-logo a {
    justify-content: center;
  }
  
  /* Ensure content in the main area expands properly */
  .chat-container,
  .feed-container,
  .content-container {
    width: 100%;
    max-width: 100%;
  }
}

@media (max-width: 768px) {
  /* Hide sidebar completely on small screens */
  .social1-sidebar {
    display: none;
  }
  
  /* No need for sidebar nav styles since it's hidden */
  .social1-sidebar-nav {
    display: none;
  }
  
  .social1-logo {
    display: none;
  }
  
  .social1-main-content {
    margin-left: 0;
    margin-right: 0;
    width: 100%;
    max-width: 100%;
    flex-basis: 100%;
  }
  
  /* Ensure all containers take full width */
  .container, 
  .container-fluid, 
  .chat-container,
  .feed-container,
  .content-container {
    width: 100%;
    max-width: 100%;
    padding-left: 15px;
    padding-right: 15px;
  }
}

/* Fix for chat container to maintain proper width and eliminate whitespace */
.chat-container {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

/* Ensure the social1-main-content has no right margin when in chat view */
.chat-view .social1-main-content {
  margin-right: 0 !important;
}

/* Ensure the chat main area stays within boundaries and doesn't get scrunched */
.chat-main {
  width: 100%;
  max-width: 100% !important; /* Force 100% max-width */
  min-width: 0; /* Allow shrinking below content size */
  overflow-x: visible; /* Allow content to be fully visible */
}

/* Ensure content doesn't overflow horizontally but is fully visible */
.chat-messages {
  overflow-x: visible;
  width: 100%;
  max-width: 100%;
}

/* Global fix for chat input and submit button */
/* This ensures they're always visible regardless of layout */
.chat-main {
  position: relative;
  overflow: visible !important;
}

/* Ensure input group and submit button are always visible */
.chat-input-container {
  width: auto !important;
  max-width: calc(100% - 20px) !important;
  box-sizing: border-box !important;
  padding-right: 20px !important;
}

.input-group {
  width: 100% !important;
  max-width: calc(100% - 20px) !important;
  box-sizing: border-box !important;
}

#chat-form button[type="submit"] {
  position: static !important;
  display: flex !important;
  min-width: 50px !important;
  margin-left: 10px !important;
  visibility: visible !important;
  opacity: 1 !important;
}

/* Specific fix for the chat page layout when right sidebar is hidden */
@media (max-width: 1280px) {
  .chat-container {
    max-width: none !important;
    width: 100% !important;
    overflow-x: visible !important;
  }
  
  .chat-main {
    max-width: none !important;
    width: 100% !important;
    overflow-x: visible !important;
  }
  
  .chat-input-container {
    width: 100% !important;
    padding-bottom: 20px !important;
    margin-bottom: 15px !important;
  }
  
  .input-group {
    width: 100% !important;
    padding-right: 10px !important;
  }
  
  #chat-form button[type="submit"] {
    display: flex !important;
    position: relative !important;
    right: auto !important;
    min-width: 50px !important;
  }
  
  /* Override any fixed width constraints */
  .social1-main-content > * {
    max-width: none !important;
    width: 100% !important;
  }
}

/* Specific fix for when right sidebar is visible */
@media (min-width: 1281px) {
  /* Adjust chat container to account for right sidebar */
  .chat-container {
    width: calc(100% - var(--right-sidebar-width)) !important;
    max-width: calc(100% - var(--right-sidebar-width)) !important;
  }
  
  /* Ensure chat header fits within container and uses available space */
  .chat-header {
    width: 100% !important;
    max-width: 100% !important;
    padding-left: 20px !important;
    padding-right: 20px !important;
  }
  
  /* Ensure chat title uses appropriate space */
  #chat-title {
    flex: 1 1 auto !important;
    max-width: none !important;
  }
  
  /* Ensure chat actions buttons are visible and properly positioned */
  .chat-actions {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    position: relative !important;
    z-index: 20 !important;
    margin-left: auto !important;
  }
  
  /* Fix input container width to use full available space */
  .chat-input-container {
    width: 100% !important;
    max-width: 100% !important;
    padding-left: 20px !important;
    padding-right: 20px !important;
    right: auto !important;
    left: auto !important;
  }
  
  /* Fix input group width to use full available space */
  .input-group {
    width: 100% !important;
    max-width: 100% !important;
    padding-right: 0 !important;
  }
  
  /* Ensure submit button is always visible */
  #chat-form button[type="submit"] {
    position: static !important;
    display: flex !important;
    min-width: 50px !important;
    visibility: visible !important;
    opacity: 1 !important;
    flex-shrink: 0 !important;
    margin-left: 10px !important;
  }
}

/* Ensure message content wraps properly and is fully visible */
.message-content {
  word-wrap: break-word;
  overflow-wrap: break-word;
  max-width: 100%;
  width: 100%;
  overflow-x: visible;
}

/* Ensure images and media don't overflow */
img, video, iframe {
  max-width: 100%;
  height: auto;
}
