/**
 * tabs.css
 * БЭМ-блок: tabs
 * Компонент табов для переключения форм/страниц
 * Поддержка: ссылки-табы и кнопки-табы
 */

/* ===========================
   Block: tabs
   =========================== */

.tabs {
  width: 100%;
}

/* ===========================
   Element: list (for button-based tabs)
   =========================== */

.tabs__list {
  display: flex;
  margin: 0;
  padding: 0;
  list-style: none;
  border-bottom: 1px solid var(--color-border);
}

/* ===========================
   Element: item (direct link tabs)
   =========================== */

.tabs__item {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--spacing-md) var(--spacing-lg);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-medium);
  color: var(--color-text-muted);
  text-decoration: none;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: color var(--transition-fast),
              border-color var(--transition-fast),
              background-color var(--transition-fast);
}

.tabs__item:hover {
  color: var(--color-text);
  background-color: var(--color-bg-alt);
}

.tabs__item:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: -2px;
}

/* Active tab */
.tabs__item--active {
  color: var(--color-accent);
  border-bottom-color: var(--color-accent);
}

.tabs__item--active:hover {
  background-color: transparent;
}

/* ===========================
   Element: button (for list-based tabs)
   =========================== */

.tabs__button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: var(--spacing-md) var(--spacing-lg);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-medium);
  color: var(--color-text-muted);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: color var(--transition-fast),
              border-color var(--transition-fast),
              background-color var(--transition-fast);
  margin-bottom: -1px;
}

.tabs__button:hover {
  color: var(--color-text);
  background-color: var(--color-bg-alt);
}

.tabs__button:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: -2px;
}

/* Active tab button */
.tabs__item_active .tabs__button {
  color: var(--color-accent);
  border-bottom-color: var(--color-accent);
}

.tabs__item_active .tabs__button:hover {
  background-color: transparent;
}

/* ===========================
   Element: icon
   =========================== */

.tabs__icon {
  width: 18px;
  height: 18px;
  margin-right: var(--spacing-sm);
  fill: currentColor;
}

/* ===========================
   Element: content (tab panels container)
   =========================== */

.tabs__content {
  position: relative;
}

/* ===========================
   Element: panel
   =========================== */

.tabs__panel {
  display: none;
  padding-top: var(--spacing-lg);
}

.tabs__panel_active {
  display: block;
  animation: tabs-panel-appear 0.25s ease-out;
}

@keyframes tabs-panel-appear {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* ===========================
   Modifier: centered
   =========================== */

.tabs_centered .tabs__list {
  justify-content: center;
}

.tabs_centered .tabs__item {
  flex: 0 0 auto;
}

/* ===========================
   Modifier: pills style
   =========================== */

.tabs_pills .tabs__list {
  gap: var(--spacing-sm);
  border-bottom: none;
  padding: var(--spacing-xs);
  background-color: var(--color-bg-alt);
  border-radius: var(--radius-md);
}

.tabs_pills .tabs__button {
  border-radius: var(--radius-sm);
  border-bottom: none;
  margin-bottom: 0;
}

.tabs_pills .tabs__item_active .tabs__button {
  background-color: var(--color-bg);
  color: var(--color-accent);
  box-shadow: var(--shadow-sm);
}

/* ===========================
   Modifier: full width items
   =========================== */

.tabs_full .tabs__item {
  flex: 1 1 0;
}

/* ===========================
   Modifier: compact
   =========================== */

.tabs_compact .tabs__button,
.tabs_compact .tabs__item {
  padding: var(--spacing-sm) var(--spacing-md);
  font-size: var(--font-size-sm);
}

/* ===========================
   Media Queries
   =========================== */

/* Small devices (480px and up) */
@media (min-width: 480px) {
  .tabs__button,
  .tabs__item {
    padding: var(--spacing-md) var(--spacing-xl);
  }

  .tabs__icon {
    width: 20px;
    height: 20px;
  }
}

/* Medium devices (768px and up) */
@media (min-width: 768px) {
  .tabs__button,
  .tabs__item {
    font-size: var(--font-size-lg);
    padding: var(--spacing-lg) var(--spacing-xl);
  }

  .tabs__panel {
    padding-top: var(--spacing-xl);
  }
}

/* Large devices (1024px and up) */
@media (min-width: 1024px) {
  .tabs__button,
  .tabs__item {
    padding: var(--spacing-lg) var(--spacing-2xl);
  }
}

/* Extra large devices (1280px and up) */
@media (min-width: 1280px) {
  .tabs__icon {
    width: 22px;
    height: 22px;
  }
}
