/**
 * Admin UI components — Kutby Design System primitives.
 * Foundation 2.5 — token-driven values only.
 */

.kutby-ui-tabs {
  display: flex;
  gap: var(--kutby-space-2);
  margin-bottom: var(--kutby-space-4);
  border-bottom: var(--kutby-border-width) solid var(--kutby-color-border);
}

.kutby-ui-tabs__item {
  padding: var(--kutby-space-3) var(--kutby-space-4);
  border: 0;
  background: transparent;
  color: var(--kutby-color-muted);
  font-weight: 600;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: color var(--kutby-transition), border-color var(--kutby-transition);
}

.kutby-ui-tabs__item.is-active {
  color: var(--kutby-color-primary);
  border-bottom-color: var(--kutby-color-primary);
}

.kutby-ui-modal {
  position: fixed;
  inset: 0;
  z-index: var(--kutby-z-modal);
  display: none;
  place-items: center;
  background: var(--kutby-overlay);
}

.kutby-ui-modal.is-open,
.kutby-ui-modal:not([hidden]).is-open {
  display: grid;
}

.kutby-ui-modal__dialog {
  width: min(100% - var(--kutby-space-6), 520px);
  background: var(--kutby-color-card);
  border-radius: var(--kutby-radius-lg);
  padding: var(--kutby-space-5);
  box-shadow: var(--kutby-shadow-lg);
}

.kutby-ui-tooltip {
  position: relative;
}

.kutby-ui-tooltip[data-tip]:hover::after {
  content: attr(data-tip);
  position: absolute;
  inset-inline-start: 50%;
  bottom: calc(100% + var(--kutby-space-2));
  transform: translateX(-50%);
  padding: var(--kutby-space-1) var(--kutby-space-2);
  border-radius: var(--kutby-radius-sm);
  background: var(--kutby-color-text);
  color: var(--kutby-color-on-inverse);
  font-size: var(--kutby-font-size-sm);
  white-space: nowrap;
  z-index: var(--kutby-z-dropdown);
}

.kutby-ui-dropdown {
  position: relative;
}

.kutby-ui-dropdown__menu {
  display: none;
  position: absolute;
  top: 100%;
  inset-inline-start: 0;
  min-width: 180px;
  margin-top: var(--kutby-space-1);
  padding: var(--kutby-space-2);
  background: var(--kutby-color-card);
  border: var(--kutby-border-width) solid var(--kutby-color-border);
  border-radius: var(--kutby-radius-md);
  box-shadow: var(--kutby-shadow-md);
  z-index: var(--kutby-z-dropdown);
}

.kutby-ui-dropdown__menu a {
  display: block;
  padding: var(--kutby-space-2) var(--kutby-space-3);
  color: var(--kutby-color-text);
  text-decoration: none;
}

.kutby-ui-dropdown.is-open .kutby-ui-dropdown__menu,
.kutby-ui-dropdown.is-open .kutby-ui-dropdown__menu[hidden] {
  display: block;
}

.kutby-ui-accordion {
  border: var(--kutby-border-width) solid var(--kutby-color-border);
  border-radius: var(--kutby-radius-md);
  padding: var(--kutby-space-3) var(--kutby-space-4);
  background: var(--kutby-color-card);
  margin-bottom: var(--kutby-space-3);
}

.kutby-ui-accordion summary {
  cursor: pointer;
  font-weight: 600;
}

.kutby-icon {
  display: inline-block;
  vertical-align: middle;
  flex-shrink: 0;
}

.kutby-icon--sm {
  width: 1rem;
  height: 1rem;
}

.kutby-icon--md {
  width: 1.25rem;
  height: 1.25rem;
}

.kutby-icon--lg {
  width: 1.5rem;
  height: 1.5rem;
}

.kutby-admin__nav-icon {
  display: inline-flex;
  width: 1.25rem;
  height: 1.25rem;
  align-items: center;
  justify-content: center;
  color: currentColor;
}

.kutby-admin__nav-icon .kutby-icon {
  width: 100%;
  height: 100%;
}

