/* =============================================
   Filter Tabs Component
   Consolidated filters bar and tabs component
   ============================================= */

/* Main container (replaces filters-bar) */
.filter-tabs {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 28px;
  flex-wrap: wrap;
}

.filter-tabs-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  flex-shrink: 0;
}

/* Inventory page: Add Item button styling */
.filter-tabs-row .btn {
  /* Match filter-tab styling */
  padding: 12px 20px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0;
  height: 44px;
  box-sizing: border-box;
  white-space: nowrap;
}

.filter-tabs-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.filter-tabs-actions .btn {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  line-height: 1.2;
  white-space: nowrap;
  /* Match filter-tab styling */
  padding: 12px 20px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0;
  height: 44px;
  box-sizing: border-box;
}

/* If there is only ONE action button (inventory), don't stretch it */
.filter-tabs-actions-single .btn {
  flex: 0 0 auto;
  width: auto;
  min-width: 140px;
}

.filter-tabs-actions .btn > * {
  display: inline-flex;
  align-items: center;
  line-height: 1;
  vertical-align: middle;
}

.filter-tabs .btn {
  white-space: nowrap;
  padding: 12px 20px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.filter-tabs .btn svg {
  width: 18px;
  height: 18px;
}

/* Filter tabs container (nested inside main filter-tabs) */
.filter-tabs .filter-tabs-group {
  display: flex;
  gap: 8px;
}

.filter-tab {
  padding: 12px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s ease;
  height: 44px;
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.filter-tab:hover {
  border-color: var(--accent);
  color: var(--text-primary);
}

.filter-tab.active {
  background: linear-gradient(135deg, var(--accent), #00b894);
  border-color: transparent;
  color: var(--bg-primary);
}

/* Responsive Styles */
@media (max-width: 1024px) {
  .filter-tabs .btn {
    padding: 10px 16px;
    font-size: 13px;
    border-radius: 8px;
  }

  .filter-tabs .btn svg {
    width: 16px;
    height: 16px;
  }

  .filter-tabs .filter-tabs-group {
    gap: 4px;
  }

  .filter-tab {
    padding: 10px 16px;
    font-size: 13px;
    border-radius: 8px;
    height: 40px;
  }
  
  .filter-tabs-actions .btn {
    height: 40px;
  }

  /* Inventory page: Add Item button */
  .filter-tabs-row .btn {
    padding: 10px 16px;
    font-size: 13px;
    border-radius: 8px;
    height: 40px;
  }
}

@media (max-width: 768px) {
  .filter-tabs {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    margin-bottom: 20px;
    padding: 0;
  }

  .filter-tabs-row {
    margin: 0;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    width: 100%;
    flex-wrap: wrap;
  }

  .filter-tabs .btn {
    margin-left: auto;
    padding: 8px 14px;
    font-size: 12px;
    border-radius: 8px;
  }

  .filter-tabs .btn svg {
    width: 16px;
    height: 16px;
  }

  .filter-tabs .filter-tabs-group {
    display: flex;
    justify-content: stretch;
    margin-right: auto;
    gap: 6px;
    width: 100%;
  }

  .filter-tab {
    padding: 8px 12px;
    font-size: 12px;
    border-radius: 8px;
    flex: 1;
    height: 36px;
  }
  
  .filter-tabs-actions {
    width: 100%;
  }

  .filter-tabs-actions .btn {
    height: 36px;
  }

  /* Inventory page: Add Item button - fill available space in portrait */
  .filter-tabs-actions-single {
    width: 100%;
  }

  .filter-tabs-actions-single .btn {
    flex: 1;
    min-width: 0;
    width: 100%;
    height: 36px;
  }
}

@media (max-width: 480px) {
  .filter-tabs-row {
    gap: 6px;
    justify-content: flex-start;
  }

  .filter-tabs .btn {
    padding: 6px 12px;
    font-size: 11px;
    border-radius: 6px;
  }

  .filter-tabs .btn svg {
    width: 14px;
    height: 14px;
  }

  .filter-tabs .filter-tabs-group {
    margin-right: auto;
    gap: 4px;
  }

  .filter-tab {
    padding: 6px 10px;
    font-size: 11px;
    border-radius: 6px;
    height: 32px;
  }
  
  .filter-tabs-actions .btn {
    height: 32px;
  }

  /* Inventory page: Add Item button - fill available space in portrait */
  .filter-tabs-actions-single .btn {
    flex: 1;
    min-width: 0;
    width: 100%;
    height: 32px;
  }
}

@media (max-width: 360px) {
  .filter-tabs-row {
    gap: 4px;
    justify-content: flex-start;
  }

  .filter-tabs .btn {
    padding: 5px 10px;
    font-size: 10px;
    border-radius: 5px;
  }

  .filter-tabs .btn svg {
    width: 12px;
    height: 12px;
  }

  .filter-tabs .filter-tabs-group {
    margin-right: auto;
    gap: 3px;
  }

  .filter-tab {
    padding: 5px 8px;
    font-size: 10px;
    border-radius: 5px;
    height: 30px;
  }
  
  .filter-tabs-actions .btn {
    height: 30px;
  }

  /* Inventory page: Add Item button - fill available space in portrait */
  .filter-tabs-actions-single .btn {
    flex: 1;
    min-width: 0;
    width: 100%;
    height: 30px;
  }
}

/* Small phones landscape (short height) - must override 768px column rule */
@media (orientation: landscape) and (max-height: 430px) and (max-width: 900px) {
  .filter-tabs {
    flex-direction: row !important;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
    flex-wrap: nowrap;
  }

  .filter-tabs-row {
    width: 100%;
    flex-wrap: nowrap;
    gap: 8px;
  }

  .filter-tabs .filter-tabs-group {
    flex: 0 0 auto;
    width: auto;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    gap: 6px;
    min-width: 0;
  }

  .filter-tab {
    flex: 0 0 auto;
    height: 32px;
    padding: 6px 10px;
    font-size: 11px;
    border-radius: 6px;
    white-space: nowrap;
  }

  /* Inventory: single button should stay compact in landscape */
  .filter-tabs-actions-single {
    flex: 0 0 auto;
    width: auto;
  }

  .filter-tabs-actions-single .btn {
    flex: 0 0 auto;
    min-width: 140px;
    width: auto;
    height: 32px;
    padding: 6px 12px;
    font-size: 11px;
    border-radius: 6px;
  }

  /* Sales: action buttons compact too */
  .filter-tabs-actions {
    flex: 0 0 auto;
    width: auto;
  }

  .filter-tabs-actions .btn {
    height: 32px;
    padding: 6px 12px;
    font-size: 11px;
    border-radius: 6px;
  }
}

/* Very short landscape screens */
@media (orientation: landscape) and (max-height: 320px) {
  .filter-tabs {
    flex-direction: row !important;
    align-items: center;
    flex-wrap: nowrap;
    margin-bottom: 12px;
    gap: 8px;
  }

  .filter-tabs .filter-tabs-group {
    flex: 0 0 auto;
    overflow-x: auto;
    gap: 4px;
  }

  .filter-tabs-actions,
  .filter-tabs-actions-single {
    flex: 0 0 auto;
    width: auto;
  }

  .filter-tab,
  .filter-tabs-actions-single .btn,
  .filter-tabs-actions .btn {
    height: 30px;
    padding: 5px 10px;
    font-size: 10px;
    border-radius: 5px;
  }

  /* Keep button compact in very short landscape */
  .filter-tabs-actions-single .btn {
    flex: 0 0 auto;
    width: auto;
    min-width: 120px;
  }
}

/* Tablet landscape (1024x505) - compact filters */
@media (width: 1024px) and (height: 505px) and (orientation: landscape),
       (min-width: 1022px) and (max-width: 1026px) and (min-height: 503px) and (max-height: 507px) and (orientation: landscape) {
  .filter-tabs {
    margin-bottom: 12px !important;
    gap: 10px !important;
  }

  .filter-tabs .filter-tabs-group {
    gap: 4px !important;
  }

  .filter-tab {
    padding: 6px 12px !important;
    font-size: 11px !important;
    border-radius: 6px !important;
    height: 32px !important;
  }

  .filter-tabs-actions-single .btn {
    padding: 6px 12px !important;
    font-size: 11px !important;
    border-radius: 6px !important;
    height: 32px !important;
    min-width: 120px !important;
  }

  .filter-tabs-actions-single .btn svg {
    width: 14px !important;
    height: 14px !important;
  }
}
