/*
 * DAVR 2026 — contextual category controls + YuLa-style product layout.
 * Visual-only except for native-event category control JS.
 * Keep React-owned DOM and all business interactions untouched.
 */
@media (min-width: 1024px) {
  /* Compact center search is moved slightly toward the original DAVR logo. */
  html.davr-desktop-browser-layout #root header > .davr-header-search {
    left: calc(50% - 34px) !important;
  }
  /* The real notification button stays mounted in the React header, now
     visible between city/language and Post rather than in the left sidebar. */
  html.davr-desktop-browser-layout #root header .header-actions > #davr-notification-button {
    display: inline-flex !important;
    visibility: visible !important;
    align-items: center;
    justify-content: center;
    order: 3;
    flex: 0 0 42px;
    width: 42px;
    height: 42px;
    padding: 0;
    margin: 0;
    border: 1px solid #c6dbed !important;
    border-radius: 12px !important;
    background: #f4f9ff !important;
    color: #052659 !important;
    box-shadow: 0 3px 12px rgba(5,38,89,.055) !important;
  }
  html.davr-desktop-browser-layout #root header .header-actions > #davr-notification-button:hover,
  html.davr-desktop-browser-layout #root header .header-actions > #davr-notification-button[aria-expanded="true"] {
    border-color: #7DA0CA !important;
    background: #e4f0ff !important;
  }
  html.davr-desktop-browser-layout #root header .header-actions > #davr-notification-button:focus-visible {
    outline: 3px solid #7DA0CA;
    outline-offset: 2px;
  }
  html.davr-desktop-browser-layout #root header .header-actions > .city-picker {
    order: 1;
  }
  html.davr-desktop-browser-layout #root header .header-actions > .picker {
    order: 2;
  }
  html.davr-desktop-browser-layout #root header .header-actions > button.primary {
    order: 4;
  }
  html.davr-desktop-browser-layout .davr-notification-panel {
    left: auto !important;
    right: clamp(110px, 12vw, 250px) !important;
    top: calc(var(--davr-desktop-header-height, 64px) + 8px) !important;
    z-index: 85;
    max-width: min(440px, calc(100vw - 40px));
  }
  /* Category-only filter launcher is distinct from the global sidebar.
     Keep original React filter button mounted for action forwarding. */
  html.davr-desktop-browser-layout .davr-category-context-toolbar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 10px;
    min-height: 56px;
    padding: 8px 0 16px;
  }
  html.davr-desktop-browser-layout .davr-category-context-hint {
    margin-right: auto;
    color: #607b99;
    font-size: 13px;
    line-height: 1.4;
  }
  html.davr-desktop-browser-layout .davr-category-context-control {
    min-height: 41px;
    padding: 9px 16px;
    border: 1px solid #b7d2e8;
    border-radius: 12px;
    background: #fff;
    color: #052659;
    font: inherit;
    font-size: 13.5px;
    font-weight: 750;
    cursor: pointer;
  }
  html.davr-desktop-browser-layout .davr-category-context-control:hover {
    border-color: #5483B3;
    background: #e8f3ff;
  }
  html.davr-desktop-browser-layout .davr-category-context-control:focus-visible {
    outline: 3px solid #7DA0CA;
    outline-offset: 2px;
  }
  html.davr-desktop-browser-layout.davr-category-context-active .filter-modal {
    position: fixed !important;
    top: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    left: auto !important;
    transform: none !important;
    translate: none !important;
    margin: 0 !important;
    width: min(570px, calc(100vw - 20px)) !important;
    max-width: 570px !important;
    height: 100dvh !important;
    max-height: 100dvh !important;
    padding: 0 !important;
    border-radius: 25px 0 0 25px !important;
    background: #f0f7ff !important;
    box-shadow: -18px 0 65px rgba(2,16,36,.18) !important;
  }
  html.davr-desktop-browser-layout.davr-category-context-active .filter-modal .filter-sections {
    grid-template-columns: minmax(0,1fr) !important;
  }
  html.davr-desktop-browser-layout.davr-category-context-active .filter-modal .catalog-filters {
    max-height: calc(100dvh - 65px) !important;
    padding: 18px 20px 0 !important;
  }
}
/* Compact header grid must retain its breakpoint-specific placement. */
@media (min-width: 1024px) and (max-width: 1360px) {
  html.davr-desktop-browser-layout #root header > .davr-header-search {
    left: auto !important;
    transform: translateX(-12px) !important;
  }
}
@media (min-width: 1024px) and (max-width: 1110px) {
  html.davr-desktop-browser-layout #root header .header-actions > #davr-notification-button {
    flex-basis: 38px;
    width: 38px;
    height: 40px;
  }
}
/* Remove remaining green hearts from both regular cards and detail page. */
html.davr-desktop-browser-layout .listing-grid .card .photo button.hearted,
html.davr-mobile-layout .listing-grid .card .photo button.hearted,
html.davr-desktop-browser-layout .listing-grid .card .photo button[aria-pressed="true"],
html.davr-mobile-layout .listing-grid .card .photo button[aria-pressed="true"],
html.davr-desktop-browser-layout .detail-modal .detail-favorite-top[aria-pressed="true"],
html.davr-mobile-layout .detail-modal .detail-favorite-top[aria-pressed="true"] {
  color: #052659 !important;
  background: #deefff !important;
  border-color: #8db6db !important;
  box-shadow: 0 5px 20px rgba(5,38,89,.12) !important;
}
html.davr-desktop-browser-layout .listing-grid .card .photo button.hearted svg,
html.davr-mobile-layout .listing-grid .card .photo button.hearted svg,
html.davr-desktop-browser-layout .detail-modal .detail-favorite-top[aria-pressed="true"] svg,
html.davr-mobile-layout .detail-modal .detail-favorite-top[aria-pressed="true"] svg {
  fill: #5483B3 !important;
  stroke: #052659 !important;
}
html.davr-desktop-browser-layout .detail-modal .detail-contact-primary,
html.davr-mobile-layout .detail-modal .detail-contact-primary,
html.davr-desktop-browser-layout .detail-modal .detail-actions .primary.detail-action,
html.davr-mobile-layout .detail-modal .detail-actions .primary.detail-action {
  background: linear-gradient(135deg,#052659,#16447e) !important;
  color: #fff !important;
  border: 1px solid #052659 !important;
  text-shadow: none !important;
}
html.davr-desktop-browser-layout .detail-modal .detail-contact-primary :is(span,strong,svg),
html.davr-mobile-layout .detail-modal .detail-contact-primary :is(span,strong,svg),
html.davr-desktop-browser-layout .detail-modal .detail-actions .primary.detail-action :is(span,strong,svg),
html.davr-mobile-layout .detail-modal .detail-actions .primary.detail-action :is(span,strong,svg) {
  color: #fff !important;
  stroke: currentColor !important;
}
/* Category picker: blue-tinted panel instead of pure white, consistent
   buttons across the browsing and posting modes without changing IDs. */
html.davr-desktop-browser-layout #davr-desktop-category-dialog .davr-desktop-posting-card {
  border: 1px solid #bcd7ec !important;
  background: linear-gradient(155deg,#eff7ff,#dfedfc) !important;
  box-shadow: 0 29px 78px rgba(2,16,36,.27) !important;
}
html.davr-desktop-browser-layout #davr-desktop-category-dialog .davr-desktop-posting-topbar {
  background: #e8f3fe !important;
  border-bottom: 1px solid #bfd8ed !important;
}
html.davr-desktop-browser-layout #davr-desktop-category-dialog .davr-posting-search {
  background: #f6fbff !important;
  border-color: #c4ddef !important;
}
html.davr-desktop-browser-layout #davr-desktop-category-dialog .davr-posting-list {
  background: transparent !important;
}
html.davr-desktop-browser-layout #davr-desktop-category-dialog .davr-posting-row {
  min-height: 57px;
  margin: 3px 0;
  padding-inline: 12px !important;
  border: 1px solid #cbdff1 !important;
  border-radius: 12px !important;
  background: rgba(255,255,255,.80) !important;
  color: #052659 !important;
}
html.davr-desktop-browser-layout #davr-desktop-category-dialog .davr-posting-row:hover,
html.davr-desktop-browser-layout #davr-desktop-category-dialog .davr-desktop-category-shortcut:hover {
  border-color: #7DA0CA !important;
  background: #d8eafb !important;
}
html.davr-desktop-browser-layout #davr-desktop-category-dialog .davr-posting-row .davr-category-symbol {
  --davr-category-color: #052659;
  color: #052659 !important;
  background: #e1f0ff !important;
}
html.davr-desktop-browser-layout #davr-desktop-category-dialog .davr-posting-row b {
  color: #5483B3 !important;
}
html.davr-desktop-browser-layout #davr-desktop-category-dialog .davr-posting-row:focus-visible {
  outline: 3px solid #7DA0CA;
  outline-offset: 1px;
}
/* Desktop standalone listings: gallery left; seller and actual contact/review
   actions right. Details and description follow below across full page.
   display:contents keeps the React-owned nodes in-place for event delegation.
 */
