/*
 * This is a manifest file that'll be compiled into application.css.
 *
 * With Propshaft, assets are served efficiently without preprocessing steps. You can still include
 * application-wide styles in this file, but keep in mind that CSS precedence will follow the standard
 * cascading order, meaning styles declared later in the document or manifest will override earlier ones,
 * depending on specificity.
 *
 * Consider organizing styles into separate files for maintainability.
 */

/* ───── Value-chips input (product option values + SEO tags) ───── */
.vc-field {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  min-height: 38px;
  cursor: text;
  border-radius: 6px;
  transition: box-shadow 0.15s ease;
}
/* Briefly flashed by value_chips_controller.js#addValues when a
   max-value cap (e.g. the tags field's 10-tag limit) blocks a new chip -
   a quick, wordless "that didn't go in" cue rather than a jarring alert. */
.vc-field--limit {
  box-shadow: 0 0 0 2px rgb(254 202 202); /* rose-200 */
}
.vc-input {
  flex: 1 1 8rem;
  min-width: 8rem;
  border: 0;
  outline: 0;
  padding: 4px 2px;
  font-size: inherit;
  background: transparent;
}
.vc-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 4px 3px 10px;
  background: rgb(238 242 255); /* indigo-50 */
  color: rgb(49 46 129);        /* indigo-900 */
  border-radius: 9999px;
  font-size: 13px;
  line-height: 1;
  white-space: nowrap;
}
.vc-chip .vc-label { font-weight: 500; }
.vc-chip button {
  width: 20px; height: 20px;
  border: 0;
  background: transparent;
  color: rgb(100 116 139);
  border-radius: 9999px;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.vc-chip button:hover {
  background: rgb(254 226 226); /* rose-100 */
  color: rgb(190 18 60);
}
.vc-chip .vc-swatch {
  width: 16px; height: 16px;
  border-radius: 9999px;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.12);
  flex-shrink: 0;
}

/* ───── iOS-style toggle switch ───── */
.toggle-row {
  display: inline-flex;
  align-items: flex-start;
  gap: 0.75rem;
  cursor: pointer;
  user-select: none;
}
/* Hide the real checkbox without removing it from the accessibility
   tree or breaking the label association. Don't use .sr-only here so
   we don't depend on Tailwind's preflight being compiled. */
.toggle-input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  margin: 0;
  pointer-events: none;
}
.toggle-track {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  background: rgb(203 213 225); /* slate-300 */
  border-radius: 9999px;
  transition: background 180ms ease;
  margin-top: 1px;
}
.toggle-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  background: white;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0,0,0,0.25);
  transition: transform 180ms ease;
}
.toggle-input:checked + .toggle-track {
  /* Zarlo brand indigo (#3D2C5F / --color-indigo-900), not stock
     Tailwind indigo-600 - this file isn't run through the Tailwind
     build, so it can't use a `bg-indigo-900` class and reads the
     brand token via the CSS variable Tailwind's @theme block emits
     (app/assets/tailwind/application.css), which is on the page too. */
  background: var(--color-indigo-900, rgb(61 44 95));
}
.toggle-input:checked + .toggle-track .toggle-thumb {
  transform: translateX(20px);
}
.toggle-input:focus-visible + .toggle-track {
  box-shadow: 0 0 0 3px rgba(61, 44, 95, 0.35); /* brand indigo, 35% */
}
.toggle-input:disabled + .toggle-track {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ───── Sticky save bar (for long settings forms) ───── */
html { scroll-behavior: smooth; }
/* Section anchors get a small top margin so the heading isn't flush
   against the viewport top after a jump. */
.scroll-mt-4 { scroll-margin-top: 1rem; }

.sticky-save-bar {
  position: sticky;
  bottom: 0;
  z-index: 30;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(8px);
  border-top: 1px solid rgb(226 232 240); /* slate-200 */
  box-shadow: 0 -2px 8px rgba(15, 23, 42, 0.04);
}
.sticky-save-bar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.875rem 1.25rem;
  max-width: 64rem;
  margin: 0 auto;
}

/* ── Dashboard sidebar: collapsible to an icon rail (md and up) ──────────────────────────────
   <html data-sidebar="collapsed"> is set by the layout from the zarlo_sidebar cookie (so the page
   is drawn collapsed from its first paint) and flipped by sidebar_controller.js#toggleCollapse.
   Below md the sidebar is the slide-in drawer and none of this applies. Labels are visually
   hidden, not removed, so every link keeps its name for a screen reader. */
