/*
 * Look-and-feel pass (2026-11): loaded last (front.app_styles), so these win over style.css and mobile.css.
 * Layout and wording live in the pages; this file only makes the shared pieces calmer and easier to use:
 *   1. Post cards: a soft lift on hover, specs that never break mid-word, titles in two lines.
 *   2. Phones: two cards per row (a buyer sees four posts a screen, not one), compact card text.
 *   3. Phones: the green top bar in one line.
 *   4. Floating buttons: smaller on phones, never on top of the contact bar.
 *   5. Sign-in: the form in a card with a full-width button, like the sign-up page.
 *   6. The floating share buttons on a post show only when Share is tapped.
 *   7. A post on phones and tablets: the photo first, whole and clear; the buttons in a grid.
 *   8. Pages without a banner: the heading no longer hides under the phone header.
 *   9. Contact page on phones: a shorter map.
 * Nothing here shows or hides a feature: electronics and property stay as the server sends them (App\Support\Sections).
 */

/* ---------- 1. Post cards ---------- */
.listing .listing-item {
    box-shadow: 0 1px 3px rgba(16, 24, 40, .08), 0 1px 2px rgba(16, 24, 40, .04);
    border: 1px solid #e8ecea;
    transition: box-shadow .2s ease, transform .2s ease;
}
.listing .listing-item:hover {
    box-shadow: 0 10px 24px rgba(16, 24, 40, .12);
    transform: translateY(-2px);
}
/* The photo used to zoom 120% and tilt 5° on hover: a gentle zoom instead. */
.listing .listing-item:hover .photo img { transform: scale(1.04); }
.listing .listing-item .text h3 {
    line-height: 1.3;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.listing .listing-item .text .location { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* Specs ("73,818 mi · 2022 · Automatic"): whole words side by side; on a narrow card the last one moves to a
   second line instead of breaking ("Automati / c", "mi" alone on a line before). */
.listing .listing-item .bed-bath-size { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 12px; overflow: visible; }
.listing .listing-item .bed-bath-size .item { float: none; width: auto; flex: 0 1 auto; min-width: 0; }
.listing .listing-item .bed-bath-size .item .text { white-space: nowrap; }
/* Each spec as icon + words in one line (the icon sat on a line of its own above the words). */
.listing .listing-item .bed-bath-size .item { display: flex; align-items: center; gap: 5px; }
.listing .listing-item .bed-bath-size .item .icon { text-align: left !important; flex: 0 0 auto; }
.listing .listing-item .bed-bath-size .item .icon i { width: auto !important; height: auto !important; line-height: 1 !important; font-size: 12px; }
.listing .listing-item .bed-bath-size .item .text { text-align: left !important; font-size: 13px; line-height: 1.25; }
@media (prefers-reduced-motion: reduce) {
    .listing .listing-item, .listing .listing-item:hover { transform: none; }
    .listing .listing-item:hover .photo img { transform: none; }
}

/* ---------- 2. Phones: two cards per row ---------- */
@media (max-width: 575.98px) {
    /* Cards straight in a card grid (before masonry.js puts them in columns, and when it is off). */
    .listing [data-pv-masonry] { margin-left: -5px; margin-right: -5px; }
    .listing [data-pv-masonry] > [data-pv-m] { flex: 0 0 50%; max-width: 50%; }
    .listing [data-pv-masonry] [data-pv-m] { padding-left: 5px; padding-right: 5px; }
    .listing [data-pv-masonry] .listing-item { margin-bottom: 10px; border-radius: 10px; }
    .listing [data-pv-masonry] .listing-item:hover { transform: none; }

    /* Photo: never taller than the screen can sensibly show beside another. */
    .listing [data-pv-masonry] .listing-item .photo img,
    .listing [data-pv-masonry] .listing-item .photo img.pv-natural { max-height: 230px; border-radius: 10px 10px 0 0; }
    .listing [data-pv-masonry] .listing-item .photo { border-radius: 10px 10px 0 0; }
    .listing [data-pv-masonry] .listing-item .photo .brand { left: 6px; bottom: 6px; }
    .listing [data-pv-masonry] .listing-item .photo .brand a { font-size: 11px; padding: 1px 6px; border-radius: 5px; }
    .listing [data-pv-masonry] .listing-item .photo .featured-text { right: 6px; bottom: 6px; font-size: 10px; padding: 4px 7px; }
    /* Save and Compare stacked down the right edge, 32px each (side by side they covered the photo count). */
    .listing [data-pv-masonry] .listing-item .pv-save:not(.pv-save-inline),
    .listing [data-pv-masonry] .listing-item .pv-cmp-btn { width: 32px; height: 32px; right: 6px; font-size: 13px; }
    .listing [data-pv-masonry] .listing-item .pv-save:not(.pv-save-inline) { top: 6px; }
    .listing [data-pv-masonry] .listing-item .pv-cmp-btn { top: 44px; }
    .listing [data-pv-masonry] .listing-item .pv-media-badge { top: 6px; left: 6px; transform: scale(.85); transform-origin: top left; }

    /* Text: price first and bold, then the title, place and specs, all small. */
    .listing [data-pv-masonry] .listing-item > .text { padding: 9px 10px 10px; border-radius: 0 0 10px 10px; display: flex; flex-direction: column; }
    .listing [data-pv-masonry] .listing-item > .text > * { order: 5; }
    .listing [data-pv-masonry] .listing-item .text .type-price { order: 1; margin: 0 0 3px; padding: 0; border: 0; }
    .listing [data-pv-masonry] .listing-item .text .type-price .type { margin: 0 0 4px; font-size: 10.5px; }
    .listing [data-pv-masonry] .listing-item .text .type-price .type .inner-new,
    .listing [data-pv-masonry] .listing-item .text .type-price .type .inner-used { padding: 1px 6px; border-radius: 5px; }
    .listing [data-pv-masonry] .listing-item .text .type-price .price { font-size: 16px; line-height: 1.25; }
    .listing [data-pv-masonry] .listing-item .text .pv-ab-note { order: 2; font-size: 10.5px !important; margin: 0 0 4px !important; }
    .listing [data-pv-masonry] .listing-item .text h3 { order: 3; font-size: 13.5px; margin: 0 0 4px; }
    .listing [data-pv-masonry] .listing-item .text .location { order: 4; font-size: 12px; margin: 0 0 2px; }
    .listing [data-pv-masonry] .listing-item .text .pv-badges { margin: 4px 0 0 !important; gap: 6px 4px !important; font-size: 10.5px; }
    .listing [data-pv-masonry] .listing-item .text .pv-badges > * { font-size: 10.5px !important; padding: 1px 6px !important; }
    .listing [data-pv-masonry] .listing-item .text .review { font-size: 11px; margin-top: 2px; line-height: 1.3; }
    .listing [data-pv-masonry] .listing-item .text .review i { font-size: 10px; }
    .listing [data-pv-masonry] .listing-item .bed-bath-size { order: 9; margin-top: 7px; padding-top: 6px; gap: 0 4px; justify-content: flex-start; }
    /* Whole words, wrapping onto a second line if they must ("18,641 mi · 2022 · Automatic"), never "Auto…". */
    .listing [data-pv-masonry] .listing-item .bed-bath-size .item { flex: 0 0 auto; }
    .listing [data-pv-masonry] .listing-item .bed-bath-size .item .text { overflow: visible; }
    .listing [data-pv-masonry] .listing-item .bed-bath-size .item .icon { display: none; }
    .listing [data-pv-masonry] .listing-item .bed-bath-size .item .text { font-size: 11px; color: #4b5563; text-align: left !important; }
    .listing [data-pv-masonry] .listing-item .bed-bath-size .item:not(:first-child) .text::before { content: "· "; color: #9ca3af; }
    .listing [data-pv-masonry] .listing-item .bed-bath-size .item .pv-km { display: none !important; }
}

/* ---------- 3. Phones: the green top bar in one line (mobile.css section 5 sets the row) ---------- */
@media (max-width: 767.98px) {
    /* Google's button is on the sign-in page and in the one-tap prompt; here it pushed the bar onto two lines. */
    .top ul.top-right .pv-gsi-top-li { display: none !important; }
    .top ul.top-right .pv-top-currency > i { display: none; }
    /* Create a post: the bar's one button. */
    .top ul.top-right li.currency .nav-link {
        background: #fff; color: var(--theme-dark, #0b5d3b) !important; border-radius: 999px;
        padding: 4px 11px !important; font-weight: 600; line-height: 1.25;
    }
    .top ul.top-right li.currency .nav-link i { color: inherit !important; }
}
@media (max-width: 575.98px) {
    /* Saved as a heart (and its count), so Create a post fits on the same line. */
    .top ul.top-right li:first-child a.nav-link[href*="saved"] { font-size: 0 !important; padding: 6px 6px !important; }
    .top ul.top-right li:first-child a.nav-link[href*="saved"] i { font-size: 16px; }
    .top ul.top-right li:first-child a.nav-link[href*="saved"] .badge { font-size: 11px; margin-left: 2px; }
    /* Signed in: Messages as its icon and count too (the title says how many buyers are waiting). */
    .top ul.top-right a.nav-link[data-pv-top-messages] { font-size: 0 !important; padding: 6px 6px !important; }
    .top ul.top-right a.nav-link[data-pv-top-messages] i { font-size: 16px; }
    .top ul.top-right a.nav-link[data-pv-top-messages] .badge { font-size: 11px; margin-left: 2px; }
    .top ul.top-right { gap: 0 2px !important; }
}

/* Search results on phones and tablets: sort, save search, map and the shopper in one row that slides sideways
   (they took three rows above the first post), each 36px tall; chosen filters still get a row of their own. */
@media (max-width: 991.98px) {
    #pvLayoutRow .pv-results-bar { flex-wrap: nowrap; gap: 8px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; margin-bottom: 12px; }
    #pvLayoutRow .pv-results-bar::-webkit-scrollbar { display: none; }
    #pvLayoutRow .pv-results-bar:has(.pv-active .pv-tag) { flex-wrap: wrap; }
    #pvLayoutRow .pv-results-bar .pv-active { flex: 0 0 100%; order: -1; min-width: 0; }
    #pvLayoutRow .pv-results-bar .pv-active:empty { display: none; }
    #pvLayoutRow .pv-results-bar .pv-sort { order: 1; flex: 0 0 auto; min-width: 0; }
    #pvLayoutRow .pv-results-bar .pv-sort label { display: none; }
    #pvLayoutRow .pv-results-bar .pv-sort .select2-container { min-width: 150px; }
    #pvLayoutRow .pv-results-bar .pv-sort .select2-selection--single { height: 36px !important; border-radius: 8px !important; border-color: #cfd8d3 !important; }
    #pvLayoutRow .pv-results-bar .pv-sort .select2-selection__rendered { line-height: 34px !important; font-size: 14px; }
    #pvLayoutRow .pv-results-bar .pv-sort .select2-selection__arrow { height: 34px !important; }
    #pvLayoutRow .pv-results-bar .pv-ssave { order: 2; flex: 0 0 auto; }
    #pvLayoutRow .pv-results-bar .pv-ssave .pv-al-btn { height: 36px; padding-top: 0; padding-bottom: 0; white-space: nowrap; font-size: 14px; }
    #pvLayoutRow .pv-results-bar .pv-layout-switch { order: 3; flex: 0 0 auto; }
    #pvLayoutRow .pv-results-bar .pv-layout-btn { white-space: nowrap; }
}

/* ---------- 4. Floating buttons ---------- */
@media (max-width: 767.98px) {
    /* The assistant: a 48px round button (it covered the cards' prices), above the contact bar when that shows. */
    #pv-ai-btn { left: 12px; bottom: calc(12px + env(safe-area-inset-bottom)); width: 48px; height: 48px; padding: 0;
        border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 18px; }
    #pv-ai-btn .pv-ai-label { display: none; }
    body.pv-mbar-up #pv-ai-btn { bottom: calc(76px + env(safe-area-inset-bottom)); }
    body.pv-mbar-up .scroll-top { bottom: calc(76px + env(safe-area-inset-bottom)) !important; }
}

/* ---------- 5. Sign-in ---------- */
.pv-auth-card {
    display: block !important; width: 100%;
    max-width: 460px; margin: 0 auto; background: #fff; border: 1px solid #e3e8e5; border-radius: 14px;
    padding: 24px 22px; box-shadow: 0 1px 3px rgba(16, 24, 40, .06);
}
.pv-auth-card h2 { font-size: 22px; font-weight: 700; margin: 0 0 14px; }
.pv-auth-card .pv-auth-submit { width: 100%; padding: 11px 16px; font-weight: 600; font-size: 16px; border-radius: 8px; }
.pv-auth-card .pv-auth-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin: 4px 0 14px; }
.pv-auth-card .pv-auth-row .form-check, .pv-auth-card .pv-auth-row label { margin: 0; }
@media (max-width: 575.98px) { .pv-auth-card { padding: 18px 16px; border-radius: 12px; } }

/* ---------- 6. Share buttons on a post: only when Share is tapped (partials.mobile_contact_bar) ---------- */
/* They covered the bottom of the screen on every post, on top of the contact bar. */
.st-sticky-share-buttons { display: none !important; }
body.pv-mbar-sharing .st-sticky-share-buttons { display: block !important; }

/* ---------- 7. A post on phones and tablets: the photo first, whole and clear (partials.listing_media_hero) ---------- */
/* The photos were the background of a 1,100px-tall dark header, so on a phone a buyer saw a blurred, darkened
   close-up of the car behind the title. Now the photo is a 4:3 picture at the top, nothing over it; swipe or tap
   a thumbnail to change it, tap it for full size. The title, price and the rest follow on the same dark band. */
@media (max-width: 991.98px) {
    /* The phone header floats over the top of the page (mobile.css section 5): the photo starts below it. */
    .listing-single-banner.pv-hero { padding-top: var(--pv-head, 61px); padding-bottom: 28px; cursor: auto; }
    .pv-hero .pv-hero-slides { position: relative; inset: auto; aspect-ratio: 4 / 3; max-height: 70vh; width: 100%; margin-bottom: 16px; background: #111714; cursor: zoom-in; }
    .pv-hero .pv-hero-slides::after { display: none; }
    .pv-hero .pv-hero-slide.is-active { animation: none; transform: none; }
    .pv-hero .pv-hero-slide { transform: none; }
    .pv-hero .pv-hero-full { object-fit: contain; object-position: center; }
    .pv-hero > .bg { display: none; }
    /* Play and the arrows in the middle of the photo (it is 75vw tall, at most 70vh). */
    .pv-hero .pv-hero-play { top: calc(var(--pv-head, 61px) + min(37.5vw, 35vh) - 32px); bottom: auto; transform: translateX(50%); right: 50%; width: 64px; height: 64px; font-size: 22px; }
    .pv-hero .pv-hero-arrow { top: calc(var(--pv-head, 61px) + min(37.5vw, 35vh) - 22px); }
    .pv-hero h1, .pv-hero .price, .pv-hero .location, .pv-hero .pv-detail-crumbs { text-shadow: none; }
}
@media (max-width: 767.98px) {
    /* The buttons under the photo: a tidy two-column grid, WhatsApp across the top, then Save and Message. */
    .pv-hero .listing-items { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
    .pv-hero .listing-items > a { margin: 0 !important; display: flex; align-items: center; justify-content: center; gap: 6px;
        min-height: 44px; padding: 8px 10px !important; text-align: center; border-radius: 8px !important; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .pv-hero .listing-items > a[data-type="whatsapp"] { order: -2; grid-column: 1 / -1; font-weight: 600; }
    .pv-hero .listing-items > a[data-target="#send_message_modal"], .pv-hero .listing-items > a.pv-save-inline { order: -1; }
    .pv-hero .listing-items > a[data-target="#send_message_modal"] { font-weight: 600; }
}

/* ---------- 8. Pages without a banner: their heading no longer hides under the phone header ---------- */
/* Below 992px the header (meanmenu bar) floats over the top of the page; a page banner, the home search and a post's
   photo leave room for it (mobile.css section 5). Pages that start with anything else (the map, compare, saved,
   forum, inspection, logistics, some account pages) had their heading under it: the header takes its own room there. */
@media (max-width: 991.98px) {
    body:not(:has(> .navbar-area ~ :is(.page-banner, .search-section, .listing-single-banner))) > .navbar-area { min-height: var(--pv-head, 61px); }
}

/* ---------- 9. Contact page on phones: the map no longer fills the first screen ---------- */
@media (max-width: 767.98px) {
    .contact-page-map iframe { height: 240px; display: block; }
}

/* ---------- 10. Buttons that wrap onto a second line keep a gap above it ---------- */
/* Buttons in a row were spaced with a right margin only, so when a narrow screen sent some to the next line they sat
   on the row above (no gap, or touching). Rows of buttons and badges are spaced with a gap on both axes instead. */
@media (min-width: 768px) { /* (phones have the two-column grid of section 7) */
    .listing-single-banner .listing-items { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
    .listing-single-banner .listing-items > a { margin: 0 !important; }
}
body #pvLayoutRow .listing-item > .text .pv-badges, .listing .listing-item .text .pv-badges, .pv-hero .pv-badges { row-gap: 6px !important; }
/* Action buttons in a table cell (My posts, payments, imports, reviews...): a narrow column wraps them onto two or
   three lines; some had a 4px top margin and some none, so lines touched. 3px above and below each: 6px between lines. */
.table td .btn, .table td form .btn { margin-top: 3px; margin-bottom: 3px; }
.table td .btn.mt-1, .table td form .btn.mt-1 { margin-top: 3px !important; }

/* ---------- 11. Desktop: the header runs edge to edge, pages a little wider ---------- */
/* Everything sat in Bootstrap's 1140px column, about 150px of empty margin each side on a 1440px screen, and from
   1280px the menu squeezed the logo below its own width. On desktops the top bar and the header now run nearly edge to
   edge (a 32px gutter), the logo keeps its full width at its height, and page content is moderately wider: at most
   1230px (1290px on very wide screens: halfway between the old 1140px and a first try at 1320/1440, owner's choice),
   never closer than 48px to the screen's edge. Phones and tablets are unchanged. */
@media (min-width: 992px) {
    .top > .container, .navbar-area .container { max-width: none; padding-left: 32px; padding-right: 32px; }
    .main-nav .navbar-brand { flex-shrink: 0; }
    .main-nav .navbar-brand img { width: auto; max-width: none; }
}
@media (min-width: 1200px) {
    .container { max-width: min(1230px, calc(100vw - 96px)); }
}
@media (min-width: 1680px) {
    .container { max-width: 1290px; }
}
