/* Мобільні стилі для сторінки заявок з табами */

/* Контейнер табів - показуємо тільки на мобільних */
.mobile-tabs-container {
  display: none;
}

/* Мобільні стилі */
@media (max-width: 768px) {
  /* Приховуємо десктопну сітку колонок */
  .task-container > div[style*="grid-template-columns"] {
    display: none !important;
  }

  /* Показуємо контейнер табів */
  .mobile-tabs-container {
    display: block;
    margin-top: 14px;
    padding: 0 4px; /* Додаємо невеликі відступи */
    box-sizing: border-box;
  }

  /* Обмежуємо ширину основного контейнера */
  .zaiavki-main {
    max-width: 100vw;
    overflow-x: hidden;
    padding: 8px !important;
    box-sizing: border-box;
  }

  /* Стилі табів */
  .mobile-tabs {
    display: flex;
    background: linear-gradient(180deg, rgba(255,255,255,0.08), rgba(255,255,255,0.04));
    border-radius: 12px;
    padding: 4px;
    margin-bottom: 16px;
    border: 1px solid var(--stroke);
    box-shadow: var(--shadow-1);
    backdrop-filter: blur(10px);
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    max-width: 100%;
    box-sizing: border-box;
  }

  .mobile-tabs::-webkit-scrollbar {
    display: none;
  }

  /* Кнопки табів */
  .mobile-tab {
    flex: 1;
    min-width: 70px;
    max-width: 25%;
    padding: 8px 4px;
    background: transparent;
    border: none;
    border-radius: 8px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 600;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
    position: relative;
    overflow: hidden;
    box-sizing: border-box;
  }

  .mobile-tab::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(79,156,255,0.15), rgba(123,97,255,0.12));
    opacity: 0;
    transition: opacity 0.3s ease;
    border-radius: 8px;
  }

  .mobile-tab.active {
    color: var(--text);
    background: linear-gradient(135deg, rgba(79,156,255,0.2), rgba(123,97,255,0.15));
    box-shadow: 0 2px 8px rgba(79,156,255,0.3);
    transform: translateY(-1px);
  }

  .mobile-tab.active::before {
    opacity: 1;
  }

  .mobile-tab:hover:not(.active) {
    color: var(--text);
    background: rgba(255,255,255,0.08);
    transform: translateY(-1px);
  }

  /* Лічильник задач в табі */
  .mobile-tab .tab-count {
    display: inline-block;
    margin-left: 2px;
    padding: 1px 4px;
    background: rgba(255,255,255,0.15);
    border-radius: 8px;
    font-size: 9px;
    font-weight: 700;
    min-width: 14px;
    text-align: center;
    line-height: 1.2;
  }

  .mobile-tab.active .tab-count {
    background: rgba(255,255,255,0.25);
    color: var(--text);
  }

  /* Контент табів */
  .mobile-tab-content {
    display: none;
    animation: fadeIn 0.3s ease-in-out;
  }

  .mobile-tab-content.active {
    display: block;
  }

  @keyframes fadeIn {
    from {
      opacity: 0;
      transform: translateY(10px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }

  /* Стилі для карток задач в мобільному режимі */
  .mobile-task-list {
    display: grid;
    gap: 12px;
    max-width: 100%;
    box-sizing: border-box;
  }

  .mobile-task-card {
    background: linear-gradient(180deg, rgba(255,255,255,0.06), rgba(255,255,255,0.03));
    border: 1px solid var(--stroke);
    border-radius: 12px;
    padding: 14px;
    box-shadow: var(--shadow-1);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    max-width: 100%;
    box-sizing: border-box;
    word-wrap: break-word;
  }

  .mobile-task-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(79,156,255,0.08), rgba(123,97,255,0.05));
    opacity: 0;
    transition: opacity 0.3s ease;
  }

  .mobile-task-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-2);
    border-color: rgba(79,156,255,0.3);
  }

  .mobile-task-card:hover::before {
    opacity: 1;
  }

  .mobile-task-card:active {
    transform: translateY(0) scale(0.98);
  }

  /* Заголовок задачі */
  .mobile-task-title {
    font-weight: 700;
    font-size: 16px;
    color: var(--text);
    margin-bottom: 8px;
    line-height: 1.3;
    position: relative;
    z-index: 1;
    word-wrap: break-word;
    overflow-wrap: break-word;
    max-width: 100%;
  }

  /* Статус задачі */
  .mobile-task-status {
    font-size: 13px;
    color: var(--muted);
    margin-bottom: 6px;
    position: relative;
    z-index: 1;
    word-wrap: break-word;
    overflow-wrap: break-word;
  }

  /* Інформація про об'єкт */
  .mobile-task-object {
    font-size: 13px;
    color: var(--muted);
    position: relative;
    z-index: 1;
    word-wrap: break-word;
    overflow-wrap: break-word;
  }

  /* Індикатор статусу */
  .mobile-task-card .status-indicator {
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    border-radius: 0 2px 2px 0;
  }

  /* Кольори індикаторів для різних статусів */
  .mobile-task-card.status-active .status-indicator {
    background: linear-gradient(180deg, var(--accent), var(--accent-3));
  }

  .mobile-task-card.status-pending .status-indicator {
    background: linear-gradient(180deg, var(--warning), #ffaa33);
  }

  .mobile-task-card.status-completed .status-indicator {
    background: linear-gradient(180deg, var(--success), #2bc48a);
  }

  .mobile-task-card.status-deleted .status-indicator {
    background: linear-gradient(180deg, var(--danger), #ff4757);
  }

  /* Пуста заглушка */
  .mobile-empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--muted);
  }

  .mobile-empty-state .empty-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
  }

  .mobile-empty-state .empty-text {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 8px;
  }

  .mobile-empty-state .empty-subtext {
    font-size: 14px;
    opacity: 0.7;
  }

  /* Адаптація тулбару для мобільних */
  .task-toolbar {
    margin-bottom: 8px;
    max-width: 100%;
    box-sizing: border-box;
  }

  /* Виправляємо стилі кнопок пошуку на мобільних */
  .task-toolbar .task-search .btn-light {
    background: linear-gradient(120deg, #f6f7fb, #e9ebf4 45%, #f6f7fb) !important;
    color: #0c1220 !important;
    border: 0 !important;
    font-weight: 600 !important;
    letter-spacing: 1px !important;
    box-shadow: 0 6px 16px rgba(33, 44, 69, .18) !important;
    transition: transform .15s ease, box-shadow .2s ease, background-position .35s ease !important;
  }

  .task-toolbar .task-search .btn-light:hover {
    transform: translateY(-1px) !important;
    box-shadow: 0 14px 28px rgba(79, 156, 255, .28) !important;
  }

  /* Приховуємо тулбар на дуже маленьких екранах */
  @media (max-width: 480px) {
    .task-toolbar {
      padding: 8px 10px;
    }
    
    .task-toolbar label span {
      display: none;
    }
    
    .task-toolbar select {
      min-width: 120px;
    }

    /* На дуже маленьких екранах показуємо тільки іконки */
    .task-toolbar .task-search .btn-light {
      min-width: 44px !important;
      padding: 10px !important;
      font-size: 0 !important;
    }
    
    .task-toolbar .task-search #taskSearchBtn::before {
      content: "🔍" !important;
      font-size: 16px !important;
      margin-right: 0 !important;
    }
    
    .task-toolbar .task-search #taskSearchClear::before {
      content: "↺" !important;
      font-size: 16px !important;
      margin-right: 0 !important;
    }
  }
}