#dashboard-sidebar { transition-property: transform, width; }
.dash-main { transition: margin-inline-start 200ms ease-out; }
.dash-collapse-icon { transform: scaleX(var(--dash-flip, 1)); transition: transform 200ms ease-out; }
[dir="rtl"] .dash-collapse-icon { --dash-flip: -1; }

@media (min-width: 768px) {
  html[data-sidebar="collapsed"] #dashboard-sidebar { width: 4.5rem; }
  html[data-sidebar="collapsed"] .dash-main { margin-inline-start: 4.5rem; }
  html[data-sidebar="collapsed"] .dash-collapse-icon { transform: scaleX(calc(var(--dash-flip, 1) * -1)); }

  html[data-sidebar="collapsed"] #dashboard-sidebar .dash-label {
    position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; border: 0;
    overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap;
  }
  html[data-sidebar="collapsed"] #dashboard-sidebar .dash-nav-link,
  html[data-sidebar="collapsed"] #dashboard-sidebar .dash-brand { justify-content: center; gap: 0; padding-inline: 0; }
  /* In the rail each group is one icon that opens a flyout of its pages, instead of its list of icons. */
  html[data-sidebar="collapsed"] #dashboard-sidebar .dash-group-panel { display: none; }
  html[data-sidebar="collapsed"] #dashboard-sidebar .dash-group-rail { display: flex; }
  /* The section titles are gone, so a hairline tells the groups apart. */
  html[data-sidebar="collapsed"] #dashboard-sidebar .dash-nav-section ~ .dash-nav-section {
    margin-top: 0.75rem; padding-top: 0.75rem; border-top: 1px solid rgb(226 232 240);
  }
}

@media (prefers-reduced-motion: reduce) {
  #dashboard-sidebar, .dash-main, .dash-collapse-icon, .dash-group-chevron { transition: none; }
  .dash-rail-tip, .dash-flyout { animation: none; }
}

/* Menu groups that fold away (sidebar_controller.js#toggleGroup). The links of a closed group stay in the page, hidden, so Search and the
   active highlight still find them. The icon rail has no room for group titles or lists, so there each group is one icon that opens a flyout. */
.dash-group-panel.is-closed { display: none; }
.dash-group-rail { display: none; } /* the rail's one-icon stand-in for a group; shown only in the rail, below */
.dash-group-rail.is-open { background-color: rgb(241 245 249); }
.dash-group-chevron { transition: transform 150ms ease-out; }
.dash-group-toggle[aria-expanded="false"] .dash-group-chevron { transform: rotate(-90deg); }
[dir="rtl"] .dash-group-toggle[aria-expanded="false"] .dash-group-chevron { transform: rotate(90deg); }

/* The rail's group flyouts (shared/_sidebar_flyouts): a quick fade in. */
.dash-flyout { animation: dash-flyout-in 120ms ease-out; }
/* The invisible strip from the panel back to its icon (a real child, see the partial), so the pointer is never on nothing on its
   way in: --dash-bridge, the width of that ground, is set by sidebar_controller.js#placeFlyout. */
.dash-flyout-bridge {
  position: absolute; top: 0; bottom: 0;
  width: var(--dash-bridge, 20px); inset-inline-start: calc(var(--dash-bridge, 20px) * -1);
}
@keyframes dash-flyout-in {
  from { opacity: 0; transform: scale(0.97); }
  to   { opacity: 1; transform: scale(1); }
}

/* The icon rail's name tag (sidebar_controller.js#showTip): centred on its icon, a quick fade in. */
.dash-rail-tip { transform: translateY(-50%); animation: dash-tip-in 120ms ease-out; }
@keyframes dash-tip-in {
  from { opacity: 0; transform: translateY(-50%) scale(0.96); }
  to   { opacity: 1; transform: translateY(-50%) scale(1); }
}

/* The ⌘K palette: the highlighted result (keyboard or mouse). */
#dash-palette a.is-active { background-color: rgb(238 242 255); color: rgb(49 46 129); }
#dash-palette a.is-active svg:first-child { color: rgb(79 70 229); }
