/* =============================================================================
   LOCAL TASKS — View / Edit / Delete / Revisions tabs
   ============================================================================= */

/* ---------------------------------------------------------------------------
   WRAPPER
--------------------------------------------------------------------------- */

.local-tasks {
  margin-bottom: var(--space-6);
}

.local-tasks--secondary {
  margin-top: calc(var(--space-3) * -1);
  margin-bottom: var(--space-5);
}

/* ---------------------------------------------------------------------------
   TAB LIST
--------------------------------------------------------------------------- */

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
  list-style: none;
  margin: 0;
  padding: 0;
  border-bottom: 2px solid var(--color-border);
  padding-bottom: var(--space-1);
}

.tabs--secondary {
  border-bottom: 1px solid var(--color-border);
}

/* ---------------------------------------------------------------------------
   TAB ITEM
--------------------------------------------------------------------------- */

.tabs__item {
  margin: 0;
  padding: 0;
}

/* ---------------------------------------------------------------------------
   TAB LINK
   Drupal renders the link directly — target both <a> and any class
--------------------------------------------------------------------------- */

.tabs__item a,
.tabs__item .is-active {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--color-text-muted);
  text-decoration: none;
  position: relative;
  transition: color var(--transition-fast), background var(--transition-fast);
  white-space: nowrap;
  border: 1px solid transparent;
  border-bottom: none;
  margin-bottom: -2px;   /* overlap the border-bottom of .tabs */
}

/* Hover */
.tabs__item a:hover {
  color: var(--color-brand-text);
  background: var(--color-brand-subtle);
}

/* Active tab */
.tabs__item--active a,
.tabs__item a.is-active,
.tabs__item.is-active a {
  color: var(--color-brand-text);
  background: var(--color-surface);
  border-color: var(--color-border);
  border-bottom-color: var(--color-surface);
  font-weight: var(--font-semibold);
}

/* Active indicator bar at top */
.tabs__item--active a::before,
.tabs__item a.is-active::before,
.tabs__item.is-active a::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--gradient-brand);
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}

/* ---------------------------------------------------------------------------
   SECONDARY TABS — smaller, pill style
--------------------------------------------------------------------------- */

.tabs--secondary .tabs__item a {
  padding: var(--space-1) var(--space-3);
  font-size: var(--text-xs);
  border-radius: var(--radius-full);
  border: 1px solid var(--color-border);
  margin-bottom: calc(var(--space-1) * -1);
}

.tabs--secondary .tabs__item a:hover {
  border-color: var(--color-border-brand);
  background: var(--color-brand-subtle);
  color: var(--color-brand-text);
}

.tabs--secondary .tabs__item--active a,
.tabs--secondary .tabs__item a.is-active,
.tabs--secondary .tabs__item.is-active a {
  background: var(--gradient-brand);
  color: #ffffff;
  border-color: transparent;
}

.tabs--secondary .tabs__item--active a::before,
.tabs--secondary .tabs__item a.is-active::before,
.tabs--secondary .tabs__item.is-active a::before {
  display: none;
}

/* ---------------------------------------------------------------------------
   DARK MODE
--------------------------------------------------------------------------- */

@media (prefers-color-scheme: dark) {
  .tabs__item--active a,
  .tabs__item a.is-active,
  .tabs__item.is-active a {
    background: var(--color-surface);
    border-color: var(--color-border);
    border-bottom-color: var(--color-surface);
    color: var(--color-brand-text);
  }
}

/* ---------------------------------------------------------------------------
   RESPONSIVE — stack on very small screens
--------------------------------------------------------------------------- */

@media (max-width: 480px) {
  .tabs {
    border-bottom: none;
    flex-direction: column;
    gap: var(--space-1);
    background: var(--color-bg-secondary);
    border-radius: var(--radius-lg);
    padding: var(--space-2);
  }

  .tabs__item a {
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    margin-bottom: 0;
    width: 100%;
    justify-content: flex-start;
  }

  .tabs__item--active a,
  .tabs__item a.is-active,
  .tabs__item.is-active a {
    border-color: var(--color-border-brand);
    border-bottom-color: var(--color-border-brand);
    background: var(--color-brand-subtle);
  }

  .tabs__item--active a::before,
  .tabs__item a.is-active::before {
    display: none;
  }
}