/* Дуже маленькі екрани */
@media (max-width: 360px) {
  .mobile-tab {
    font-size: 10px;
    padding: 6px 3px;
    min-width: 60px;
  }

  .mobile-tab .tab-count {
    font-size: 8px;
    padding: 1px 3px;
    margin-left: 1px;
  }

  .mobile-task-card {
    padding: 12px;
  }

  .mobile-task-title {
    font-size: 15px;
  }

  .mobile-task-status,
  .mobile-task-object {
    font-size: 12px;
  }
}

/* Додаткові стилі для екранів шириною менше 400px */
@media (max-width: 400px) {
  .mobile-tabs {
    padding: 3px;
    margin: 0 2px 16px 2px;
  }
  
  .mobile-tab {
    font-size: 10px;
    padding: 6px 2px;
    min-width: 65px;
  }
}

/* Скорочені назви для дуже маленьких екранів */
@media (max-width: 380px) {
  .mobile-tab[data-tab="active"] {
    font-size: 0;
  }
  .mobile-tab[data-tab="active"]::after {
    content: "Активні";
    font-size: 9px;
  }
  
  .mobile-tab[data-tab="pending"] {
    font-size: 0;
  }
  .mobile-tab[data-tab="pending"]::after {
    content: "Очік.";
    font-size: 9px;
  }
  
  .mobile-tab[data-tab="completed"] {
    font-size: 0;
  }
  .mobile-tab[data-tab="completed"]::after {
    content: "Готові";
    font-size: 9px;
  }
  
  .mobile-tab[data-tab="deleted"] {
    font-size: 0;
  }
  .mobile-tab[data-tab="deleted"]::after {
    content: "Видал.";
    font-size: 9px;
  }
  
  .mobile-tab .tab-count {
    font-size: 8px;
    margin-left: 2px;
  }
}

/* Анімація появи карток */
.mobile-task-card {
  animation: slideInUp 0.4s ease-out both;
}

.mobile-task-card:nth-child(1) { animation-delay: 0.1s; }
.mobile-task-card:nth-child(2) { animation-delay: 0.15s; }
.mobile-task-card:nth-child(3) { animation-delay: 0.2s; }
.mobile-task-card:nth-child(4) { animation-delay: 0.25s; }
.mobile-task-card:nth-child(5) { animation-delay: 0.3s; }

@keyframes slideInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Покращення для landscape орієнтації на мобільних */
@media (max-width: 768px) and (orientation: landscape) {
  .mobile-tabs {
    padding: 3px;
  }
  
  .mobile-tab {
    padding: 8px 6px;
    font-size: 11px;
  }
  
  .mobile-task-card {
    padding: 10px 12px;
  }
}
