/* ═══════════════════════════════════════════════════════════════
   actor-overlay.css — Styles pour l'Actor Overlay (Preview mode)
   ═══════════════════════════════════════════════════════════════ */

/* ─── Root container ─── */
.ao-root {
  --ao-bg: #f8fafc;
  --ao-border: #e2e8f0;
  --ao-brand: #224494;
  --ao-brand-soft: #eff3ff;
  --ao-brand-ink: #1a3270;
  --ao-muted: #64748b;
  --ao-success: #16a34a;
  --ao-error: #dc2626;
  --ao-tab-bg: #ffffff;
  --ao-control-bg: #ffffff;
  --ao-radius: 10px;

  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0;
  background: var(--ao-bg);
  border: 1px solid var(--ao-border);
  border-radius: var(--ao-radius);
  overflow: hidden;
  font-family: "Inter", -apple-system, sans-serif;
  font-size: 12px;
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.08);
  transition: opacity 0.3s ease, transform 0.3s ease;
  margin-bottom: 8px;
}

.ao-root.ao-hidden {
  opacity: 0;
  pointer-events: none;
  transform: translateY(-4px);
}

.ao-root.ao-active {
  border-color: var(--ao-brand);
  box-shadow: 0 4px 20px rgba(34, 68, 148, 0.12);
}

.ao-root.ao-done {
  border-color: var(--ao-success);
}

.ao-root.ao-error {
  border-color: var(--ao-error);
}

/* ─── Ligne 1 : Mini Ribbon Tabs ─── */
.ao-tabs {
  display: flex;
  gap: 0;
  background: var(--ao-tab-bg);
  border-bottom: 1px solid var(--ao-border);
  padding: 0 4px;
  overflow-x: auto;
  scrollbar-width: none;
}

.ao-tabs::-webkit-scrollbar {
  display: none;
}

.ao-tab {
  flex: 0 0 auto;
  padding: 5px 8px;
  font-size: 10px;
  font-weight: 500;
  color: var(--ao-muted);
  cursor: default;
  user-select: none;
  white-space: nowrap;
  border-bottom: 2px solid transparent;
  transition: color 0.2s ease, border-color 0.2s ease, background-color 0.2s ease;
}

.ao-tab.ao-tab-active {
  color: var(--ao-brand-ink);
  font-weight: 600;
  border-bottom-color: var(--ao-brand);
  background: var(--ao-brand-soft);
}

/* ─── Ligne 2 : Control Zone ─── */
.ao-control {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--ao-control-bg);
  min-height: 36px;
  transition: background-color 0.2s ease, transform 0.15s ease;
}

.ao-control-icon {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: var(--ao-brand-soft);
  color: var(--ao-brand);
  transition: background-color 0.2s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

.ao-control-icon svg {
  display: block;
}

.ao-control-label {
  flex: 1 1 auto;
  font-size: 12px;
  font-weight: 500;
  color: var(--ao-brand-ink);
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ─── Ligne 3 : Target + Status ─── */
.ao-target {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 5px 12px 6px;
  border-top: 1px solid var(--ao-border);
  background: var(--ao-bg);
}

.ao-target-addr {
  font-size: 11px;
  font-weight: 500;
  color: var(--ao-muted);
  font-family: "SF Mono", "Cascadia Code", "Consolas", monospace;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 60%;
}

.ao-target-status {
  font-size: 10px;
  font-weight: 600;
  white-space: nowrap;
}

.ao-status-applying {
  color: var(--ao-brand);
  animation: ao-pulse-text 1.2s ease-in-out infinite;
}

.ao-status-ok {
  color: var(--ao-success);
}

.ao-status-error {
  color: var(--ao-error);
}

@keyframes ao-pulse-text {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* ─── Ghost Cursor ─── */
.ao-cursor {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 10;
  pointer-events: none;
  color: var(--ao-brand);
  opacity: 0;
  filter: drop-shadow(0 1px 3px rgba(34, 68, 148, 0.3));
  will-change: transform, opacity;
}

.ao-cursor-tap {
  transform: scale(0.85);
  transition: transform 80ms ease-out !important;
}

.ao-cursor-tap::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: rgba(34, 68, 148, 0.2);
  transform: translate(-50%, -50%) scale(0);
  animation: ao-ripple 0.35s ease-out forwards;
}

@keyframes ao-ripple {
  0% { transform: translate(-50%, -50%) scale(0); opacity: 1; }
  100% { transform: translate(-50%, -50%) scale(2.5); opacity: 0; }
}

/* ═══════════════════════════════════════════════════════════════
   Micro-animations des contrôles
   ═══════════════════════════════════════════════════════════════ */

/* ── Pulse (highlight) ── */
.ao-anim-pulse .ao-control-icon {
  animation: ao-icon-pulse 0.35s ease;
}

@keyframes ao-icon-pulse {
  0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(34, 68, 148, 0.3); }
  50% { transform: scale(1.15); box-shadow: 0 0 0 6px rgba(34, 68, 148, 0.1); }
  100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(34, 68, 148, 0); }
}

