/**
 * AndroidEmulator.org — Primitive UI Components & Design System Blocks
 * Architecture: Technical Instrument (Buttons, Badges, Metrics, Specs, Decision Strips)
 */

@layer primitives, components;

@layer primitives {
  /* ==========================================================================
     1. Buttons & Action Triggers
     ========================================================================== */
  .ae-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--ae-space-2);
    font-family: var(--ae-font-sans);
    font-size: var(--ae-text-sm);
    font-weight: 600;
    line-height: 1;
    padding: 10px 18px;
    border-radius: var(--ae-radius-md);
    border: 1px solid transparent;
    text-decoration: none;
    cursor: pointer;
    white-space: nowrap;
    transition: all var(--ae-transition-fast);
    user-select: none;
  }

  .ae-btn:focus-visible {
    outline: 2px solid var(--ae-blue);
    outline-offset: 2px;
  }

  /* Primary Button (Action & Download) */
  .ae-btn-primary {
    background: var(--ae-blue);
    color: #ffffff !important;
    border-color: var(--ae-blue);
    box-shadow: var(--ae-shadow-xs);
  }
  .ae-btn-primary:hover {
    background: var(--ae-blue-hover);
    border-color: var(--ae-blue-hover);
    transform: translateY(-1px);
    box-shadow: var(--ae-shadow-sm);
  }
  .ae-btn-primary:active {
    transform: translateY(0);
  }

  /* Secondary Button (Build Archives, Explorer) */
  .ae-btn-secondary {
    background: var(--ae-surface-2);
    color: var(--ae-text-1) !important;
    border-color: var(--ae-border-strong);
  }
  .ae-btn-secondary:hover {
    background: var(--ae-surface-3);
    border-color: var(--ae-text-3);
    color: var(--ae-text-1) !important;
  }

  /* Ghost Button */
  .ae-btn-ghost {
    background: transparent;
    color: var(--ae-text-2) !important;
    border-color: transparent;
  }
  .ae-btn-ghost:hover {
    background: var(--ae-surface-2);
    color: var(--ae-text-1) !important;
  }

  /* Danger Button */
  .ae-btn-danger {
    background: var(--ae-coral-soft);
    color: var(--ae-coral) !important;
    border-color: var(--ae-coral-border);
  }
  .ae-btn-danger:hover {
    background: var(--ae-coral);
    color: #ffffff !important;
  }

  /* Compact Sizing */
  .ae-btn-sm {
    padding: 6px 12px;
    font-size: var(--ae-text-xs);
    border-radius: var(--ae-radius-sm);
  }

  .ae-btn-lg {
    padding: 14px 24px;
    font-size: var(--ae-text-md);
    border-radius: var(--ae-radius-lg);
  }

  /* ==========================================================================
     2. Dual-Channel Semantic Badges & Status Indicators
     (Always combines Color + Icon/Symbol + Text - Never color alone)
     ========================================================================== */
  .ae-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-family: var(--ae-font-mono);
    font-size: var(--ae-text-xs);
    font-weight: 600;
    letter-spacing: 0.02em;
    padding: 4px 10px;
    border-radius: var(--ae-radius-pill);
    border: 1px solid var(--ae-border);
    background: var(--ae-surface-2);
    color: var(--ae-text-2);
    line-height: 1.2;
    white-space: nowrap;
  }

  .ae-badge-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    flex-shrink: 0;
  }

  /* Compatibility Badges */
  .ae-badge-optimal {
    background: var(--ae-green-soft);
    color: var(--ae-green);
    border-color: var(--ae-green-border);
  }

  .ae-badge-workable {
    background: var(--ae-amber-soft);
    color: var(--ae-amber);
    border-color: var(--ae-amber-border);
  }

  .ae-badge-limited {
    background: var(--ae-coral-soft);
    color: var(--ae-coral);
    border-color: var(--ae-coral-border);
  }

  /* Verification Badges */
  .ae-badge-verified {
    background: var(--ae-blue-soft);
    color: var(--ae-blue);
    border-color: var(--ae-blue-border);
  }

  .ae-badge-archived {
    background: var(--ae-surface-3);
    color: var(--ae-text-disabled);
    border-color: var(--ae-border);
  }

  /* ==========================================================================
     3. Metric Block & Benchmark Display
     ========================================================================== */
  .ae-metric-group {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: var(--ae-space-3);
  }

  .ae-metric-card {
    background: var(--ae-surface-1);
    border: 1px solid var(--ae-border);
    border-radius: var(--ae-radius-md);
    padding: var(--ae-space-3) var(--ae-space-4);
    display: flex;
    flex-direction: column;
    gap: 4px;
    transition: border-color var(--ae-transition-fast);
  }

  .ae-metric-card:hover {
    border-color: var(--ae-border-strong);
  }

  .ae-metric-label {
    font-family: var(--ae-font-sans);
    font-size: var(--ae-text-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--ae-text-3);
  }

  .ae-metric-value {
    font-family: var(--ae-font-mono);
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.1;
    color: var(--ae-text-1);
    display: flex;
    align-items: baseline;
    gap: 4px;
  }

  .ae-metric-sub {
    font-size: var(--ae-text-xs);
    font-weight: 500;
    color: var(--ae-text-3);
  }

  /* ==========================================================================
     4. "At-A-Glance" Engineering Specification Matrix
     ========================================================================== */
  .ae-at-a-glance {
    background: var(--ae-surface-1);
    border: 1px solid var(--ae-border);
    border-radius: var(--ae-radius-lg);
    overflow: hidden;
  }

  .ae-at-a-glance-header {
    padding: var(--ae-space-3) var(--ae-space-4);
    background: var(--ae-surface-2);
    border-bottom: 1px solid var(--ae-border);
    font-family: var(--ae-font-sans);
    font-size: var(--ae-text-xs);
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--ae-text-3);
  }

  .ae-spec-table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--ae-text-sm);
  }

  .ae-spec-row {
    border-bottom: 1px solid var(--ae-border-subtle);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px var(--ae-space-4);
    transition: background var(--ae-transition-fast);
  }

  .ae-spec-row:last-child {
    border-bottom: none;
  }

  .ae-spec-row:hover {
    background: var(--ae-surface-2);
  }

  .ae-spec-label {
    color: var(--ae-text-3);
    font-weight: 500;
  }

  .ae-spec-value {
    font-family: var(--ae-font-mono);
    font-weight: 600;
    color: var(--ae-text-1);
    text-align: right;
  }

  /* ==========================================================================
     5. Decision Strip (Dynamic Hardware Result Banner)
     ========================================================================== */
  .ae-decision-strip {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--ae-space-4);
    padding: var(--ae-space-4) var(--ae-space-6);
    background: var(--ae-surface-2);
    border: 1px solid var(--ae-border-strong);
    border-radius: var(--ae-radius-lg);
    margin: var(--ae-space-6) 0;
  }

  .ae-decision-left {
    display: flex;
    align-items: center;
    gap: var(--ae-space-4);
  }

  .ae-decision-icon {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-size: 1.1rem;
    flex-shrink: 0;
  }

  .ae-decision-optimal .ae-decision-icon {
    background: var(--ae-green-soft);
    color: var(--ae-green);
    border: 1px solid var(--ae-green-border);
  }

  .ae-decision-workable .ae-decision-icon {
    background: var(--ae-amber-soft);
    color: var(--ae-amber);
    border: 1px solid var(--ae-amber-border);
  }

  .ae-decision-limited .ae-decision-icon {
    background: var(--ae-coral-soft);
    color: var(--ae-coral);
    border: 1px solid var(--ae-coral-border);
  }

  .ae-decision-title {
    font-size: var(--ae-text-md);
    font-weight: 700;
    color: var(--ae-text-1);
    margin: 0;
  }

  .ae-decision-desc {
    font-size: var(--ae-text-xs);
    color: var(--ae-text-3);
    margin: 2px 0 0;
  }

  /* ==========================================================================
     6. Technical Tables (Release Manifest, Benchmarks)
     ========================================================================== */
  .ae-table-wrap {
    width: 100%;
    overflow-x: auto;
    border: 1px solid var(--ae-border);
    border-radius: var(--ae-radius-lg);
    background: var(--ae-surface-1);
  }

  .ae-table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--ae-text-sm);
    text-align: left;
  }

  .ae-table th {
    padding: 12px 16px;
    background: var(--ae-surface-2);
    font-family: var(--ae-font-sans);
    font-size: var(--ae-text-xs);
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--ae-text-3);
    border-bottom: 1px solid var(--ae-border);
    white-space: nowrap;
  }

  .ae-table td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--ae-border-subtle);
    color: var(--ae-text-2);
    vertical-align: middle;
  }

  .ae-table tr:last-child td {
    border-bottom: none;
  }

  .ae-table tr:hover td {
    background: var(--ae-surface-2);
  }

  .ae-mono {
    font-family: var(--ae-font-mono) !important;
  }

  .ae-hash-copy {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--ae-surface-3);
    padding: 4px 8px;
    border-radius: var(--ae-radius-sm);
    font-family: var(--ae-font-mono);
    font-size: var(--ae-text-xs);
    color: var(--ae-text-2);
    border: 1px solid var(--ae-border);
    cursor: pointer;
    transition: all var(--ae-transition-fast);
  }

  .ae-hash-copy:hover {
    border-color: var(--ae-blue);
    color: var(--ae-blue);
  }

  /* Responsive Adjustments */
  @media (max-width: 768px) {
    .ae-decision-strip {
      flex-direction: column;
      align-items: flex-start;
      padding: var(--ae-space-4);
    }
    .ae-decision-left {
      width: 100%;
    }
  }
}
