/**
 * AppBuilder Base Utility Classes — framework-base.css
 *
 * Pattern-level utility classes used by all framework and app components.
 * Use these directly in component HTML instead of reimplementing the pattern.
 * All values reference --ab-* tokens so they respond to theme overrides.
 *
 * Load order: Bootstrap → framework-tokens.css → this file → framework-layout.css
 */

/* ─────────────────────────────────────────────────────────────────────────────
   Ghost Icon Button  (.ab-icon-btn)
   Square button with icon — all 6 interaction states included.
   Usage: <button class="ab-icon-btn" aria-label="Close"><i class="bi bi-x-lg"></i></button>
   ───────────────────────────────────────────────────────────────────────────── */
.ab-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--ab-ctrl);
  height: var(--ab-ctrl);
  padding: 0;
  background: transparent;
  border: none;
  border-radius: var(--ab-radius-sm);
  color: var(--bs-secondary-color);
  cursor: pointer;
  flex-shrink: 0;
  transition: background var(--ab-t-fast), color var(--ab-t-fast);
  -webkit-app-region: no-drag; /* Electron: prevent drag from consuming clicks */
}
@media (hover: hover) {
  .ab-icon-btn:hover {
    background: var(--ab-hover-bg);
    color: var(--bs-body-color);
  }
}
.ab-icon-btn:focus-visible {
  outline: none;
  box-shadow: var(--ab-focus-ring);
}
.ab-icon-btn:active {
  background: var(--ab-hover-bg);
  opacity: 0.75;
}
.ab-icon-btn.active {
  background: var(--ab-active-bg);
  color: var(--ab-active-color);
}
.ab-icon-btn[disabled],
.ab-icon-btn[aria-disabled="true"] {
  opacity: 0.4;
  pointer-events: none;
  cursor: not-allowed;
}

/* Small variant */
.ab-icon-btn.ab-icon-btn-sm {
  width: var(--ab-ctrl-sm);
  height: var(--ab-ctrl-sm);
  border-radius: var(--ab-radius-xs);
}

/* ─────────────────────────────────────────────────────────────────────────────
   Nav / Sidebar List Item  (.ab-nav-item)
   Standard interactive row for sidebars, nav panels, config menus.
   Usage: <div class="ab-nav-item active" role="option" aria-selected="true">Label</div>
   ───────────────────────────────────────────────────────────────────────────── */
.ab-nav-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.45rem 0.75rem;
  border-radius: var(--ab-radius-sm);
  font-size: var(--ab-text-sm);
  font-weight: var(--ab-weight-medium);
  color: var(--bs-body-color);
  cursor: pointer;
  user-select: none;
  transition: background var(--ab-t-base), color var(--ab-t-base);
}
@media (hover: hover) {
  .ab-nav-item:hover {
    background: var(--ab-hover-bg);
  }
}
.ab-nav-item:focus-visible {
  outline: none;
  box-shadow: var(--ab-focus-ring);
}
.ab-nav-item:active {
  background: var(--ab-hover-bg);
}
.ab-nav-item.active,
.ab-nav-item[aria-selected="true"],
.ab-nav-item[aria-current="true"] {
  background: var(--ab-active-bg);
  color: var(--ab-active-color);
}
.ab-nav-item[aria-disabled="true"] {
  opacity: 0.4;
  pointer-events: none;
}

/* ─────────────────────────────────────────────────────────────────────────────
   Section Label  (.ab-section-label)
   Uppercase group header above a list or set of controls.
   Usage: <span class="ab-section-label">Conversations</span>
   ───────────────────────────────────────────────────────────────────────────── */
.ab-section-label {
  display: block;
  font-size: var(--ab-label-size);
  font-weight: var(--ab-label-weight);
  letter-spacing: var(--ab-label-spacing);
  text-transform: uppercase;
  color: var(--ab-label-color);
  line-height: 1.4;
}

/* ─────────────────────────────────────────────────────────────────────────────
   Empty State  (.ab-empty)
   Centred empty-state container with icon, title, and body text slots.
   Usage:
     <div class="ab-empty">
       <i class="bi bi-inbox ab-empty-icon"></i>
       <div class="ab-empty-title">No items yet</div>
       <div class="ab-empty-body">Create one to get started.</div>
     </div>
   ───────────────────────────────────────────────────────────────────────────── */
.ab-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 1.5rem;
  text-align: center;
  min-height: 200px;
  color: var(--bs-secondary-color);
}

.ab-empty-icon {
  font-size: 2.5rem;
  opacity: 0.35;
  margin-bottom: 1rem;
  line-height: 1;
}

.ab-empty-title {
  font-size: var(--ab-text-md);
  font-weight: var(--ab-weight-semibold);
  color: var(--bs-emphasis-color);
  margin-bottom: 0.375rem;
}

.ab-empty-body {
  font-size: var(--ab-text-sm);
  max-width: 280px;
  line-height: 1.5;
}

/* ─────────────────────────────────────────────────────────────────────────────
   Loading State  (.ab-loading)
   Centred spinner wrapper.
   Usage:
     <div class="ab-loading">
       <div class="spinner-border spinner-border-sm text-primary" role="status">
         <span class="visually-hidden">Loading…</span>
       </div>
     </div>
   ───────────────────────────────────────────────────────────────────────────── */
.ab-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  color: var(--bs-secondary-color);
  gap: 0.5rem;
  font-size: var(--ab-text-sm);
}

/* Inline loading (next to text) */
.ab-loading-inline {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: var(--ab-text-sm);
  color: var(--bs-secondary-color);
}

/* ─────────────────────────────────────────────────────────────────────────────
   Reduced motion — disable transitions for all ab-* classes
   ───────────────────────────────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .ab-icon-btn,
  .ab-nav-item {
    transition: none;
  }
}
