/* ===== Form Actions — pixel-perfect implementation ===== */
@import url('https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,400;0,14..32,500;0,14..32,600;0,14..32,700;0,14..32,800&display=swap');

:root {
  /* Color tokens (from Figma) */
  --gray-900: #101828;
  --gray-800: #1d2939;
  --gray-600: #475467;
  --gray-500: #667085;
  --gray-400: #98a2b3;
  --gray-300: #d0d5dd;
  --gray-100: #f2f4f7;
  --gray-50:  #f9fafb;
  --white:    #ffffff;
  --link:     #4199fd;
  --primary:  #4199fd;
  --success:  #12b76a;

  --shadow-xs: 0px 0.471px 0.941px rgba(16,24,40,0.05);
  --shadow-sm: 0px 0.471px 1.412px rgba(16,24,40,0.1), 0px 0.471px 0.941px rgba(16,24,40,0.06);
  --shadow-pill: 0px 0.471px 0.706px rgba(16,24,40,0.1), 0px 0.471px 0.471px rgba(16,24,40,0.06);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--white);
  color: var(--gray-900);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* ===== Screen shell — full screen, edge to edge ===== */
.screen {
  width: 100%;
  min-height: 100vh;
  background: var(--white);
  position: relative;
}

/* ===== Top header ===== */
.header {
  height: 72px;
  background: var(--white);
  border-bottom: 1px solid var(--gray-300);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.page-title {
  display: flex;
  align-items: center;
  gap: 16px;
  width: 284px;
  height: 72px;
  padding-left: 24px;
  flex-shrink: 0;
}
.page-title .logo { width: 36px; height: 36px; display: block; flex-shrink: 0; }
.page-title .title { display: flex; align-items: center; gap: 4px; }
.page-title .title-text { font-size: 20px; font-weight: 500; line-height: 30px; color: var(--gray-900); white-space: nowrap; }
.page-title .title .chevron { width: 24px; height: 24px; color: var(--gray-900); flex-shrink: 0; }

/* Tabs (center) */
.tabs { display: flex; align-items: center; gap: 24px; height: 72px; flex-shrink: 0; }
.tab {
  font-size: 16px; font-weight: 400; line-height: 24px; color: var(--gray-500);
  white-space: nowrap; position: relative; cursor: pointer; background: none; border: none;
  font-family: inherit;
}
.tab.active { font-weight: 700; color: var(--link); }
.tab.active::after {
  content: ""; position: absolute; left: 50%; transform: translateX(-50%);
  bottom: -4px; width: 40px; height: 2px; background: var(--link);
}

/* Actions (right) */
.actions { display: flex; align-items: center; gap: 20px; height: 72px; padding-right: 24px; flex-shrink: 0; }
.actions .action-group { display: flex; align-items: center; gap: 16px; justify-content: flex-end; }

.btn { font-family: inherit; cursor: pointer; border: none; white-space: nowrap; display: inline-flex; align-items: center; }
.btn-tertiary {
  padding: 8px 12px; border-radius: 200px; background: none;
  color: var(--link); font-size: 14px; font-weight: 600; line-height: 20px;
}
.btn-secondary {
  background: var(--white); border: 1px solid var(--gray-300); border-radius: 200px;
  padding: 8px 16px; gap: 4px; box-shadow: var(--shadow-xs);
  color: var(--gray-800); font-size: 14px; font-weight: 600; line-height: 20px;
}
.btn-secondary .chevron { width: 20px; height: 20px; color: var(--gray-800); }
.btn-primary {
  background: var(--primary); border-radius: 200px; padding: 8px 16px;
  color: var(--white); font-size: 14px; font-weight: 600; line-height: 20px;
}
.actions .divider { width: 1px; align-self: stretch; background: var(--gray-300); margin: 12px 0; }
.actions .close { width: 24px; height: 24px; color: var(--gray-900); cursor: pointer; flex-shrink: 0; }

/* ===== Body: sidebar + content ===== */
.body { display: flex; align-items: stretch; min-height: calc(100vh - 72px); }

.sidebar {
  width: 275px;
  background: var(--gray-50);
  border-right: 1px solid var(--gray-300);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  flex-shrink: 0;
}
.nav-item { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.nav-item .nav-icon { width: 24px; height: 24px; display: block; flex-shrink: 0; }
.nav-item .nav-label { font-size: 16px; font-weight: 500; line-height: 24px; color: var(--gray-900); white-space: nowrap; }
.nav-item.active .nav-icon { color: var(--link); }
.nav-item.active .nav-label { color: var(--link); }

/* ===== Content ===== */
.content { flex: 1; min-width: 0; padding: 24px 42px; }
.content-inner { display: flex; flex-direction: column; gap: 24px; }


.section-head { display: flex; flex-direction: column; gap: 16px; }
.head-text { display: flex; flex-direction: column; gap: 6px; width: 684px; }
.head-text h1 { font-size: 18px; font-weight: 500; line-height: 28px; color: var(--gray-900); }
.head-text p { font-size: 14px; font-weight: 400; line-height: 20px; color: var(--gray-500); }

.toolbar { display: flex; align-items: center; justify-content: space-between; }

/* Segmented control */
.segmented {
  background: var(--gray-100); height: 44px; border-radius: 8px; width: 235px;
  display: flex; align-items: center; gap: 8px; padding: 8px;
}
.seg-btn {
  font-family: inherit; cursor: pointer; border: none; background: none;
  padding: 4px 16px; border-radius: 8px; font-size: 14px; font-weight: 500; line-height: 20px;
  color: var(--gray-500); white-space: nowrap;
}
.seg-btn.active { background: var(--white); color: var(--gray-900); box-shadow: var(--shadow-pill); }

/* Search */
.search {
  width: 380px; height: 44px; background: var(--white); border: 1px solid var(--gray-300);
  border-radius: 8px; box-shadow: var(--shadow-xs); display: flex; align-items: center;
  gap: 8px; padding: 6px 8px;
}
.search .search-icon { width: 20px; height: 20px; color: var(--gray-500); flex-shrink: 0; }
.search input {
  flex: 1; border: none; outline: none; background: none; font-family: inherit;
  font-size: 16px; font-weight: 400; line-height: 24px; color: var(--gray-900); padding-left: 4px;
}
.search input::placeholder { color: var(--gray-500); }

/* ===== Category sections (All Actions) ===== */
.categories { display: flex; flex-direction: column; gap: 24px; }
.category { display: flex; flex-direction: column; gap: 12px; }
.category-label { font-size: 14px; font-weight: 500; line-height: 20px; color: var(--gray-600); text-transform: uppercase; }
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 16px; }

.action-card {
  border: 1px solid var(--gray-300); border-radius: 8px; padding: 12px;
  box-shadow: var(--shadow-pill); background: var(--white);
  display: flex; align-items: center; gap: 8px; cursor: pointer;
  position: relative; overflow: hidden;
  transition: box-shadow .15s var(--ease-out), border-color .15s var(--ease-out), transform .14s var(--ease-out), background-color .15s var(--ease-out);
}
.action-card:hover { border-color: var(--gray-400); box-shadow: var(--shadow-sm); background: var(--gray-50); }
.action-card:active { transform: scale(0.985); }

/* Hover-reveal "+ Add" button — absolutely positioned so the card never reflows.
   A gradient fades any overlapped text out beneath it instead of an abrupt cut. */
.action-card::after {
  content: ""; position: absolute; inset: 0 0 0 auto; width: 104px; z-index: 1;
  background: linear-gradient(to right, rgba(249,250,251,0) 0%, var(--gray-50) 70%);
  opacity: 0; pointer-events: none; transition: opacity .18s var(--ease-out);
}
.action-card:hover::after { opacity: 1; }
.card-add {
  position: absolute; top: 50%; right: 12px; transform: translateY(-50%); z-index: 2;
  opacity: 0; pointer-events: none;
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--white); border: 1px solid var(--gray-300); border-radius: 128px;
  padding: 4px 12px; font-family: inherit; font-size: 12px; font-weight: 600; line-height: 18px;
  color: var(--gray-800); cursor: pointer; box-shadow: var(--shadow-xs); white-space: nowrap;
  transition: opacity .18s var(--ease-out), background-color .15s var(--ease-out);
}
.card-add svg { width: 16px; height: 16px; flex-shrink: 0; }
.action-card:hover .card-add { opacity: 1; pointer-events: auto; }
.card-add:hover { background: var(--gray-100); }
.card-add:active { transform: translateY(-50%) scale(0.96); }
.icon-box {
  width: 40px; height: 40px; background: var(--white); border: 1px solid var(--gray-300);
  border-radius: 8px; box-shadow: var(--shadow-sm); flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.icon-box img { width: 20px; height: 20px; display: block; object-fit: contain; }
.card-text { display: flex; flex-direction: column; justify-content: center; min-width: 0; flex: 1; }
.card-title { display: flex; align-items: center; gap: 6px; }
.card-title .name { font-size: 16px; font-weight: 500; line-height: 24px; color: var(--gray-900); }
.card-desc { font-size: 14px; font-weight: 400; line-height: 20px; color: var(--gray-500); }
.badge-new {
  background: var(--success); border-radius: 6px; padding: 4px 8px;
  font-size: 9px; font-weight: 800; line-height: 14px; color: var(--white); text-transform: uppercase;
}

/* ===== Your Actions list ===== */
.your-actions { display: flex; flex-direction: column; gap: 12px; }
.your-actions .category-label { color: var(--gray-600); }
.your-actions .category-label.hidden { display: none; }
.your-actions.hidden { display: none; }
.action-list { display: flex; flex-direction: column; gap: 8px; }

/* Each list entry: header row + (optional) expandable settings body */
.action-item {
  background: var(--white); border: 1px solid var(--gray-300); border-radius: 8px;
  overflow: hidden;
}
.action-item.expanded { border-color: var(--gray-300); }

.action-row {
  height: 48px; display: flex; align-items: center; justify-content: space-between;
  padding: 0 11px; cursor: pointer; background: var(--white);
}
.action-item.expanded > .action-row { background: var(--gray-50); border-bottom: 1px solid #eaecf0; }
.action-row .row-left { display: flex; align-items: center; gap: 8px; }
.drag { width: 24px; height: 24px; color: var(--gray-400); flex-shrink: 0; cursor: grab; display: flex; align-items: center; justify-content: center; }
.row-icon-box {
  width: 24px; height: 24px; border: 1px solid var(--gray-300); border-radius: 4px;
  background: var(--white); display: flex; align-items: center; justify-content: center; overflow: hidden; flex-shrink: 0;
}
.row-icon-box img { width: 16px; height: 16px; display: block; object-fit: contain; }
.row-title { font-size: 16px; font-weight: 500; line-height: 24px; color: var(--gray-900); white-space: nowrap; }

/* Right-side controls: hover-only actions + always-visible chevron */
.row-controls { display: flex; align-items: center; gap: 16px; }
.row-actions { display: flex; align-items: center; gap: 24px; opacity: 0; transition: opacity .16s var(--ease-out); }
.action-row:hover .row-actions, .action-item:focus-within .row-actions { opacity: 1; }
.row-actions .icon-pair { display: flex; align-items: center; gap: 16px; }
.row-ctrl { background: none; border: none; padding: 0; cursor: pointer; width: 24px; height: 24px;
  display: flex; align-items: center; justify-content: center; color: var(--gray-500); }
.row-ctrl:hover { color: var(--gray-800); }
.row-ctrl svg { width: 20px; height: 20px; }
.row-chevron-btn { background: none; border: none; padding: 0; cursor: pointer; width: 24px; height: 24px;
  display: flex; align-items: center; justify-content: center; color: var(--gray-500); }
.row-chevron-btn svg { width: 24px; height: 24px; transition: transform .2s var(--ease-out); }
.action-item.expanded .row-chevron-btn svg { transform: rotate(180deg); }

/* On/off pill toggle (knob carries a check / x glyph, like Figma) */
.ftoggle { position: relative; display: inline-flex; cursor: pointer; flex-shrink: 0; }
.ftoggle input { position: absolute; opacity: 0; width: 0; height: 0; }
.ftoggle .track { display: block; width: 40px; height: 24px; border-radius: 200px; background: var(--gray-400);
  position: relative; transition: background-color .18s var(--ease-out); }
.ftoggle input:checked + .track { background: var(--primary); }
.ftoggle .knob { position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 2px rgba(16,24,40,.25); display: flex; align-items: center; justify-content: center;
  transition: transform .18s var(--ease-out); }
.ftoggle input:checked + .track .knob { transform: translateX(16px); }
.ftoggle .knob svg { width: 10px; height: 10px; }
.ftoggle .knob .g-on { display: none; color: var(--primary); }
.ftoggle .knob .g-off { display: block; color: var(--gray-400); }
.ftoggle input:checked + .track .knob .g-on { display: block; }
.ftoggle input:checked + .track .knob .g-off { display: none; }

/* ===== Expandable settings body (Create Post form, etc.) ===== */
.action-body { display: none; padding: 20px 16px 16px; background: #fff; flex-direction: column; gap: 20px; }
.action-item.expanded .action-body { display: flex; animation: enter-up .28s var(--ease-out) backwards; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px 24px; }
.field-label { font-size: 14px; font-weight: 500; line-height: 20px; color: #344054; display: flex; align-items: center; gap: 5px; }
.field-label .req { color: #f04438; }
.field-label .info { width: 14px; height: 14px; color: var(--gray-400); flex-shrink: 0; }
.field-input { height: 44px; border: 1px solid var(--gray-300); border-radius: 8px; background: #fff;
  font-family: inherit; font-size: 16px; color: var(--gray-900); padding: 0 12px; width: 100%; outline: none;
  transition: border-color .15s var(--ease-out), box-shadow .15s var(--ease-out); }
.field-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(65,153,253,.15); }
.select-wrap { position: relative; }
.select-wrap select { appearance: none; -webkit-appearance: none; height: 44px; width: 100%;
  border: 1px solid var(--gray-300); border-radius: 8px; background: #fff; font-family: inherit; font-size: 16px;
  color: var(--gray-900); padding: 0 36px 0 12px; cursor: pointer; outline: none;
  transition: border-color .15s var(--ease-out), box-shadow .15s var(--ease-out); }
.select-wrap select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(65,153,253,.15); }
.select-wrap .chev { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); width: 20px; height: 20px;
  color: var(--gray-500); pointer-events: none; }

.settings-divider { height: 1px; background: #eaecf0; }
.settings-section { display: flex; flex-direction: column; gap: 16px; }
.settings-section-label { font-size: 14px; font-weight: 500; letter-spacing: .04em; text-transform: uppercase; color: var(--gray-600); }
.add-btn { align-self: flex-start; display: inline-flex; align-items: center; gap: 6px; background: #fff;
  border: 1px solid var(--gray-300); border-radius: 200px; padding: 8px 16px; font-size: 14px; font-weight: 600;
  color: var(--gray-800); cursor: pointer; box-shadow: var(--shadow-xs); font-family: inherit; }
.add-btn svg { width: 18px; height: 18px; }
.settings-toggle-row { display: flex; align-items: center; gap: 12px; padding-top: 16px; border-top: 1px solid #eaecf0; }
.settings-toggle-row .lbl { font-size: 16px; font-weight: 400; line-height: 24px; color: var(--gray-900); }

/* Ghost "Add an Action" row */
.add-action-row {
  width: 100%; height: 48px; border: 1px dashed var(--gray-300); border-radius: 8px;
  background: none; cursor: pointer; font-family: inherit;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  color: var(--gray-500); font-size: 16px; font-weight: 500; line-height: 24px;
  transition: border-color .15s ease, color .15s ease, background .15s ease;
}
.add-action-row:hover { border-color: var(--primary); color: var(--primary); background: rgba(65,153,253,0.04); }
.add-action-row .plus { width: 20px; height: 20px; flex-shrink: 0; }
.add-action-row.hidden { display: none; }

/* Tab visibility */
.categories.hidden { display: none; }

/* ===== V2: catalog + Show All / Show less button ===== */
/* No segmented control here — left-align the compact search. */
.v2-toolbar { display: flex; justify-content: flex-start; }
.catalog-wrap { display: flex; flex-direction: column; gap: 16px; }
.catalog { display: flex; flex-direction: column; gap: 24px; }
.show-all-btn {
  align-self: flex-start;
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--white); border: 1px solid var(--gray-300); border-radius: 200px;
  padding: 8px 16px; cursor: pointer; font-family: inherit;
  font-size: 14px; font-weight: 600; line-height: 20px; color: var(--gray-800);
  box-shadow: var(--shadow-xs);
}
.show-all-btn .sa-icon { width: 20px; height: 20px; flex-shrink: 0; display: block; color: var(--gray-800); }
.show-all-btn .sa-icon svg { width: 100%; height: 100%; display: block; }

/* ===== Floating version switcher (V1 / V2) ===== */
.version-switch {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
  z-index: 1000; display: flex; gap: 4px; padding: 4px;
  background: var(--white); border: 1px solid var(--gray-300); border-radius: 999px;
  box-shadow: 0 6px 20px rgba(16,24,40,0.14), 0 1px 3px rgba(16,24,40,0.08);
}
.vs-btn {
  text-decoration: none; font-size: 13px; font-weight: 600; line-height: 1;
  color: var(--gray-500); padding: 8px 18px; border-radius: 999px; letter-spacing: .2px;
}
.vs-btn:hover { color: var(--gray-900); }
.vs-btn.active { background: var(--primary); color: #fff; }

/* ===================================================== */
/* Motion & micro-interactions                           */
/* ===================================================== */
:root { --ease-out: cubic-bezier(0.2, 0, 0, 1); }

/* Interruptible state transitions + tactile press feedback.
   Exact properties only — never `transition: all`. */
.btn, .seg-btn, .nav-item, .action-row, .add-action-row, .actions .close,
.show-all-btn, .vs-btn {
  transition-property: transform, background-color, color, box-shadow, border-color;
  transition-duration: .16s;
  transition-timing-function: var(--ease-out);
}
.tab, .nav-label { transition: color .16s var(--ease-out); }

/* Scale on press — 0.96 for buttons/pills, gentler for large surfaces */
.btn:active, .seg-btn:active, .show-all-btn:active, .vs-btn:active { transform: scale(0.96); }
.show-all-btn:hover { background: var(--gray-50); }
.nav-item:active             { transform: scale(0.97); }
.actions .close:active       { transform: scale(0.92); }
.action-row:active           { transform: scale(0.99); }
.add-action-row:active       { transform: scale(0.99); }

/* Hover affordances */
.tab:hover                  { color: var(--gray-900); }
.tab.active:hover           { color: var(--link); }
.nav-item:hover .nav-label  { color: var(--link); }
.btn-secondary:hover        { background: var(--gray-50); }
.btn-primary:hover          { background: #2f8cf5; }
.btn-tertiary:hover         { background: rgba(65,153,253,0.08); }
.seg-btn:not(.active):hover { color: var(--gray-800); }
.action-item:hover          { border-color: var(--gray-400); }

/* Staggered entrance — used on load and on each tab switch.
   `backwards` fill holds the hidden state through the delay (no flash),
   then reverts after so :active press transforms still work. */
@keyframes enter-up {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}
.enter-anim {
  animation: enter-up .26s var(--ease-out) backwards;
  animation-delay: calc(var(--i, 0) * 30ms);
  will-change: transform, opacity;
}

/* Subtle exit when leaving the All Actions catalog (softer than the enter) */
#categories.leaving {
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity .14s var(--ease-out), transform .14s var(--ease-out);
  pointer-events: none;
}

@media (prefers-reduced-motion: reduce) {
  .enter-anim { animation: none; }
  .btn, .seg-btn, .nav-item, .action-row, .add-action-row, .actions .close,
  .action-card, .tab, .nav-label, #categories.leaving { transition: none; }
  .btn:active, .seg-btn:active, .nav-item:active, .actions .close:active,
  .action-row:active, .add-action-row:active, .action-card:active { transform: none; }
}
