/*
 * 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.
 */

/*
 * Vinted-inspired theme.
 * Palette sampled from the reference screenshots attached to SprintVibe story 2980.
 * Loaded after the Bootstrap CDN stylesheet, so same-specificity overrides here win.
 */

:root {
  /* Design tokens */
  --vinted-teal: #327680;
  --vinted-teal-dark: #285e66;
  --vinted-teal-darker: #1f4a50;
  --vinted-teal-tint: #eafafa;
  --vinted-ink: #171717;
  --vinted-dark-green: #225056;
  --vinted-muted: #5c6566;
  --vinted-field: #eef2f2;
  --vinted-border: #e0e0e0;
  --vinted-bg: #ffffff;
  --vinted-font-display: "Quicksand", system-ui, -apple-system, "Segoe UI", sans-serif;
  --vinted-gradient: linear-gradient(135deg, #47919b 0%, var(--vinted-teal) 45%, var(--vinted-teal-darker) 100%);
  --vinted-gradient-bright: linear-gradient(25deg, #4fa3ad 0%, var(--vinted-teal) 60%, #275f68 100%);

  /* Bridge tokens into Bootstrap 5.3 */
  --bs-primary: var(--vinted-teal);
  --bs-primary-rgb: 50, 118, 128;
  --bs-body-color: var(--vinted-ink);
  --bs-secondary-color: var(--vinted-muted);
  --bs-border-color: var(--vinted-border);
  --bs-link-color: var(--vinted-teal);
  --bs-link-hover-color: var(--vinted-teal-dark);
  --bs-link-color-rgb: 50, 118, 128;
  --bs-link-hover-color-rgb: 40, 94, 102;
  --bs-border-radius: 0.5rem;
  --bs-focus-ring-color: rgba(50, 118, 128, 0.25);
}

h1, h2, h3, h4, h5, h6,
.h1, .h2, .h3, .h4, .h5, .h6 {
  color: var(--vinted-ink);
  font-family: var(--vinted-font-display);
}

/* Buttons and navigation share the display font */
.btn, .nav-link, .dropdown-item {
  font-family: var(--vinted-font-display);
}

.btn-primary {
  --bs-btn-bg: var(--vinted-teal);
  --bs-btn-border-color: var(--vinted-teal);
  --bs-btn-hover-bg: var(--vinted-teal-dark);
  --bs-btn-hover-border-color: var(--vinted-teal-dark);
  --bs-btn-active-bg: var(--vinted-teal-darker);
  --bs-btn-active-border-color: var(--vinted-teal-darker);
  --bs-btn-disabled-bg: var(--vinted-teal);
  --bs-btn-disabled-border-color: var(--vinted-teal);
  --bs-btn-focus-shadow-rgb: 50, 118, 128;
}

/*
 * Soft outline buttons: background is the text color at low opacity, no
 * border, hover bumps the opacity. Applies to every .btn-outline-* variant.
 */
.btn-outline-primary {
  --bs-btn-color: var(--vinted-teal);
  --bs-btn-bg: rgba(50, 118, 128, 0.12);
  --bs-btn-border-color: transparent;
  --bs-btn-hover-color: var(--vinted-teal-dark);
  --bs-btn-hover-bg: rgba(50, 118, 128, 0.25);
  --bs-btn-hover-border-color: transparent;
  --bs-btn-active-color: var(--vinted-teal-darker);
  --bs-btn-active-bg: rgba(50, 118, 128, 0.32);
  --bs-btn-active-border-color: transparent;
  --bs-btn-disabled-color: var(--vinted-teal);
  --bs-btn-disabled-bg: rgba(50, 118, 128, 0.08);
  --bs-btn-disabled-border-color: transparent;
  --bs-btn-focus-shadow-rgb: 50, 118, 128;
}

.btn-outline-secondary {
  --bs-btn-color: var(--vinted-muted);
  --bs-btn-bg: rgba(92, 101, 102, 0.12);
  --bs-btn-border-color: transparent;
  --bs-btn-hover-color: var(--vinted-ink);
  --bs-btn-hover-bg: rgba(92, 101, 102, 0.25);
  --bs-btn-hover-border-color: transparent;
  --bs-btn-active-color: var(--vinted-ink);
  --bs-btn-active-bg: rgba(92, 101, 102, 0.32);
  --bs-btn-active-border-color: transparent;
  --bs-btn-disabled-color: var(--vinted-muted);
  --bs-btn-disabled-bg: rgba(92, 101, 102, 0.08);
  --bs-btn-disabled-border-color: transparent;
  --bs-btn-focus-shadow-rgb: 92, 101, 102;
}

.btn-outline-danger {
  --bs-btn-color: #dc3545;
  --bs-btn-bg: rgba(220, 53, 69, 0.12);
  --bs-btn-border-color: transparent;
  --bs-btn-hover-color: #b02a37;
  --bs-btn-hover-bg: rgba(220, 53, 69, 0.25);
  --bs-btn-hover-border-color: transparent;
  --bs-btn-active-color: #b02a37;
  --bs-btn-active-bg: rgba(220, 53, 69, 0.32);
  --bs-btn-active-border-color: transparent;
  --bs-btn-disabled-color: #dc3545;
  --bs-btn-disabled-bg: rgba(220, 53, 69, 0.08);
  --bs-btn-disabled-border-color: transparent;
  --bs-btn-focus-shadow-rgb: 220, 53, 69;
}

/* Vinted-style filled form fields: gray fill at rest, white with teal ring on focus */
.form-control, .form-select {
  background-color: var(--vinted-field);
  border-color: transparent;
}

/* Bootstrap paints a solid pill behind floated labels (label::after); with
   gray-filled inputs it reads as a white smudge — keep labels backgroundless. */
.form-floating > .form-control:focus ~ label::after,
.form-floating > .form-control:not(:placeholder-shown) ~ label::after,
.form-floating > .form-control-plaintext ~ label::after,
.form-floating > .form-select ~ label::after {
  background-color: transparent;
}

/* Textareas are the exception: long content scrolls beneath the floated
   label, so its pill takes the field's CURRENT background — gray at rest,
   white while focused — and stays legible in both states. */
.form-floating > textarea.form-control:not(:placeholder-shown) ~ label::after {
  background-color: var(--vinted-field);
}

.form-floating > textarea.form-control:focus ~ label::after {
  background-color: var(--vinted-bg);
}

.form-control:focus, .form-select:focus {
  background-color: var(--vinted-bg);
  border-color: var(--vinted-teal);
  box-shadow: 0 0 0 0.25rem rgba(50, 118, 128, 0.25);
}

.form-control:focus {
  box-shadow: none;
}

/* Vinted-style white header */
.navbar-vinted {
  --bs-navbar-padding-y: 0.25rem;
  background-color: var(--vinted-bg);
  border-bottom: 1px solid var(--vinted-border);
}

.navbar-vinted .navbar-brand {
  color: var(--vinted-teal);
  font-weight: 700;
  font-size: 1.5rem;
  letter-spacing: -0.02em;
}

.navbar-vinted .navbar-brand:hover {
  color: var(--vinted-teal-dark);
}

.navbar-vinted .nav-link {
  color: var(--vinted-teal);
  font-weight: 500;
}

.navbar-vinted .nav-link:hover,
.navbar-vinted .nav-link.active {
  color: var(--vinted-teal-darker);
}

/* Brand logo (pure CSS): gradient app-icon mark + "Savvy div" wordmark */
.brand-logo {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--vinted-font-display);
}

.brand-logo-text {
  text-align: left;
}

.brand-logo-mark {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--vinted-gradient);
  color: var(--vinted-bg);
  font-weight: 800;
  font-style: italic;
  font-size: 1rem;
  letter-spacing: 0.02em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.brand-logo-name {
  display: block;
  font-size: 1.15rem;
  line-height: 1.1;
}

/* Large variant: auth (devise) screens only */
.brand-logo-lg .brand-logo-name {
  font-size: 1.75rem;
}

.brand-logo-savvy {
  color: var(--vinted-dark-green);
  font-weight: 800;
  font-style: italic;
  letter-spacing: -0.02em;
}

.brand-logo-div {
  color: rgba(50, 118, 128, 0.55);
  font-weight: 500;
}

.brand-logo-vinted {
  display: block;
  color: var(--vinted-ink);
  /* font-style: italic; */
  font-weight: 600;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.3em;
  line-height: 1.2;
}

/* Custom select: input-matched trigger + animated listbox */
.custom-select-field {
  position: relative;
}

.custom-select-trigger {
  width: 100%;
  min-height: 3.625rem; /* match floating-label inputs */
  text-align: left;
  background-color: var(--vinted-field);
  border: 1px solid transparent;
  border-radius: var(--bs-border-radius);
  padding: 0.5rem 2.25rem 0.5rem 0.75rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.1rem;
  font-family: inherit;
}

.custom-select-trigger:focus-visible {
  outline: none;
  border-color: var(--vinted-teal);
  box-shadow: 0 0 0 0.25rem rgba(50, 118, 128, 0.25);
}

.custom-select-label {
  font-size: 0.8rem;
  color: var(--vinted-muted);
  line-height: 1;
}

.custom-select-value {
  color: var(--vinted-ink);
  line-height: 1.25;
}

.custom-select-chevron {
  position: absolute;
  right: 0.85rem;
  top: 50%;
  margin-top: -7px;
  font-size: 0.875rem;
  line-height: 1;
  color: var(--vinted-muted);
  transition: transform 0.18s ease;
}

.custom-select-field.open .custom-select-chevron {
  transform: rotate(180deg);
}

.custom-select-menu {
  position: absolute;
  top: calc(100% + 0.25rem);
  left: 0;
  right: 0;
  z-index: 1050;
  margin: 0;
  padding: 0.4rem;
  list-style: none;
  background-color: var(--vinted-bg);
  border-radius: var(--bs-border-radius);
  box-shadow: 0 10px 30px rgba(23, 23, 23, 0.14);
  opacity: 0;
  transform: translateY(-0.35rem) scale(0.98);
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.custom-select-field.open .custom-select-menu {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.custom-select-option {
  padding: 0.45rem 0.65rem;
  border-radius: 0.35rem;
  cursor: pointer;
}

.custom-select-option:hover,
.custom-select-option.active {
  background-color: var(--vinted-teal-tint);
}

.custom-select-option[aria-selected="true"] {
  color: var(--vinted-teal);
  font-weight: 600;
}

/* Multi-pick selects: long option lists scroll, picks get a check, and the
   empty state reads as a placeholder */
.custom-select-field[data-multi] .custom-select-menu {
  max-height: 16rem;
  overflow-y: auto;
}

.custom-select-field[data-multi] .custom-select-option[aria-selected="true"]::after {
  content: "✓";
  float: right;
  font-weight: 700;
}

.custom-select-value.custom-select-placeholder {
  color: var(--vinted-muted);
}

/* Combobox: the visible input wears the select-trigger look; the label
   floats above it inside the same field box */
.combo-select-field {
  background-color: var(--vinted-field);
  border: 1px solid transparent;
  border-radius: var(--bs-border-radius);
  min-height: 3.625rem;
  padding: 0.5rem 2.25rem 0.5rem 0.75rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.1rem;
}

.combo-select-field:focus-within {
  border-color: var(--vinted-teal);
  box-shadow: 0 0 0 0.25rem rgba(50, 118, 128, 0.25);
}

.combo-select-input {
  border: none;
  background: transparent;
  padding: 0;
  font-family: inherit;
  font-size: 1rem;
  color: var(--vinted-ink);
  line-height: 1.25;
}

.combo-select-input:focus {
  outline: none;
}

.combo-select-field .custom-select-menu {
  max-height: 16rem;
  overflow-y: auto;
}

@media (prefers-reduced-motion: reduce) {
  .custom-select-menu,
  .custom-select-chevron {
    transition: none;
  }
}

/* Bootstrap dropdowns share the select-menu entry animation. Standalone
   scale/translate properties compose with Popper's inline transform. */
@keyframes dropdown-in {
  from {
    opacity: 0;
    translate: 0 -0.35rem;
    scale: 0.98;
  }
  to {
    opacity: 1;
    translate: 0 0;
    scale: 1;
  }
}

.dropdown-menu {
  /* Bootstrap's active item defaults to blue-on-white — retint to brand */
  --bs-dropdown-link-active-bg: rgba(50, 118, 128, 0.14);
  --bs-dropdown-link-active-color: var(--vinted-ink);
}

.dropdown-menu.show {
  transform-origin: top;
  animation: dropdown-in 0.18s ease;
}

@media (prefers-reduced-motion: reduce) {
  .dropdown-menu.show {
    animation: none;
  }
}

/* Confirmation dialog icon badge: variant-tinted circle */
.confirm-dialog-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.confirm-dialog-icon .bi {
  font-size: 1.375rem;
  line-height: 1;
}

.nav-account-toggle .bi {
  font-size: 1.625rem;
  line-height: 1;
}

.confirm-dialog-icon-primary {
  color: var(--vinted-teal);
  background-color: rgba(50, 118, 128, 0.15);
}

.confirm-dialog-icon-danger {
  color: #dc3545;
  background-color: rgba(220, 53, 69, 0.15);
}

/* Account dropdown trigger in the navbar */
.nav-account-toggle {
  color: var(--vinted-muted);
  line-height: 1;
}

.nav-account-toggle:hover,
.nav-account-toggle[aria-expanded="true"] {
  color: var(--vinted-teal);
}

/* Modal entry: scale up from slightly smaller with a fade and a small drop
   (replaces Bootstrap's long top-to-bottom slide) */
.modal.fade .modal-dialog {
  transform: scale(0.92) translateY(-0.75rem);
  transition: transform 0.25s ease-out;
}

.modal.show .modal-dialog {
  transform: scale(1) translateY(0);
}

@media (prefers-reduced-motion: reduce) {
  .modal.fade .modal-dialog {
    transform: none;
    transition: none;
  }
}

/* Flatpickr calendar in brand colors */
.flatpickr-day.selected,
.flatpickr-day.selected:hover,
.flatpickr-day.startRange,
.flatpickr-day.endRange {
  background: var(--vinted-teal);
  border-color: var(--vinted-teal);
}

.flatpickr-day.selected:focus,
.flatpickr-day.today.selected {
  background: var(--vinted-teal-dark);
  border-color: var(--vinted-teal-dark);
}

.flatpickr-day.today {
  border-color: var(--vinted-teal);
}

.flatpickr-day:hover {
  background: var(--vinted-teal-tint);
  border-color: var(--vinted-teal-tint);
}

/* Composer dropzone */
.dropzone {
  border: 2px dashed var(--vinted-border);
  background-color: var(--vinted-field);
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.dropzone-active {
  border-color: var(--vinted-teal);
  background-color: var(--vinted-teal-tint);
}

.dropzone-preview img {
  width: 100px;
  height: 100px;
  object-fit: cover;
}

.reorder-tile {
  cursor: grab;
}

/* Listing cards: compact — square cover, tight body, kebab actions */
.listing-card-thumb {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  display: block;
}

.listing-card-thumb-link {
  display: block;
}

.listing-card-body {
  padding: 0.6rem 0.75rem;
}

.listing-card-title {
  color: var(--vinted-ink);
  font-weight: 600;
  font-size: 0.9375rem;
  text-decoration: none;
}

.listing-card-title:hover {
  color: var(--vinted-teal-dark);
}

.listing-card-price {
  font-weight: 600;
  font-size: 0.875rem;
}

.listing-card-placeholder i {
  font-size: 1.5rem;
}

/* While a thumb is still downloading, show the field tint instead of a
   white flash. Applies to every image slot in cards, tiles, and pickers. */
.listing-card-thumb,
.media-card-thumb,
.media-pick-thumb,
.photo-tile-thumb {
  background-color: var(--vinted-field);
}

.listing-card-placeholder {
  background-color: var(--vinted-field);
}

/* Toast notifications: subtle slide-down + fade entry */
.toast-container {
  z-index: 1090;
}

.vinted-toast {
  animation: vinted-toast-in 0.35s ease-out both;
}

@keyframes vinted-toast-in {
  from {
    opacity: 0;
    transform: translateY(-0.75rem);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .vinted-toast {
    animation: none;
  }
}

/* Segmented toggle (Manual | AI Assist) */
.segmented-toggle {
  display: inline-flex;
  gap: 0.25rem;
  padding: 0.25rem;
  background-color: var(--vinted-field);
  border-radius: 999px;
}

.segmented-toggle-option {
  border: 0;
  background: transparent;
  color: var(--vinted-muted);
  font-family: var(--vinted-font-display);
  font-weight: 600;
  font-size: 0.875rem;
  padding: 0.375rem 1rem;
  border-radius: 999px;
  white-space: nowrap;
  transition: background-color 180ms ease, color 180ms ease, box-shadow 180ms ease;
}

.segmented-toggle-option:hover {
  color: var(--vinted-ink);
}

.segmented-toggle-option.active {
  background-color: var(--vinted-bg);
  color: var(--vinted-teal-dark);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

/* Composer meta: timestamps under the page title */
.composer-meta {
  font-size: 0.8125rem;
}

/* Chat panel */
.chat-messages {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  overflow-y: auto;
  min-height: 16rem;
  max-height: 55vh;
  padding-right: 0.25rem;
}

.chat-message {
  display: flex;
}

.chat-message-user {
  justify-content: flex-end;
}

.chat-bubble {
  max-width: 85%;
  padding: 0.5rem 0.75rem;
  border-radius: 1rem;
  font-size: 0.9375rem;
  white-space: pre-line;
  overflow-wrap: anywhere;
}

.chat-message-user .chat-bubble {
  background-color: var(--vinted-teal);
  color: #fff;
  border-bottom-right-radius: 0.25rem;
}

.chat-message-assistant .chat-bubble {
  background-color: var(--vinted-field);
  color: var(--vinted-ink);
  border-bottom-left-radius: 0.25rem;
}

/* Typing indicator: assistant-style bubble with three pulsing dots */
.chat-typing-bubble {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.7rem 0.85rem;
  border-radius: 1rem;
  border-bottom-left-radius: 0.25rem;
  background-color: var(--vinted-field);
}

.chat-typing-dot {
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 50%;
  background-color: var(--vinted-muted);
  animation: chat-typing 1.2s ease-in-out infinite;
}

.chat-typing-dot:nth-child(2) {
  animation-delay: 0.15s;
}

.chat-typing-dot:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes chat-typing {
  0%, 60%, 100% {
    transform: translateY(0);
    opacity: 0.45;
  }
  30% {
    transform: translateY(-0.28rem);
    opacity: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .chat-typing-dot {
    animation: none;
  }
}

.chat-message-error .chat-bubble {
  background-color: #fdecec;
  color: #b02a37;
}

.chat-input {
  resize: none;
}

.chat-attach-label {
  cursor: pointer;
}

/* Grouped options in the custom select */
.custom-select-group {
  padding: 0.5rem 0.875rem 0.25rem;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--vinted-muted);
}

/* AI fill: teal flash on each field the assistant just wrote */
.composer-fill-flash {
  animation: composer-fill-flash 0.9s ease-out;
}

@keyframes composer-fill-flash {
  0% {
    box-shadow: 0 0 0 3px rgba(50, 118, 128, 0.35);
    background-color: var(--vinted-teal-tint);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(50, 118, 128, 0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .composer-fill-flash {
    animation: none;
  }
}

/* App shell: navbar pinned, sidebar left, main scrolls — the body never does */
html,
body.app-shell {
  height: 100%;
}

body.app-shell {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.app-shell .navbar-vinted {
  flex: 0 0 auto;
}

.app-body {
  flex: 1 1 auto;
  display: flex;
  min-height: 0;
}

.app-main {
  flex: 1 1 auto;
  min-width: 0;
  overflow-y: auto;
  /* Never let painted overflow become page-level horizontal scroll (iOS
     Safari); wide tables scroll inside their own .table-responsive. */
  overflow-x: hidden;
  padding: 1.5rem;
}

@media (max-width: 575.98px) {
  .app-main {
    padding: 1rem;
  }
}

/* Flex children default to min-width auto and refuse to shrink — this is
   what lets text-truncate actually truncate (used by the KPI cards). */
.min-width-0 {
  min-width: 0;
}

/* Sidebar: icons + labels, collapsible to an icon rail */
.app-sidebar {
  flex: 0 0 auto;
  width: 13.75rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 0.625rem;
  background-color: var(--vinted-bg);
  border-right: 1px solid var(--vinted-border);
  overflow: hidden;
  transition: width 180ms ease;
}

.app-sidebar.collapsed {
  width: 4.25rem;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  padding: 0.55rem 0.85rem;
  border: 0;
  border-radius: 0.5rem;
  background: transparent;
  color: var(--vinted-muted);
  text-decoration: none;
  text-align: left;
  font-family: var(--vinted-font-display);
  font-weight: 600;
  font-size: 0.9375rem;
  white-space: nowrap;
  transition: background-color 180ms ease, color 180ms ease;
}

.sidebar-link:hover {
  color: var(--vinted-ink);
  background-color: var(--vinted-field);
}

.sidebar-link.active {
  color: var(--vinted-teal-dark);
  background-color: var(--vinted-teal-tint);
}

.sidebar-icon {
  flex: 0 0 auto;
  font-size: 1.125rem;
  line-height: 1;
}

/* Gradient primary action pinned above the nav items */
.sidebar-new-listing {
  background: var(--vinted-gradient-bright);
  color: var(--vinted-bg);
  margin-bottom: 0.75rem;
}

.sidebar-new-listing:hover,
.sidebar-new-listing:focus-visible {
  color: var(--vinted-bg);
  filter: brightness(1.07);
}

/* Labels fade out first on collapse, fade back in after the rail widens */
.sidebar-label {
  opacity: 1;
  transition: opacity 140ms ease 60ms;
}

.app-sidebar.collapsed .sidebar-label {
  opacity: 0;
  transition-delay: 0ms;
}

.sidebar-chevron {
  transition: transform 180ms ease;
}

.app-sidebar.collapsed .sidebar-chevron {
  transform: rotate(180deg);
}

/* Below lg the sidebar is always the icon rail so navigation never vanishes */
@media (max-width: 991.98px) {
  .app-sidebar,
  .app-sidebar.collapsed {
    width: 4.25rem;
  }

  .app-sidebar .sidebar-label {
    opacity: 0;
  }

  .sidebar-collapse-toggle {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .app-sidebar,
  .sidebar-label,
  .sidebar-chevron {
    transition: none;
  }
}

/* Viewport-height composer: the shell's content column hands its height to
   the composer, whose split row scrolls chat and form independently on lg+.
   Below lg everything falls back to natural stacked flow. */
.app-main {
  display: flex;
  flex-direction: column;
}

.app-main > * {
  flex: 0 0 auto;
}

.app-main .listing-composer {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

@media (min-width: 992px) {
  .listing-composer .composer-split {
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
  }

  /* The columns never scroll themselves — the message list and the form's
     scroll region are the only scroll surfaces, so the chat bar and the
     action bar stay anchored. */
  .composer-split > .composer-chat-col,
  .composer-split > .composer-form-col {
    height: 100%;
    min-height: 0;
    overflow: hidden;
  }

  /* Inside the bounded panel, flex sizing replaces the viewport caps */
  .composer-split .chat-messages {
    min-height: 0;
    max-height: none;
  }

  .composer-form-scroll {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
  }
}

/* card-body's automatic minimum height would otherwise include the full
   message list, letting the card outgrow its bounded panel */
.chat-panel .card-body {
  min-height: 0;
}

/* Form shell: scrollable content above a pinned action bar */
.composer-form-shell {
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%;
}

.composer-actions {
  background: #ffffff;
  flex: 0 0 auto;
  padding: 0.75rem;
  margin-top: 0;
  border: 1px solid var(--vinted-border);
  border-radius: 0.875rem;
}

/* Compact select: same control, action-bar sized */
.custom-select-compact .custom-select-trigger {
  min-height: 0;
  min-width: 8.5rem;
  padding: 0.375rem 2rem 0.375rem 0.75rem;
}

.custom-select-compact .custom-select-value {
  font-size: 0.875rem;
}

/* Pinned bars sit at the bottom of clipped columns — their menus open upward
   so options never fall into the hidden overflow */
.composer-actions .custom-select-menu,
.chat-form .custom-select-menu {
  top: auto;
  bottom: calc(100% + 0.25rem);
  transform: translateY(0.35rem) scale(0.98);
}

.composer-actions .custom-select-field.open .custom-select-menu,
.chat-form .custom-select-field.open .custom-select-menu {
  transform: translateY(0) scale(1);
}

.chat-form {
  padding: 0.75rem;
  margin-top: 0;
  border: 1px solid var(--vinted-border);
  border-radius: 0.875rem;
}

/* Soft status badges: text color over the same color at low opacity, matching
   the soft outline buttons */
.status-badge {
  font-weight: 600;
}

.status-badge-draft {
  color: var(--vinted-muted);
  background-color: rgba(92, 101, 102, 0.14);
}

.status-badge-queued {
  color: #055160;
  background-color: rgba(5, 81, 96, 0.12);
}

.status-badge-published {
  color: var(--vinted-teal-dark);
  background-color: rgba(50, 118, 128, 0.14);
}

.status-badge-sold {
  color: #59359a;
  background-color: rgba(111, 66, 193, 0.14);
}

/* Subtle separator between the heading row and the composer content */
.listing-composer .composer-split {
  padding-top: 0.25rem;
}

/* Streaming reply: a soft caret pulses while tokens arrive */
.chat-message-streaming .chat-bubble::after {
  content: "▍";
  margin-left: 0.1rem;
  animation: chat-caret 1s steps(1) infinite;
}

@keyframes chat-caret {
  50% {
    opacity: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .chat-message-streaming .chat-bubble::after {
    animation: none;
  }
}

/* Back chevron beside the composer title */
.composer-back {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.35rem 0.45rem;
  line-height: 1;
}

/* Media library */
.media-card {
  background-color: var(--vinted-bg);
  border: 1px solid var(--vinted-border);
  border-radius: var(--bs-border-radius);
  overflow: hidden;
  transition: box-shadow 180ms ease;
}

.media-card:hover {
  box-shadow: 0 4px 14px rgba(23, 23, 23, 0.1);
}

.media-card-thumb-link {
  display: block;
}

.media-card-thumb {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  display: block;
}

.media-card-body {
  padding: 0.5rem 0.625rem;
}

.media-card-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--vinted-ink);
}

.media-card-tags .badge {
  font-size: 0.6875rem;
}

/* Library picker inside the chat */
.media-pick {
  display: block;
  border: 2px solid transparent;
  border-radius: var(--bs-border-radius);
  overflow: hidden;
  cursor: pointer;
  transition: border-color 120ms ease, box-shadow 120ms ease;
}

.media-pick-thumb {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  display: block;
}

.btn-check:checked + .media-pick {
  border-color: var(--vinted-teal);
  box-shadow: 0 0 0 0.2rem rgba(50, 118, 128, 0.25);
}

/* Filter rail: sticky card of stacked search + filter selects */
.filter-rail {
  position: sticky;
  top: 1rem;
}

.filter-select-label {
  font-weight: 600;
}

.filter-select-trigger {
  display: flex;
  align-items: center;
}

.filter-select .tag-select-menu {
  left: 0;
  right: 0;
}

/* Tag filter dropdown (media library + pickers) */
.tag-select {
  position: relative;
}

.tag-select-trigger {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background-color: var(--vinted-field);
  border: 1px solid transparent;
  border-radius: var(--bs-border-radius);
  padding: 0.45rem 0.75rem;
  font-family: inherit;
  color: var(--vinted-ink);
  white-space: nowrap;
}

.tag-select-trigger:focus-visible {
  outline: none;
  border-color: var(--vinted-teal);
  box-shadow: 0 0 0 0.25rem rgba(50, 118, 128, 0.25);
}

.tag-select-chevron {
  font-size: 0.8rem;
  color: var(--vinted-muted);
  transition: transform 0.18s ease;
}

.tag-select.open .tag-select-chevron {
  transform: rotate(180deg);
}

.tag-select-menu {
  position: absolute;
  top: calc(100% + 0.25rem);
  right: 0;
  z-index: 1060;
  min-width: 220px;
  padding: 0.4rem;
  background-color: var(--vinted-bg);
  border-radius: var(--bs-border-radius);
  box-shadow: 0 10px 30px rgba(23, 23, 23, 0.14);
  opacity: 0;
  transform: translateY(-0.35rem) scale(0.98);
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.tag-select.open .tag-select-menu {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.tag-select-search {
  margin-bottom: 0.4rem;
}

.tag-select-options {
  max-height: 220px;
  overflow-y: auto;
}

.tag-select-option,
.tag-suggest-option {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.45rem 0.65rem;
  border: 0;
  background: none;
  border-radius: 0.35rem;
  cursor: pointer;
  color: var(--vinted-ink);
}

.tag-select-option:hover,
.tag-suggest-option:hover {
  background-color: var(--vinted-teal-tint);
}

.tag-select-option[aria-selected="true"] {
  color: var(--vinted-teal);
  font-weight: 600;
}

/* Existing-tag suggestions under the image editor's tags field */
.tag-suggest-menu {
  position: absolute;
  left: 0;
  right: 0;
  z-index: 1060;
  margin-top: 0.25rem;
  padding: 0.4rem;
  background-color: var(--vinted-bg);
  border-radius: var(--bs-border-radius);
  box-shadow: 0 10px 30px rgba(23, 23, 23, 0.14);
  max-height: 180px;
  overflow-y: auto;
}

/* Picker modal header: search and tag filter share one height */
.media-picker-search {
  max-width: 200px;
  height: 2.5rem;
}

.modal-header .tag-select-trigger {
  height: 2.5rem;
}

/* Selected-pick check badge */
.media-pick {
  position: relative;
}

.media-pick-check {
  position: absolute;
  top: 0.4rem;
  right: 0.4rem;
  display: none;
  color: var(--vinted-teal);
  background-color: #fff;
  border-radius: 50%;
  box-shadow: 0 0 0 2px #fff;
  font-size: 1.25rem;
  line-height: 1;
}

.btn-check:checked + .media-pick .media-pick-check {
  display: block;
}

@media (prefers-reduced-motion: reduce) {
  .tag-select-menu,
  .tag-select-chevron {
    transition: none;
  }
}

/* Media card actions kebab */
.media-card-menu {
  color: var(--vinted-muted);
  line-height: 1;
}

.media-card-menu:hover {
  color: var(--vinted-ink);
}

.media-picker-clear,
.media-search-clear {
  text-decoration: none;
}

/* Tiles hold their box while the image downloads — no collapsed slots */
.photo-tile-thumb {
  width: 100px;
  height: 100px;
  object-fit: cover;
}

.media-edit-thumb {
  width: 96px;
  height: 96px;
  object-fit: cover;
  background-color: var(--vinted-field);
}

/* Red X on photo tiles — mirrors the picker's selected-check badge */
.photo-tile-remove {
  position: absolute;
  top: -0.4rem;
  right: -0.4rem;
  padding: 0;
  border: 0;
  background-color: #fff;
  border-radius: 50%;
  box-shadow: 0 0 0 2px #fff;
  color: var(--bs-danger);
  font-size: 1.15rem;
  line-height: 1;
  cursor: pointer;
}

.photo-tile-remove:hover {
  color: #a02532;
}

/* Inline-editable listing title */
.inline-title-display {
  cursor: text;
  border-radius: 0.35rem;
  padding: 0.1rem 0.35rem;
  margin-left: -0.35rem;
}

.inline-title-display:hover,
.inline-title-display:focus-visible {
  background-color: var(--vinted-field);
  outline: none;
}

.inline-title-pencil {
  font-size: 0.7em;
  margin-left: 0.3rem;
  color: var(--vinted-muted);
  opacity: 0;
  transition: opacity 0.15s ease;
}

.inline-title-display:hover .inline-title-pencil,
.inline-title-display:focus-visible .inline-title-pencil {
  opacity: 0.7;
}

.inline-title-placeholder {
  color: var(--vinted-muted);
}

/* While editing, take the full header width so long titles never clip */
.inline-title.editing {
  flex: 1 1 auto;
}

.inline-title-editor {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.inline-title-field {
  font-family: var(--vinted-font-display);
  font-size: calc(1.275rem + 0.3vw);
  font-weight: 500;
  padding: 0.1rem 0.35rem;
  margin-left: -0.35rem;
  flex: 1 1 auto;
  width: 100%;
}

.inline-title-save {
  padding: 0;
  border: 0;
  background: none;
  color: var(--vinted-teal);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
}

.inline-title-save:hover {
  color: var(--vinted-teal-dark);
}

/* Thumbnails of photos shared in the chat, above the input */
.chat-attach-tray {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.chat-attach-tile {
  position: relative;
}

.chat-attach-thumb {
  width: 52px;
  height: 52px;
  object-fit: cover;
  display: block;
  border-radius: 0.5rem;
  border: 1px solid var(--vinted-border);
  background-color: var(--vinted-field);
}

.chat-attach-tile .photo-tile-remove {
  font-size: 1rem;
  top: -0.35rem;
  right: -0.35rem;
}

/* Dashboard: KPI row + tables + command center */
.kpi-card {
  border: 1px solid var(--vinted-border);
  color: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

a.kpi-card:hover {
  border-color: var(--vinted-teal);
  box-shadow: 0 2px 10px rgba(50, 118, 128, 0.1);
}

/* The actionable stage of the pipeline (ready to publish) gets an accent */
.kpi-card-accent {
  border-color: var(--vinted-teal);
  background-color: var(--vinted-teal-tint);
}

.kpi-card-accent .kpi-icon {
  background-color: var(--vinted-teal);
  color: #fff;
}

.kpi-icon {
  width: 2.75rem;
  height: 2.75rem;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.75rem;
  background-color: var(--vinted-teal-tint);
  color: var(--vinted-teal);
  font-size: 1.25rem;
}

.kpi-value {
  font-family: var(--vinted-font-display);
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.1;
}

.kpi-label {
  color: var(--vinted-muted);
  font-size: 0.85rem;
  font-weight: 600;
}

.kpi-hint {
  color: var(--vinted-muted);
  font-size: 0.75rem;
}

.dashboard-table th {
  color: var(--vinted-muted);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom-color: var(--vinted-border);
}

.dashboard-table td {
  border-bottom-color: var(--vinted-field);
}

.dashboard-table tr:last-child td {
  border-bottom: 0;
}

.dashboard-thumb-cell {
  width: 3.25rem;
}

.dashboard-thumb {
  width: 2.75rem;
  height: 2.75rem;
  object-fit: cover;
  border-radius: 0.5rem;
  background-color: var(--vinted-field);
  display: block;
}

.dashboard-thumb-empty {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--vinted-muted);
}

.dashboard-title-cell {
  max-width: 16rem;
}

.dashboard-title-link {
  color: var(--vinted-ink);
  font-weight: 600;
  text-decoration: none;
}

.dashboard-title-link:hover {
  color: var(--vinted-teal-dark);
}

.dashboard-activity-icon-cell {
  width: 3.25rem;
}

.dashboard-activity-icon {
  width: 2.25rem;
  height: 2.25rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background-color: var(--vinted-field);
  color: var(--vinted-muted);
}

.dashboard-activity-published {
  background-color: var(--vinted-teal-tint);
  color: var(--vinted-teal);
}

.dashboard-activity-sold {
  background-color: rgba(111, 66, 193, 0.14);
  color: #59359a;
}

.dashboard-activity-price_changed {
  background-color: rgba(153, 116, 4, 0.12);
  color: #997404;
}


/* Markdown-rendered assistant bubbles: HTML flow instead of pre-line text */
.chat-bubble-markdown {
  white-space: normal;
}

.chat-bubble-markdown p,
.chat-bubble-markdown ul,
.chat-bubble-markdown ol,
.chat-bubble-markdown pre,
.chat-bubble-markdown blockquote {
  margin-bottom: 0.5rem;
}

.chat-bubble-markdown > :last-child {
  margin-bottom: 0;
}

.chat-bubble-markdown ul,
.chat-bubble-markdown ol {
  padding-left: 1.25rem;
}

.chat-bubble-markdown h1,
.chat-bubble-markdown h2,
.chat-bubble-markdown h3,
.chat-bubble-markdown h4,
.chat-bubble-markdown h5,
.chat-bubble-markdown h6 {
  font-size: 1rem;
  font-weight: 700;
  margin: 0.5rem 0 0.25rem;
}

.chat-bubble-markdown code {
  background-color: rgba(23, 23, 23, 0.07);
  padding: 0.1rem 0.3rem;
  border-radius: 0.3rem;
  font-size: 0.85em;
  color: inherit;
}

.chat-bubble-markdown pre {
  background-color: rgba(23, 23, 23, 0.07);
  padding: 0.5rem 0.6rem;
  border-radius: 0.5rem;
  overflow-x: auto;
}

.chat-bubble-markdown pre code {
  background: none;
  padding: 0;
}

.chat-bubble-markdown blockquote {
  border-left: 3px solid var(--vinted-border);
  padding-left: 0.6rem;
  color: var(--vinted-muted);
}

/* Markdown inside the teal user bubble: white-on-teal variants */
.chat-message-user .chat-bubble-markdown code,
.chat-message-user .chat-bubble-markdown pre {
  background-color: rgba(255, 255, 255, 0.22);
  color: #fff;
}

.chat-message-user .chat-bubble-markdown a {
  color: #fff;
  text-decoration: underline;
}

.chat-message-user .chat-bubble-markdown blockquote {
  border-left-color: rgba(255, 255, 255, 0.45);
  color: rgba(255, 255, 255, 0.9);
}

/* Pagination: retint Bootstrap's compiled blues to the brand teal. The
   active page uses the soft btn-outline-primary treatment. */
.pagination {
  --bs-pagination-color: var(--vinted-teal);
  --bs-pagination-hover-color: var(--vinted-teal-dark);
  --bs-pagination-focus-color: var(--vinted-teal-dark);
  --bs-pagination-active-color: var(--vinted-teal);
  --bs-pagination-active-bg: rgba(50, 118, 128, 0.12);
  --bs-pagination-active-border-color: var(--vinted-border);
  --bs-pagination-disabled-bg: #f8f9fa;
  --bs-pagination-focus-box-shadow: 0 0 0 0.25rem rgba(50, 118, 128, 0.25);
}

/* Prev/next render pagy's "<" ">" strings — swap them for the brand
   chevron icons (text hidden via font-size, aria-labels unaffected).
   Flex-centered with a 1.5rem icon line box so the arrow cells match the
   number cells' height exactly. */
.pagy-bootstrap .page-item.previous .page-link,
.pagy-bootstrap .page-item.next .page-link {
  font-size: 0;
  display: flex;
  align-items: center;
}

.pagy-bootstrap .page-item.previous .page-link::before,
.pagy-bootstrap .page-item.next .page-link::before {
  font-family: "bootstrap-icons";
  font-size: 1rem;
  line-height: 1.5rem;
}

.pagy-bootstrap .page-item.previous .page-link::before {
  content: "\F284";
}

.pagy-bootstrap .page-item.next .page-link::before {
  content: "\F285";
}

.command-center-meta {
  min-height: 1.25rem;
}

.command-center-queue {
  margin: 0;
}

.command-center-queue-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.4rem;
  border-radius: 0.5rem;
  color: var(--vinted-ink);
}

.command-center-queue-item:hover {
  background-color: var(--vinted-teal-tint);
}

.command-center-queue-thumb {
  width: 2.25rem;
  height: 2.25rem;
  object-fit: cover;
  border-radius: 0.4rem;
  background-color: var(--vinted-field);
  flex-shrink: 0;
}

.command-center-queue-thumb-empty {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--vinted-muted);
}

.command-center-queue-title {
  flex: 1;
  min-width: 0;
  font-weight: 600;
  font-size: 0.9rem;
}

.command-center-queue-price {
  color: var(--vinted-muted);
  font-size: 0.8rem;
  flex-shrink: 0;
}