/* ── Click (scale down/up) ── */
.ao-anim-click .ao-control-icon {
  animation: ao-icon-click 0.2s ease;
}

@keyframes ao-icon-click {
  0% { transform: scale(1); }
  50% { transform: scale(0.88); background: var(--ao-brand); color: #fff; }
  100% { transform: scale(1); }
}

/* ── Dropdown open ── */
.ao-anim-dropdown-open {
  position: relative;
}

.ao-anim-dropdown-open::after {
  content: "";
  position: absolute;
  right: 12px;
  top: 100%;
  width: 80px;
  height: 0;
  background: var(--ao-control-bg);
  border: 1px solid var(--ao-border);
  border-radius: 0 0 6px 6px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
  animation: ao-dropdown-expand 0.3s ease forwards;
  z-index: 5;
  pointer-events: none;
}

@keyframes ao-dropdown-expand {
  0% { height: 0; opacity: 0; }
  100% { height: 40px; opacity: 1; }
}

.ao-anim-dropdown-select::after {
  background: linear-gradient(180deg, var(--ao-brand-soft) 40%, var(--ao-control-bg) 40%);
}

/* ── Toggle on/off ── */
.ao-anim-toggle-on .ao-control-icon {
  background: var(--ao-brand);
  color: #fff;
  transition: background 0.3s ease, color 0.3s ease;
}

.ao-anim-toggle-off .ao-control-icon {
  background: #e2e8f0;
  color: var(--ao-muted);
  transition: background 0.3s ease, color 0.3s ease;
}

/* ── Panel slide in ── */
.ao-anim-panel-open {
  animation: ao-panel-slide 0.4s ease;
}

@keyframes ao-panel-slide {
  0% { transform: translateX(8px); opacity: 0.6; }
  100% { transform: translateX(0); opacity: 1; }
}

/* ── Dialog appear ── */
.ao-anim-dialog {
  animation: ao-dialog-pop 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes ao-dialog-pop {
  0% { transform: scale(0.92); opacity: 0.5; }
  100% { transform: scale(1); opacity: 1; }
}

/* ── Typing (barre de formule effect) ── */
.ao-anim-typing .ao-control-label {
  font-family: "SF Mono", "Cascadia Code", "Consolas", monospace;
  color: var(--ao-brand);
  border-bottom: 1px solid var(--ao-brand);
  padding-bottom: 1px;
}

/* ── SheetTabs flash ── */
.ao-anim-tab-flash .ao-control-icon {
  animation: ao-tab-flash-anim 0.5s ease;
}

@keyframes ao-tab-flash-anim {
  0%, 100% { background: var(--ao-brand-soft); }
  30% { background: var(--ao-brand); color: #fff; }
  60% { background: var(--ao-brand-soft); }
}

/* ═══════════════════════════════════════════════════════════════
   Kind-specific control styling (optionnel)
   ═══════════════════════════════════════════════════════════════ */

.ao-kind-TypingIntent .ao-control-icon {
  background: #fef3c7;
  color: #92400e;
}

.ao-kind-SheetTabsIntent .ao-control-icon {
  background: #dcfce7;
  color: #166534;
}

.ao-kind-DialogIntent .ao-control-icon {
  background: #fae8ff;
  color: #86198f;
}

.ao-kind-PanelIntent .ao-control-icon {
  background: #e0f2fe;
  color: #0369a1;
}

.ao-kind-ToastIntent .ao-control-icon {
  background: #f1f5f9;
  color: var(--ao-muted);
}

/* ═══════════════════════════════════════════════════════════════
   Compact mode (taskpane étroit, < 300px)
   ═══════════════════════════════════════════════════════════════ */
@container (max-width: 300px) {
  .ao-tab {
    padding: 4px 5px;
    font-size: 9px;
  }
  .ao-control {
    padding: 6px 8px;
    gap: 6px;
  }
  .ao-control-icon {
    width: 22px;
    height: 22px;
  }
  .ao-control-label {
    font-size: 11px;
  }
  .ao-target {
    padding: 4px 8px;
  }
  .ao-cursor {
    display: none;
  }
}

/* Fallback pour navigateurs sans container queries */
@media (max-width: 320px) {
  .ao-tab {
    padding: 4px 5px;
    font-size: 9px;
  }
  .ao-control {
    padding: 6px 8px;
    gap: 6px;
  }
  .ao-control-icon {
    width: 22px;
    height: 22px;
  }
  .ao-control-label {
    font-size: 11px;
  }
  .ao-cursor {
    display: none;
  }
}


/* ═══════════════════════════════════════════════════════════════
   Preview Step Actions (inline action cards)
   ═══════════════════════════════════════════════════════════════ */

.pv-step-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px 12px 10px 32px;
  animation: pvActionsSlideIn 0.25s ease-out;
}

.pv-step-actions[hidden] {
  display: none;
}

@keyframes pvActionsSlideIn {
  0% { opacity: 0; max-height: 0; transform: translateY(-4px); }
  100% { opacity: 1; max-height: 600px; transform: translateY(0); }
}

.pv-step--expanded {
  background: #f8fafc;
  border-radius: 8px;
}

.pv-action-card {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 6px 10px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  font-size: 12px;
  transition: border-color 0.2s ease;
}

.pv-action-card:hover {
  border-color: #cbd5e1;
}

/* Ligne 1 : Cible */
.pv-action-target {
  display: flex;
  align-items: center;
  gap: 4px;
  color: #64748b;
  font-size: 11px;
  font-family: "SF Mono", "Cascadia Code", "Consolas", monospace;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pv-action-target-icon {
  font-size: 10px;
  flex-shrink: 0;
}

.pv-action-target-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Ligne 2 : Chemin ruban + icône action */
.pv-action-ribbon {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #1a3270;
  font-size: 11px;
  font-weight: 500;
}

.pv-action-path {
  color: #94a3b8;
  font-weight: 400;
  white-space: nowrap;
}

.pv-action-do-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 4px;
  background: #eff3ff;
  color: #224494;
  flex-shrink: 0;
}

.pv-action-do-icon svg {
  display: block;
}

.pv-action-do-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Kind-specific icon colors */
.pv-action-card[data-kind="TypingIntent"] .pv-action-do-icon {
  background: #fef3c7;
  color: #92400e;
}
.pv-action-card[data-kind="SheetTabsIntent"] .pv-action-do-icon {
  background: #dcfce7;
  color: #166534;
}
.pv-action-card[data-kind="DialogIntent"] .pv-action-do-icon {
  background: #fae8ff;
  color: #86198f;
}
.pv-action-card[data-kind="PanelIntent"] .pv-action-do-icon {
  background: #e0f2fe;
  color: #0369a1;
}

.pv-action-empty {
  font-size: 11px;
  color: #94a3b8;
  font-style: italic;
  padding: 4px 0;
}

/* ═══════════════════════════════════════════════════════════════
   Step header layout V2 — title above, button below
   ═══════════════════════════════════════════════════════════════ */

.pv-step-header {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
}

.pv-step-title-row {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
}

.pv-step-header .pv-run {
  flex-shrink: 0;
  text-align: center;
  white-space: nowrap;
}

/* Hide play button when step is playing */
.pv-step--playing .pv-run {
  display: none !important;
}

/* ═══════════════════════════════════════════════════════════════
   Progressive action card animations
   ═══════════════════════════════════════════════════════════════ */

.pv-action-card--hidden {
  opacity: 0;
  max-height: 0;
  overflow: hidden;
  margin: 0;
  padding: 0;
  border: none;
  transition: opacity 0.3s ease, max-height 0.3s ease, padding 0.3s ease, margin 0.3s ease;
}

.pv-action-card--visible {
  opacity: 1;
  max-height: 200px;
  padding: 6px 10px;
  margin-bottom: 6px;
  border: 1px solid #e2e8f0;
  transition: opacity 0.3s ease, max-height 0.4s ease, padding 0.3s ease;
}

.pv-anim-hidden {
  opacity: 0;
  max-height: 0;
  overflow: hidden;
  transition: opacity 0.25s ease, max-height 0.25s ease;
}

.pv-anim-reveal {
  opacity: 1;
  max-height: 60px;
  overflow: visible;
  transition: opacity 0.35s ease, max-height 0.35s ease;
}

.pv-action-card--applying {
  border-color: #224494;
  background: #f8faff;
  box-shadow: 0 0 0 1px rgba(34, 68, 148, 0.15);
}

.pv-action-card--done {
  border-color: #16a34a;
  background: #f0fdf4;
}

.pv-action-status {
  font-size: 11px;
  text-align: right;
  padding-top: 2px;
}


/* ═══════════════════════════════════════════════════════════════
   NEW: Step Screen (DO descriptions with shimmer)
   ═══════════════════════════════════════════════════════════════ */

/* ── Setup spinner (centered in modal) ── */
.pv-spinner-overlay {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 12px;
  padding: 40px 20px;
  min-height: 120px;
}

.pv-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid #e2e8f0;
  border-top-color: #224494;
  border-radius: 50%;
  animation: pvSpin 0.8s linear infinite;
}

@keyframes pvSpin {
  to { transform: rotate(360deg); }
}

.pv-spinner-label {
  font-size: 12px;
  color: #64748b;
  font-style: italic;
}

/* ── Step rectangle (new layout) ── */
.pv-step-rect {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  margin-bottom: 6px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.pv-step-rect:hover {
  border-color: #cbd5e1;
}

.pv-step-rect.pv-step--playing {
  border-color: #224494;
  box-shadow: 0 0 0 1px rgba(34, 68, 148, 0.12);
}

.pv-step-rect.pv-step--played {
  border-color: #16a34a;
  background: #f8fdf9;
}

.pv-step-rect.pv-step--played .pv-step-num {
  background: #16a34a;
  color: #fff;
}

/* ── Step number badge ── */
.pv-step-num {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #eff3ff;
  color: #224494;
  font-size: 11px;
  font-weight: 700;
  user-select: none;
}

/* ── Step screen (title + DO descriptions) ── */
.pv-step-screen {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 22px;
  display: flex;
  align-items: center;
  overflow: hidden;
}

.pv-step-screen-title {
  font-size: 12px;
  font-weight: 500;
  color: #1e293b;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  white-space: normal;
  line-height: 1.4;
}

.pv-step-screen-do {
  font-style: italic;
  font-size: 12px;
  color: #475569;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  white-space: normal;
  line-height: 1.4;
  color: #475569;
  animation: pvShimmerColor 1.8s linear infinite;
}

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

@keyframes pvShimmerColor {
  0%, 100% { color: #475569; }
  50% { color: #a5b4cc; }
}

.pv-step-screen-done {
  font-size: 12px;
  font-weight: 500;
  color: #16a34a;
}

/* ── Play button in step rect ── */
.pv-step-rect .pv-run {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: #224494;
  color: #fff;
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, transform 0.1s ease;
}

.pv-step-rect .pv-run:hover:not(:disabled) {
  background: #1a3270;
  transform: scale(1.05);
}

.pv-step-rect .pv-run:disabled {
  background: #cbd5e1;
  cursor: not-allowed;
}

.pv-step-rect.pv-step--played .pv-run {
  background: #16a34a;
  cursor: default;
}

.pv-step-rect.pv-step--played .pv-run::after {
  content: "✓";
  font-size: 14px;
}

.pv-step-rect.pv-step--playing .pv-run {
  display: none;
}

/* ── Disabled state for modal action buttons ── */
.pv-modal-actions .btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

.pv-modal-actions .btn-primary:disabled {
  background: #94a3b8;
  border-color: #94a3b8;
}