.kutby-notice {
  position: relative;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--kutby-space-3);
  padding: var(--kutby-space-3) var(--kutby-space-4);
  border-radius: var(--kutby-radius-md);
  margin-bottom: var(--kutby-space-4);
  border: var(--kutby-border-width) solid transparent;
}

.kutby-notice--success {
  background: var(--kutby-notice-success-bg);
  color: var(--kutby-notice-success-fg);
  border-color: var(--kutby-notice-success-bd);
}

.kutby-notice--error {
  background: var(--kutby-notice-error-bg);
  color: var(--kutby-notice-error-fg);
  border-color: var(--kutby-notice-error-bd);
}

.kutby-notice--warning {
  background: var(--kutby-notice-warning-bg);
  color: var(--kutby-notice-warning-fg);
  border-color: var(--kutby-notice-warning-bd);
}

.kutby-notice--info {
  background: var(--kutby-notice-info-bg);
  color: var(--kutby-notice-info-fg);
  border-color: var(--kutby-notice-info-bd);
}

.kutby-notice__dismiss {
  border: 0;
  background: transparent;
  font-size: var(--kutby-font-size-lg);
  line-height: 1;
  cursor: pointer;
  color: inherit;
  opacity: var(--kutby-opacity-muted);
}

.kutby-notice.is-autohide {
  animation: kutby-notice-fade 4s ease forwards;
}

@keyframes kutby-notice-fade {
  0%,
  70% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    max-height: 0;
    margin: 0;
    padding-top: 0;
    padding-bottom: 0;
    overflow: hidden;
  }
}

.kutby-skeleton {
  display: grid;
  gap: var(--kutby-space-3);
}

.kutby-skeleton__line {
  height: 0.85rem;
  border-radius: var(--kutby-radius-sm);
  background: linear-gradient(
    90deg,
    var(--kutby-color-border) 25%,
    var(--kutby-color-surface) 50%,
    var(--kutby-color-border) 75%
  );
  background-size: 200% 100%;
  animation: kutby-skeleton 1.2s ease infinite;
}

@keyframes kutby-skeleton {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

.kutby-loader {
  width: 1.1rem;
  height: 1.1rem;
  border-radius: var(--kutby-radius-full);
  border: 2px solid var(--kutby-color-border);
  border-top-color: var(--kutby-color-primary);
  display: inline-block;
  vertical-align: middle;
  animation: kutby-spin 0.7s linear infinite;
}

@keyframes kutby-spin {
  to {
    transform: rotate(360deg);
  }
}

.kutby-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem var(--kutby-space-2);
  border-radius: var(--kutby-radius-full);
  background: var(--kutby-color-surface);
  color: var(--kutby-color-muted);
  font-size: var(--kutby-font-size-sm);
  border: var(--kutby-border-width) solid var(--kutby-color-border);
}

.kutby-btn--ghost {
  background: transparent;
  border: 0;
  color: var(--kutby-color-danger);
  cursor: pointer;
  padding: var(--kutby-space-1) var(--kutby-space-2);
}

.kutby-btn--secondary {
  background: var(--kutby-color-surface);
  color: var(--kutby-color-text);
  border: var(--kutby-border-width) solid var(--kutby-color-border);
}

.kutby-btn:disabled,
.kutby-btn.is-loading {
  opacity: var(--kutby-opacity-disabled);
  cursor: not-allowed;
}

.kutby-btn.is-loading {
  display: inline-flex;
  align-items: center;
  gap: var(--kutby-space-2);
}

/* Developer showcase layout */
.kutby-showcase__section {
  margin-bottom: var(--kutby-space-6);
  padding-bottom: var(--kutby-space-5);
  border-bottom: var(--kutby-border-width) solid var(--kutby-color-border);
}

.kutby-showcase__section h3 {
  margin: 0 0 var(--kutby-space-3);
  color: var(--kutby-color-text);
}

.kutby-showcase__row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--kutby-space-3);
}

.kutby-showcase__icons {
  gap: var(--kutby-space-4);
}

.kutby-showcase__icon {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: var(--kutby-space-1);
  color: var(--kutby-color-text);
  min-width: 4.5rem;
}

.kutby-showcase__icon small {
  color: var(--kutby-color-muted);
  font-size: var(--kutby-font-size-sm);
}
