/* ============================================
   TABS - Thanh điều hướng tabs
   Chức năng: Style cho tabs navigation và tab content
   ============================================ */

/* Tabs Container */
.tabs {
  display: flex;
  gap: 8px;
  margin: 4px 0 20px;
  padding: 10px 10px 6px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin; /* Hiện scrollbar mảnh */
  background: #f5f7ff;
  border-radius: 999px;
  border: none;            /* Bỏ viền to bao quanh các nút */
  box-shadow: 0 4px 12px rgba(15, 76, 129, 0.06);
}

/* Tabs trong preview: luôn full width trên khung QR, chỉ hiện trên màn hình rộng */
.tabs-preview-container {
  display: none;
}

@media (min-width: 1024px) {
  .tabs-preview-container {
    display: block;
    width: 100%;
    max-width: 100%;
    margin-bottom: 16px;
    box-sizing: border-box;
  }
  
  /* Ẩn tabs trong sidebar trên màn hình rộng để tránh trùng lặp */
  #tabs-container .tabs {
    display: none;
  }

  /* Tabs hiển thị trên khu vực xem trước: bày hết, không thanh cuộn, bố trí đẹp */
  .tabs-preview-container .tabs {
    overflow-x: visible;
    scrollbar-width: none;
    justify-content: center;
    flex-wrap: wrap;          /* Cho phép tự xuống dòng */
    row-gap: 10px;
    column-gap: 12px;
    padding: 12px 18px 10px;
    max-width: 100%;
    width: 100%;
    box-sizing: border-box;
    border: 1px solid #dc2626;    /* Khung bo viền đỏ như card */
    border-radius: 999px;
    background: #fdf2f2;
  }

  .tabs-preview-container .tab {
    white-space: normal;      /* Cho phép text xuống dòng nếu cần */
    min-width: 110px;
    justify-content: center;
  }

  .tabs-preview-container .tabs::-webkit-scrollbar {
    display: none;
  }
}

.tabs::-webkit-scrollbar {
  height: 4px;
}

.tabs::-webkit-scrollbar-thumb {
  background: #9ca3af; /* Thanh cuộn xám giống ảnh */
  border-radius: 999px;
}

/* Tab Button */
.tab {
  padding: 11px 22px;
  background: none;
  border: 1px solid transparent;   /* Cho phép active có viền riêng */
  border-bottom: 3px solid transparent;
  cursor: pointer;
  font-weight: 600;
  color: var(--muted);
  transition: all var(--transition-base);
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: var(--spacing-xs);
  font-size: 14px;
  border-radius: 999px;
}

.tab:hover {
  color: var(--accent);
  background: rgba(11, 110, 215, 0.05);
}

.tab.active {
  color: var(--accent);
  border-color: #dc2626;          /* Viền đỏ quanh nút được chọn */
  border-bottom-color: #dc2626;
  background: #ffffff;
  box-shadow: 0 4px 10px rgba(15, 76, 129, 0.18);
  transform: translateY(-1px);
}

/* Tab Content */
.tab-content {
  display: none;
}

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

/* Responsive */
@media (max-width: 768px) {
  .tabs {
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    padding-bottom: 8px;
    margin-bottom: 16px;
    /* Ẩn scrollbar nhưng vẫn scroll được */
    scrollbar-width: none;
    -ms-overflow-style: none;
  }
  
  .tabs::-webkit-scrollbar {
    display: none;
  }
  
  .tab {
    padding: 12px 18px;
    font-size: 13px;
    min-width: auto;
    white-space: nowrap;
    flex-shrink: 0;
  }
  
  /* Trên màn hình rất nhỏ, chỉ hiện icon */
  @media (max-width: 480px) {
    .tab span {
      display: none;
    }
    
    .tab {
      padding: 10px 12px;
      min-width: 44px; /* Touch-friendly */
    }
  }
}

