/* css/action-picker.css   (Phase C, 2026-05-23)
 *
 * Visual icon-gallery for per-tile Actions. Companion to
 * /js/builder/action-picker.js. Designed for 5-year-old usability —
 * each action tile is large (min 44px tap target × actually ~120×120),
 * has a chunky emoji icon, a short label, and a one-line description.
 *
 * Disabled states ("Coming soon" for phone/sms/email) are dimmed +
 * NOT clickable, but still tab-stop accessible so screen-reader users
 * hear the disabledReason via aria-label.
 *
 * Re-uses .modal-overlay / .modal classes from builder.css so the
 * BottomSheet primitive's `innerSelector: '.modal'` (we override to
 * '.action-picker-card' on attach) sizes correctly for keyboard-aware
 * mobile UX.
 *
 * LABEL: PILOT-READY — needs iOS Safari + Android Chrome hardware
 * verification on the icon-grid tap targets before PRODUCTION-READY.
 */

/* ── Overlay ────────────────────────────────────────────────────── */
.action-picker-overlay {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  padding: 16px;
}
.action-picker-overlay.open {
  display: flex;
}

/* ── Card ───────────────────────────────────────────────────────── */
.action-picker-card {
  background: var(--card-bg, #fff);
  color: var(--text, #111);
  border-radius: 16px;
  width: 100%;
  max-width: 720px;
  max-height: 90vh;
  overflow: auto;
  padding: 20px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
  /* Reset position so BottomSheet's translate transforms don't
     stack with any inherited transform. */
  transform: none;
}

.action-picker-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 4px;
}
.action-picker-title {
  font-size: 20px;
  margin: 0;
  font-weight: 700;
}
.action-picker-close {
  /* WCAG 2.5.5 tap target floor. */
  min-width: var(--tap-target-min, 44px);
  min-height: var(--tap-target-min, 44px);
  background: transparent;
  border: 0;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  color: inherit;
  border-radius: 8px;
}
.action-picker-close:focus-visible {
  outline: 3px solid #2563eb;
  outline-offset: 2px;
}
.action-picker-help {
  margin: 0 0 16px;
  color: var(--muted, #555);
  font-size: 14px;
}

/* ── Icon grid ──────────────────────────────────────────────────── */
.action-picker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
}

.action-picker-tile {
  /* Big chunky button — 5-year-old usable. */
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 4px;
  padding: 16px 12px;
  min-height: 140px;
  background: #f5f7fa;
  border: 2px solid transparent;
  border-radius: 14px;
  cursor: pointer;
  text-align: center;
  font: inherit;
  color: inherit;
  transition: transform 0.08s ease, background 0.15s ease, border-color 0.15s ease;
}
.action-picker-tile:hover:not(.is-disabled) {
  background: #eaf1ff;
  border-color: #c7dafd;
}
.action-picker-tile:active:not(.is-disabled) {
  transform: scale(0.97);
}
.action-picker-tile:focus-visible {
  /* Strong visible focus ring — keyboard + switch-scan users
     need this to track the cursor across the grid. */
  outline: 3px solid #2563eb;
  outline-offset: 2px;
  border-color: #2563eb;
}

.action-picker-icon {
  font-size: 36px;
  line-height: 1;
  margin-bottom: 4px;
}
.action-picker-label {
  font-size: 16px;
  font-weight: 700;
}
.action-picker-desc {
  font-size: 12px;
  color: var(--muted, #555);
  line-height: 1.25;
}

/* ── Disabled "coming soon" state ───────────────────────────────── */
.action-picker-tile.is-disabled {
  background: #f0f1f3;
  color: #777;
  cursor: not-allowed;
  /* Slight dim to telegraph "off" without making text unreadable
     (WCAG contrast still passes against the lighter bg). */
  opacity: 0.65;
}
.action-picker-tile.is-disabled .action-picker-desc {
  color: #777;
  font-style: italic;
}

/* ── Sub-picker (board / url / routine / sound chooser) ─────────── */
.action-picker-subpanel {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.6);
  z-index: 1100;
  padding: 16px;
  opacity: 0;
  transition: opacity 0.15s ease;
}
.action-picker-subpanel.open {
  opacity: 1;
}
.action-picker-subcard {
  background: var(--card-bg, #fff);
  color: var(--text, #111);
  border-radius: 16px;
  width: 100%;
  max-width: 560px;
  max-height: 85vh;
  overflow: auto;
  padding: 20px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
}
.action-picker-subtitle {
  font-size: 18px;
  font-weight: 700;
  margin: 0 0 12px;
}

.action-picker-subgrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}
.action-picker-subtile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 14px 8px;
  min-height: 100px;
  background: #f5f7fa;
  border: 2px solid transparent;
  border-radius: 12px;
  cursor: pointer;
  text-align: center;
  font: inherit;
  color: inherit;
}
.action-picker-subtile:hover:not(.is-disabled) {
  background: #eaf1ff;
  border-color: #c7dafd;
}
.action-picker-subtile:focus-visible {
  outline: 3px solid #2563eb;
  outline-offset: 2px;
}
.action-picker-subtile.is-disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
.action-picker-subicon {
  font-size: 28px;
  line-height: 1;
}
.action-picker-sublabel {
  font-size: 13px;
  font-weight: 600;
  word-break: break-word;
}

/* ── Empty state ────────────────────────────────────────────────── */
.action-picker-empty {
  text-align: center;
  padding: 24px 12px;
  background: var(--card-bg, #fff);
  border-radius: 16px;
  max-width: 420px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
}
.action-picker-empty-title {
  font-size: 18px;
  font-weight: 700;
  margin: 0 0 8px;
}
.action-picker-empty-msg {
  margin: 0 0 16px;
  color: var(--muted, #555);
  font-size: 14px;
}

/* ── Buttons ────────────────────────────────────────────────────── */
.action-picker-btn {
  min-height: var(--tap-target-min, 44px);
  padding: 10px 18px;
  border-radius: 10px;
  border: 0;
  cursor: pointer;
  font: inherit;
  font-weight: 600;
  font-size: 15px;
}
.action-picker-btn-primary {
  background: #2563eb;
  color: #fff;
}
.action-picker-btn-cancel {
  background: #e5e7eb;
  color: #111;
}
.action-picker-btn:focus-visible {
  outline: 3px solid #2563eb;
  outline-offset: 2px;
}

/* ── Mobile tweaks ──────────────────────────────────────────────── */
@media (max-width: 600px) {
  .action-picker-card {
    max-height: 95vh;
    border-radius: 12px;
    padding: 16px;
  }
  .action-picker-grid {
    /* Two-column on phones — bigger touch targets per tile, even
       if it means scrolling. NN/g: scrolling is preferable to
       fat-finger misclicks on critical config UI. */
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }
  .action-picker-tile {
    min-height: 120px;
    padding: 12px 8px;
  }
  .action-picker-icon {
    font-size: 32px;
  }
}