@media (min-width: 1024px) {
  html.davr-desktop-browser-layout.davr-listing-standalone .detail-modal {
    background: linear-gradient(180deg,#eaf3fe,#f4f9ff) !important;
  }
  html.davr-desktop-browser-layout.davr-listing-standalone .detail-modal .detail-layout {
    display: grid !important;
    grid-template-columns: minmax(0,1.25fr) minmax(320px,.75fr) !important;
    grid-template-rows: repeat(11,auto) !important;
    gap: 12px 30px !important;
    align-items: start !important;
  }
  html.davr-desktop-browser-layout.davr-listing-standalone .detail-modal .detail-media-column,
  html.davr-desktop-browser-layout.davr-listing-standalone .detail-modal .detail-info {
    display: contents !important;
  }
  html.davr-desktop-browser-layout.davr-listing-standalone .detail-modal .detail-gallery-stage {
    grid-column: 1;
    grid-row: 1 / span 5;
    align-self: start;
    margin: 0 !important;
    background: #e9f2fc !important;
  }
  html.davr-desktop-browser-layout.davr-listing-standalone .detail-modal .detail-photo {
    min-height: 370px !important;
    max-height: 560px !important;
    aspect-ratio: 1.4 !important;
    object-fit: contain !important;
  }
  html.davr-desktop-browser-layout.davr-listing-standalone .detail-modal .detail-thumbnails {
    grid-column: 1;
    grid-row: 6;
    align-self: start;
  }
  html.davr-desktop-browser-layout.davr-listing-standalone .detail-modal .davr-photo-address {
    grid-column: 1;
    grid-row: 7;
    align-self: start;
    background: #e5f1ff !important;
  }
  html.davr-desktop-browser-layout.davr-listing-standalone .detail-modal .detail-info > .muted:first-child {
    grid-column: 2;
    grid-row: 1;
    min-width: 0;
    margin: 0;
  }
  html.davr-desktop-browser-layout.davr-listing-standalone .detail-modal .detail-info > h2 {
    grid-column: 2;
    grid-row: 2;
    margin: 0 !important;
    font-size: clamp(27px,2.1vw,36px) !important;
  }
  html.davr-desktop-browser-layout.davr-listing-standalone .detail-modal .detail-info > .detail-price {
    grid-column: 2;
    grid-row: 3;
    margin: 0 !important;
  }
  html.davr-desktop-browser-layout.davr-listing-standalone .detail-modal .detail-info > .muted:not(:first-child) {
    grid-column: 2;
    grid-row: 4;
  }
  html.davr-desktop-browser-layout.davr-listing-standalone .detail-modal .detail-info > .detail-favorite-top {
    position: static !important;
    grid-column: 2;
    grid-row: 1;
    justify-self: end;
    align-self: start;
    z-index: 2;
  }
  html.davr-desktop-browser-layout.davr-listing-standalone .detail-modal .detail-left-commerce {
    grid-column: 2;
    grid-row: 5 / span 3;
    align-self: start;
    min-width: 0;
    width: 100%;
    display: flex !important;
    gap: 12px !important;
    margin: 4px 0 0 !important;
  }
  html.davr-desktop-browser-layout.davr-listing-standalone .detail-modal .detail-left-commerce .seller {
    margin: 0 !important;
    padding: 17px 19px !important;
    border: 1px solid #bdd8ee !important;
    border-radius: 17px !important;
    background: #fff !important;
  }
  html.davr-desktop-browser-layout.davr-listing-standalone .detail-modal .detail-left-commerce .detail-actions {
    gap: 9px !important;
  }
  html.davr-desktop-browser-layout.davr-listing-standalone .detail-modal .detail-description-inline {
    grid-column: 1 / -1;
    grid-row: 8;
    width: 100%;
    min-width: 0;
    padding: 23px 25px !important;
    margin: 30px 0 0 !important;
    background: #e7f3ff !important;
    border: 1px solid #c8def0 !important;
    border-radius: 20px !important;
  }
  html.davr-desktop-browser-layout.davr-listing-standalone .detail-modal .detail-description-inline h3 {
    color: #052659 !important;
    font-size: 17px !important;
  }
  html.davr-desktop-browser-layout.davr-listing-standalone .detail-modal .detail-description-inline > p {
    color: #183650 !important;
  }
  html.davr-desktop-browser-layout.davr-listing-standalone .detail-modal .detail-info > .detail-section-title {
    grid-column: 1 / -1;
    grid-row: 9;
    margin: 23px 0 0 !important;
    color: #052659 !important;
    font-size: 20px !important;
  }
  html.davr-desktop-browser-layout.davr-listing-standalone .detail-modal .detail-info > .detail-specs {
    grid-column: 1 / -1;
    grid-row: 10;
    width: 100%;
    margin: 0 !important;
    padding: 8px 14px !important;
    background: #eaf4ff !important;
    border: 1px solid #c9deef !important;
    border-radius: 17px !important;
  }
  html.davr-desktop-browser-layout.davr-listing-standalone .detail-modal .detail-spec-row {
    padding: 12px 14px !important;
    border-bottom-color: #cbdcec !important;
  }
  html.davr-desktop-browser-layout.davr-listing-standalone .detail-modal .detail-info > .detail-sale-terms {
    grid-column: 1 / -1;
    grid-row: 11;
    margin: 10px 0 0 !important;
    padding: 18px 22px !important;
    background: #e7f3ff !important;
    border: 1px solid #c9deef !important;
    border-radius: 18px !important;
  }
  html.davr-desktop-browser-layout.davr-listing-standalone .detail-modal .detail-info > .detail-address {
    grid-column: 1;
    grid-row: 7;
  }
}
@media (min-width: 1024px) and (max-width: 1220px) {
  html.davr-desktop-browser-layout.davr-listing-standalone .detail-modal .detail-layout {
    grid-template-columns: minmax(0,1fr) minmax(310px,.9fr) !important;
    gap: 12px 21px !important;
  }
}
@media (max-width: 1023px) {
  .davr-category-context-toolbar { display: none !important; }
}
@media (prefers-reduced-motion: reduce) {
  .davr-category-context-control { transition: none !important; }
}


/* 2026-11-10: regression fixes verified against the DAVR screen recording.
   Keep the underlying React filters and notifications mounted: hide only the
   obsolete global entry points, never the category-only tools. */
@media (min-width: 1024px) {
  html.davr-desktop-browser-layout .davr-desktop-sidebar-nav button[data-action="filters"],
  html.davr-desktop-browser-layout .davr-desktop-sidebar-nav button[data-action="notifications"],
  html.davr-desktop-browser-layout #root header > .davr-desktop-filter-toggle,
  html.davr-desktop-browser-layout .catalog-discovery .search-filter-trigger {
    display: none !important;
  }
  /* A category is necessary before showing any filter controls. */
  html.davr-desktop-browser-layout:not(.davr-category-context-active)
    .catalog-discovery .filter-toolbar-button,
  html.davr-desktop-browser-layout:not(.davr-category-context-active)
    .catalog-discovery .category-results-toolbar {
    display: none !important;
  }
  html.davr-desktop-browser-layout:not(.davr-category-context-active)
    .davr-category-context-toolbar {
    display: none !important;
  }

  /* A card photograph must occupy the photo viewport, even before other
     photographs have loaded. Prevent a 50px image followed by 200px blank. */
  html.davr-desktop-browser-layout .listing-grid > .card .photo {
    position: relative !important;
    overflow: hidden !important;
    isolation: isolate;
  }
  html.davr-desktop-browser-layout .listing-grid > .card .photo > .image-link {
    position: absolute !important;
    inset: 0 !important;
    z-index: 0;
    display: block !important;
    width: 100% !important;
    height: 100% !important;
    min-width: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: inherit !important;
    background: #e9f2fa !important;
  }
  html.davr-desktop-browser-layout .listing-grid > .card .photo > .image-link > img {
    display: block !important;
    position: absolute !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    object-position: center !important;
  }
  html.davr-desktop-browser-layout .listing-grid > .card .photo > button:not(.image-link) {
    z-index: 2;
  }

  /* Original layout had a gallery spanning five rows, forcing the seller
     down to the bottom of the image and creating a giant empty right column.
     Keep all React-owned nodes, shrink the span, place seller right after
     city/title/price, and let description/specs flow below. */
  html.davr-desktop-browser-layout.davr-listing-standalone
    .detail-modal .detail-layout {
    grid-template-rows: none !important;
    grid-auto-rows: auto !important;
    align-content: start !important;
    row-gap: 14px !important;
  }
  html.davr-desktop-browser-layout.davr-listing-standalone
    .detail-modal .detail-gallery-stage {
    grid-column: 1 !important;
    grid-row: 1 / span 4 !important;
    align-self: start !important;
    min-width: 0 !important;
    min-height: 0 !important;
    height: auto !important;
    aspect-ratio: auto !important;
    display: grid !important;
    place-items: center;
    overflow: hidden;
  }
  html.davr-desktop-browser-layout.davr-listing-standalone
    .detail-modal .detail-photo {
    display: block !important;
    position: static !important;
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: 520px !important;
    aspect-ratio: auto !important;
    object-fit: contain !important;
    background: transparent !important;
  }
  html.davr-desktop-browser-layout.davr-listing-standalone
    .detail-modal .detail-left-commerce {
    grid-column: 2 !important;
    grid-row: 4 !important;
    align-self: start !important;
    margin: 0 !important;
    padding: 0 !important;
  }
  html.davr-desktop-browser-layout.davr-listing-standalone
    .detail-modal .detail-thumbnails {
    grid-column: 1 !important;
    grid-row: 5 !important;
    margin: 0 !important;
    align-self: start;
  }
  html.davr-desktop-browser-layout.davr-listing-standalone
    .detail-modal .davr-photo-address {
    grid-column: 1 !important;
    grid-row: 6 !important;
    margin: 0 !important;
  }
  html.davr-desktop-browser-layout.davr-listing-standalone
    .detail-modal .detail-description-inline {
    grid-row: 7 !important;
    margin-top: 12px !important;
  }
  html.davr-desktop-browser-layout.davr-listing-standalone
    .detail-modal .detail-info > .detail-section-title {
    grid-row: 8 !important;
    margin-top: 12px !important;
  }
  html.davr-desktop-browser-layout.davr-listing-standalone
    .detail-modal .detail-info > .detail-specs {
    grid-row: 9 !important;
  }
  html.davr-desktop-browser-layout.davr-listing-standalone
    .detail-modal .detail-info > .detail-sale-terms {
    grid-row: 10 !important;
  }
  html.davr-desktop-browser-layout.davr-listing-standalone
    .detail-modal .detail-info > .detail-address {
    grid-row: 6 !important;
  }
  /* Gallery controls must remain interactive on top of the photo. */
  html.davr-desktop-browser-layout.davr-listing-standalone
    .detail-modal .detail-gallery-stage > :is(.gallery-prev,.gallery-next,.gallery-counter) {
    z-index: 2;
  }
}

/* Notification icons, listing events, and confirmation controls: DAVR blue,
   not the old green. Keep error/critical events red for meaning. */
html.davr-desktop-browser-layout :is(
  .davr-notification-item-icon,
  .davr-notification-detail-icon,
  .davr-notification-toast-icon
):is([data-kind="listing"],[data-kind="shop"],[data-kind="support"]),
html.davr-mobile-layout :is(
  .davr-notification-item-icon,
  .davr-notification-detail-icon,
  .davr-notification-toast-icon
):is([data-kind="listing"],[data-kind="shop"],[data-kind="support"]) {
  background: #e3f1ff !important;
  color: #052659 !important;
}
html.davr-desktop-browser-layout :is(
  .davr-notification-panel,
  .davr-notification-card
) :is(button.primary, button:not(.outline)[data-action="mark-read"]),
html.davr-mobile-layout :is(
  .davr-notification-panel,
  .davr-notification-card
) :is(button.primary, button:not(.outline)[data-action="mark-read"]) {
  background: #052659 !important;
  border-color: #052659 !important;
  color: #fff !important;
}
html.davr-desktop-browser-layout .davr-notification-badge,
html.davr-mobile-layout .davr-notification-badge {
  background: #5483B3 !important;
  color: #fff !important;
}


/* Exact legacy notification selectors seen in the screen recording. */
html.davr-desktop-browser-layout .davr-notification-card .davr-notification-enable,
html.davr-mobile-layout .davr-notification-card .davr-notification-enable {
  background: #052659 !important;
  color: #fff !important;
  border: 1px solid #052659 !important;
  font-weight: 800;
}
html.davr-desktop-browser-layout .davr-notification-card .davr-notification-enable:hover,
html.davr-mobile-layout .davr-notification-card .davr-notification-enable:hover {
  background: #1b4d82 !important;
}
html.davr-desktop-browser-layout .davr-notification-card .davr-notification-panel-head span,
html.davr-mobile-layout .davr-notification-card .davr-notification-panel-head span {
  background: #dcecff !important;
  color: #052659 !important;
}
html.davr-desktop-browser-layout .davr-notification-card .davr-notification-item.unread,
html.davr-mobile-layout .davr-notification-card .davr-notification-item.unread {
  background: #e9f3ff !important;
}
html.davr-desktop-browser-layout .davr-notification-card .davr-notification-item.unread::before,
html.davr-mobile-layout .davr-notification-card .davr-notification-item.unread::before {
  background: #5483B3 !important;
}
html.davr-desktop-browser-layout .davr-notification-card .davr-notification-read-all,
html.davr-mobile-layout .davr-notification-card .davr-notification-read-all {
  color: #052659 !important;
  border-top-color: #c7ddef !important;
}
