/* Мобильная адаптация для всех страниц */

/* Базовые настройки для мобильных */
@media (max-width: 768px) {
  body {
    overflow-x: hidden;
  }

  /* Контейнер приложения */
  .app-container {
    flex-direction: column;
  }

  /* Основной контент */
  .content {
    margin-left: 0 !important;
    width: 100%;
  }

  .main-content-wrapper {
    margin-left: 0 !important;
    padding: 0 15px 15px 15px !important;
    max-width: 100% !important;
  }

  /* Сайдбар - бургер меню */
  .sidebar {
    position: relative;
    width: 100%;
    height: auto;
    transform: none;
    transition: transform 0.3s ease;
    z-index: 9999;
  }
  
  .sidebar:not(.collapsed) {
    position: fixed !important;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    transform: translateX(0);
  }

  .sidebar.collapsed {
    width: 100%;
    height: auto;
    background: transparent;
    position: relative;
  }



  .sidebar.collapsed .nav,
  .sidebar.collapsed .sidebar-footer {
    display: none;
  }

  /* Оверлей для закрытия меню */
  .sidebar:not(.collapsed)::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: -1;
  }

  /* Профиль */
  .profile-container {
    padding: 15px;
  }

  .profile-info {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .avatar-section {
    margin: 0 auto;
  }

  .user-details {
    text-align: left;
  }

  .detail-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 5px;
  }

  .detail-item label {
    min-width: auto;
  }

  .profile-actions {
    flex-direction: column;
  }

  .action-btn {
    width: 100%;
  }
  
  /* Кнопки компаний */
  .company-buttons {
    flex-direction: column !important;
    gap: 10px !important;
  }
  
  .company-btn {
    width: 100% !important;
    padding: 10px 16px !important;
    font-size: 14px !important;
  }
  
  /* Секция подписок */
  .follow-section {
    flex-direction: column !important;
    gap: 10px !important;
  }
  
  .follow-section button {
    width: 100% !important;
  }

  .edit-profile-btn-top {
    top: 10px;
    right: 10px;
    padding: 6px 12px;
    font-size: 12px;
  }

  /* Посты */
  .post-form {
    padding: 15px;
  }

  .post-input-container {
    flex-direction: column;
    gap: 10px;
  }

  .post-avatar {
    width: 36px;
    height: 36px;
  }

  .post-actions {
    flex-direction: column;
    gap: 10px;
  }

  .post-action-btn {
    width: 100%;
  }

  /* Модальные окна */
  .modal-content {
    width: 95%;
    padding: 20px;
    max-height: 90vh;
  }

  .form-row {
    flex-direction: column;
    gap: 10px;
  }

  /* Сообщения */
  .messages-container {
    grid-template-columns: 1fr;
    margin-left: 0 !important;
    height: 100vh;
    margin-top: 0;
  }

  .messages-sidebar {
    display: block !important;
    height: 100%;
  }

  .messages-main {
    display: none !important;
    height: calc(100vh - 60px);
    position: fixed;
    top: 60px;
    left: 0;
    width: 100%;
    background: white;
    z-index: 1000;
  }
  
  .messages-main.show {
    display: flex !important;
  }
  
  .messages-main .messages-area {
    flex: 1;
    overflow-y: auto;
  }
  
  .messages-main .message-form {
    display: flex !important;
  }

  .chat-header {
    padding: 15px;
    position: sticky;
    top: 0;
    z-index: 100;
  }

  .messages-area {
    padding: 15px;
  }

  .message {
    max-width: 85%;
  }

  .message-form {
    padding: 15px;
  }

  /* Кнопка "Назад к чатам" */
  .back-to-chats {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: none;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    font-size: 14px;
    padding: 5px;
    margin-right: 10px;
  }

  /* Лента новостей */
  .feed-container {
    padding: 15px;
  }
  
  .feed-controls {
    flex-direction: column !important;
    gap: 10px !important;
  }
  
  .feed-controls input,
  .feed-controls button {
    width: 100% !important;
  }
  
  .profile-header {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    padding: 15px !important;
    gap: 15px !important;
  }
  
  .profile-header h1 {
    margin: 0 !important;
    font-size: 20px !important;
    order: 1;
  }
  
  .profile-header .back-btn {
    order: 2;
    padding: 8px 16px !important;
    font-size: 14px !important;
    flex-shrink: 0 !important;
  }

  .feed-filters {
    flex-direction: column;
    gap: 10px;
  }

  .filter-btn {
    width: 100%;
  }

  .search-input {
    width: 100%;
  }

  /* Профессионалы, кастинги, вакансии */
  .professionals-container,
  .castings-container,
  .vacancies-container {
    padding: 15px;
  }

  .professional-card,
  .casting-card,
  .vacancy-card {
    padding: 15px;
  }
  
  .professionals-header {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    text-align: left !important;
    gap: 15px !important;
  }
  
  .professionals-header h1 {
    margin: 0 !important;
    font-size: 20px !important;
  }
  
  .professionals-header .back-btn {
    position: static !important;
    transform: none !important;
    padding: 8px 16px !important;
    font-size: 14px !important;
    flex-shrink: 0 !important;
  }
  
  /* Фильтры профессионалов и компаний */
  .filters-container {
    padding: 15px !important;
  }
  
  .filters-container > div {
    flex-direction: column !important;
    gap: 10px !important;
  }
  
  .filters-container input,
  .filters-container select,
  .filters-container button {
    width: 100% !important;
    min-width: auto !important;
  }

  /* Уведомления */
  .notifications-container {
    padding: 15px;
  }

  .notification-item {
    padding: 12px;
  }

  /* Главная страница */
  .company-header {
    padding: 15px 0;
  }

  .company-logo {
    width: 60px;
    height: 60px;
  }

  .company-name {
    font-size: 22px;
  }

  .search-container {
    padding: 0 15px;
  }

  .category-selector {
    padding: 20px;
  }

  .main-buttons {
    flex-direction: column;
    gap: 10px;
  }

  .category-btn {
    width: 100%;
    padding: 12px 20px;
    font-size: 16px;
  }

  .profession-buttons {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .profession-btn {
    padding: 12px;
    font-size: 14px;
  }

  /* Тултипы и всплывающие окна */
  .likes-tooltip {
    max-width: 250px;
    left: 50% !important;
    transform: translateX(-50%);
  }

  /* Формы */
  input[type="text"],
  input[type="email"],
  input[type="password"],
  input[type="date"],
  textarea,
  select {
    font-size: 16px !important; /* Предотвращает зум на iOS */
  }

  /* Скрытие элементов на мобильных */
  .desktop-only {
    display: none !important;
  }
  
  /* Курсор для карточек на мобильных */
  .casting-item,
  .vacancy-item {
    cursor: pointer;
  }

  /* Показ элементов только на мобильных */
  .mobile-only {
    display: block !important;
  }
}

/* Очень маленькие экраны */
@media (max-width: 480px) {
  .main-content-wrapper {
    padding: 60px 10px 10px 10px !important;
  }

  .profile-container {
    padding: 10px;
  }

  .modal-content {
    padding: 15px;
  }

  .company-name {
    font-size: 18px;
  }

  .category-selector {
    padding: 15px;
  }

  .message {
    max-width: 90%;
  }
}

/* Ландшафтная ориентация на мобильных */
@media (max-width: 768px) and (orientation: landscape) {
  .messages-container {
    height: 100vh;
    margin-top: 0;
  }

  .messages-main {
    height: 100vh;
  }

  .main-content-wrapper {
    padding-top: 70px !important;
  }
}
