/* Redesign: ad pages (docs/migration/REDESIGN.md). Owned by the ad slice: templates/site/ad/*, ad-page.js. */

.ad-top { padding-top: 1rem; }
.ad-top .breadcrumb { flex-wrap: nowrap; overflow-x: auto; white-space: nowrap; scrollbar-width: none; padding-bottom: .15rem; }
.ad-top .breadcrumb::-webkit-scrollbar { display: none; }
.ad-top .breadcrumb-item { flex: 0 0 auto; }
.ad-top .breadcrumb-item.active { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.ad-expired .alert { border-radius: var(--iep-radius-sm); margin: 0; background: #f3f5f8; border-color: var(--iep-line); color: var(--iep-text); }

/* Gallery: scroll-snap strip (mobile), mosaic (desktop) */
.ad-gallery-wrap { position: relative; margin: .85rem 0 1.5rem; }
.ad-gallery { list-style: none; margin: 0; padding: 0; }
.ad-gallery-item { margin: 0; }
.ad-gallery-open { display: block; width: 100%; height: 100%; padding: 0; border: 0; background: var(--iep-sky); cursor: zoom-in; overflow: hidden; }
.ad-gallery-open img { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform .35s ease, filter .2s ease; }
.ad-gallery-open:hover img { transform: scale(1.025); filter: brightness(.94); }
.ad-gallery-open:focus-visible { outline-offset: -4px; }
.ad-gallery-counter { position: absolute; right: .75rem; bottom: .75rem; margin: 0; background: rgba(0, 29, 61, .78); color: #fff; font-size: .82rem; font-weight: 600; border-radius: 999px; padding: .2rem .65rem; pointer-events: none; }
.ad-gallery-all { position: absolute; right: 1rem; bottom: 1rem; display: none; align-items: center; border: 1px solid var(--iep-line); background: #fff; color: var(--iep-navy-900); font-weight: 700; font-size: .9rem; border-radius: var(--iep-radius-sm); padding: .5rem .9rem; box-shadow: var(--iep-shadow); }
.ad-gallery-all:hover { background: var(--iep-sky); }
.ad-gallery.ad-gallery-empty { display: flex; align-items: center; justify-content: center; height: clamp(200px, 24vw, 300px); border-radius: var(--iep-radius-lg); overflow: hidden; background: var(--iep-sky); }
.ad-gallery-empty img { width: auto; height: 90%; max-width: 100%; object-fit: contain; }

@media (max-width: 991.98px) {
    .ad-gallery-wrap { margin-left: calc(var(--bs-gutter-x) * -.5); margin-right: calc(var(--bs-gutter-x) * -.5); margin-bottom: 1.1rem; }
    .ad-gallery { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; overscroll-behavior-x: contain; }
    .ad-gallery::-webkit-scrollbar { display: none; }
    .ad-gallery-item { flex: 0 0 100%; scroll-snap-align: start; aspect-ratio: 4 / 3; }
    .ad-gallery-n1 .ad-gallery-item { flex-basis: 100%; }
    .ad-gallery.ad-gallery-empty { border-radius: 0; height: 220px; }
}
@media (min-width: 992px) {
    .ad-gallery { display: grid; gap: 8px; height: clamp(380px, 38vw, 520px); border-radius: var(--iep-radius-lg); overflow: hidden; }
    .ad-gallery-item.is-extra { display: none; }
    .ad-gallery-n1 { grid-template-columns: 1fr; }
    .ad-gallery-n2 { grid-template-columns: 3fr 2fr; }
    .ad-gallery-n3, .ad-gallery-n4 { grid-template-columns: 2fr 1fr; grid-template-rows: 1fr 1fr; }
    .ad-gallery-n4 .ad-gallery-item:nth-child(4) { display: none; }
    .ad-gallery-n5 { grid-template-columns: 2fr 1fr 1fr; grid-template-rows: 1fr 1fr; }
    .ad-gallery-n3 .ad-gallery-item:first-child, .ad-gallery-n4 .ad-gallery-item:first-child, .ad-gallery-n5 .ad-gallery-item:first-child { grid-row: 1 / 3; }
    .ad-gallery-counter { display: none; }
    .ad-gallery-all { display: inline-flex; }
}

/* Summary */
.ad-summary { padding-bottom: 1.25rem; border-bottom: 1px solid var(--iep-line); }
.ad-badges { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .75rem; }
.ad-owner-badge { display: inline-flex; align-items: center; gap: .35rem; background: var(--iep-orange-050); color: #8a3c00; border-radius: 999px; padding: .35rem .7rem; font-size: .78rem; font-weight: 700; }
.ad-owner-badge .bi { color: var(--iep-orange-600); }
.ad-title-row { display: flex; gap: 1rem; align-items: flex-start; justify-content: space-between; }
.ad-title { font-size: clamp(1.35rem, 2.6vw, 1.95rem); line-height: 1.2; margin: 0 0 .4rem; }
.ad-place { display: flex; align-items: center; gap: .35rem; color: var(--iep-muted); margin: 0; font-weight: 500; }
.ad-place .bi { color: var(--iep-orange-600); }
.ad-actions { display: flex; gap: .4rem; flex: 0 0 auto; }
.ad-action { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%; border: 1px solid var(--iep-line); background: #fff; color: var(--iep-navy-900); font-size: 1.1rem; }
.ad-action:hover, .ad-action[aria-expanded="true"] { background: var(--iep-sky); border-color: #b7cbe0; }
.ad-fav .fav-on { display: none; }
.ad-fav[aria-pressed="true"] { color: #d1213b; }
.ad-fav[aria-pressed="true"] .fav-on { display: inline; }
.ad-fav[aria-pressed="true"] .fav-off { display: none; }
.ad-share { border: 1px solid var(--iep-line); border-radius: var(--iep-radius); box-shadow: var(--iep-shadow); padding: .4rem; min-width: 13rem; }
.ad-share .dropdown-item { display: flex; align-items: center; gap: .55rem; border-radius: 8px; padding: .5rem .7rem; }
.ad-share .dropdown-item:active { background: var(--iep-navy); }
.ad-price-row { margin: 1rem 0 .25rem; display: flex; flex-wrap: wrap; align-items: baseline; gap: .25rem 1rem; }
.ad-price { margin: 0; font-size: clamp(1.6rem, 3vw, 2.1rem); font-weight: 800; color: var(--iep-navy-900); letter-spacing: -.02em; line-height: 1.1; }
.ad-price small { font-size: 1rem; font-weight: 600; color: var(--iep-muted); letter-spacing: 0; }
.ad-price .ad-price-from { display: block; font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; }
.ad-price-none { font-size: 1.3rem; color: var(--iep-muted); }
.ad-price-sub { margin: 0; color: var(--iep-muted); font-weight: 600; }
.ad-quick-facts { display: flex; flex-wrap: wrap; gap: .5rem; list-style: none; padding: 0; margin: 1rem 0 .9rem; }
.ad-quick-facts li { display: inline-flex; align-items: center; gap: .45rem; padding: .5rem .8rem; border-radius: var(--iep-radius-sm); background: var(--iep-sky); color: var(--iep-navy-900); font-weight: 600; font-size: .95rem; }
.ad-quick-facts .bi { color: var(--iep-navy-700); }
.ad-meta { color: var(--iep-muted); font-size: .86rem; margin: 0; }

/* Sections */
.ad-section { padding: 1.6rem 0; border-bottom: 1px solid var(--iep-line); }
.ad-section:last-child { border-bottom: 0; }
.ad-section-title { font-size: 1.3rem; margin: 0 0 1rem; }
.ad-group-title { font-size: .95rem; font-weight: 700; color: var(--iep-navy-900); margin: 1.1rem 0 .55rem; }
.ad-section-title + .ad-group-title { margin-top: 0; }
.ad-facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .6rem; margin: 0; }
@media (min-width: 768px) { .ad-facts { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.ad-fact { display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: .7rem; align-items: center; padding: .7rem .8rem; border: 1px solid var(--iep-line); border-radius: var(--iep-radius-sm); background: #fff; }
.ad-fact-icon { grid-row: 1 / 3; width: 40px; height: 40px; display: grid; place-items: center; border-radius: 10px; background: var(--iep-sky); color: var(--iep-navy-700); font-size: 1.15rem; }
.ad-fact dt { font-size: .76rem; font-weight: 600; color: var(--iep-muted); text-transform: uppercase; letter-spacing: .04em; line-height: 1.2; }
.ad-fact dd { margin: 0; font-weight: 700; color: var(--iep-navy-900); line-height: 1.3; overflow-wrap: anywhere; }
.ad-chips { display: flex; flex-wrap: wrap; gap: .45rem; list-style: none; padding: 0; margin: 0; }
.ad-chips li { display: inline-flex; align-items: center; gap: .35rem; padding: .4rem .75rem; border: 1px solid var(--iep-line); border-radius: 999px; background: #fff; font-size: .92rem; font-weight: 500; }
.ad-chips .bi { color: var(--iep-success); }
.ad-description-name { font-weight: 700; color: var(--iep-navy-900); margin-bottom: .5rem; }
.ad-description { line-height: 1.7; overflow-wrap: anywhere; color: var(--iep-text); }

/* Energy labels: the scale itself is app.css (.energy-scale); here the value of the current class */
.ad-energy .energy-scale span { position: relative; }
.ad-energy .energy-scale span.is-current { box-shadow: none; outline: 2px solid var(--iep-navy-900); outline-offset: 1px; }
.ad-energy-value { font-style: normal; font-weight: 600; font-size: .72rem; margin-left: .5rem; white-space: nowrap; }
.ad-energy-note { margin: .6rem 0 0; color: var(--iep-muted); font-size: .9rem; }

/* Holiday rates */
.ad-rates { margin: 0 0 .75rem; --bs-table-bg: transparent; }
.ad-rates th, .ad-rates td { padding: .65rem .5rem; border-color: var(--iep-line); }
.ad-rates thead th { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--iep-muted); font-weight: 700; }
.ad-rates td { font-weight: 700; color: var(--iep-navy-900); white-space: nowrap; }
.ad-season { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: .5rem; }
.ad-season-1 { background: #52b153; } .ad-season-2 { background: #f0b50f; } .ad-season-3 { background: #d7221f; }
.ad-rates-text { color: var(--iep-muted); font-size: .92rem; margin: .5rem 0 0; }

/* Owner box */
.ad-owner-card { position: sticky; top: 88px; background: #fff; border: 1px solid var(--iep-line); border-radius: var(--iep-radius); box-shadow: var(--iep-shadow); padding: 1.25rem; margin-bottom: 1.5rem; }
.ad-owner-price { font-size: 1.5rem; font-weight: 800; color: var(--iep-navy-900); margin: 0 0 1rem; padding-bottom: 1rem; border-bottom: 1px solid var(--iep-line); }
.ad-owner-price small { font-size: .9rem; font-weight: 600; color: var(--iep-muted); }
.ad-owner { display: flex; align-items: center; gap: .8rem; margin-bottom: 1rem; }
.ad-owner-avatar { width: 52px; height: 52px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 50%; background: var(--iep-navy); color: #fff; font-weight: 800; font-size: 1.3rem; }
.ad-owner-name { margin: 0; font-weight: 700; font-size: 1.08rem; color: var(--iep-navy-900); }
.ad-owner-kind { margin: 0; color: var(--iep-muted); font-size: .9rem; }
.ad-owner-actions { display: grid; gap: .6rem; }
.ad-phone-result { margin: 0; font-size: .88rem; color: var(--iep-muted); text-align: center; }
.ad-owner-safety { margin-top: 1rem; }
.ad-owner-safety .alert, .ad-dialog .alert-warning { background: var(--iep-orange-050); border: 1px solid #ffd2b5; color: #6a3205; border-radius: var(--iep-radius-sm); font-size: .86rem; margin: 0; }
.ad-dialog .alert-warning { margin-bottom: 1rem; }
.ad-owner-points { list-style: none; padding: 0; margin: 1rem 0 .25rem; display: grid; gap: .35rem; font-size: .9rem; color: var(--iep-text); }
.ad-owner-points li { display: flex; align-items: center; gap: .5rem; }
.ad-owner-points .bi { color: var(--iep-success); }
.ad-report { --bs-btn-color: var(--iep-muted); --bs-btn-hover-color: #b02a37; padding: .4rem 0; font-size: .88rem; font-weight: 600; text-decoration: none; }
.ad-owner-card .alert-secondary { margin: 0; }
@media (max-width: 991.98px) {
    .ad-owner-card { position: static; box-shadow: none; margin-top: .5rem; }
}

/* Mobile bottom bar */
.ad-mobile-bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 1020; display: flex; align-items: center; gap: .5rem; padding: .6rem 1rem calc(.6rem + env(safe-area-inset-bottom)); background: rgba(255, 255, 255, .98); border-top: 1px solid var(--iep-line); box-shadow: 0 -6px 20px rgba(0, 29, 61, .1); }
.ad-mobile-bar-price { flex: 1 1 auto; min-width: 0; font-weight: 800; color: var(--iep-navy-900); font-size: 1.1rem; line-height: 1.1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ad-mobile-bar-price small { font-size: .78rem; color: var(--iep-muted); font-weight: 600; }
.ad-mobile-bar .btn { min-height: 46px; white-space: nowrap; }
@media (max-width: 991.98px) {
    .page-ad:not(.is-expired) { padding-bottom: 72px; }
}

/* Dialogs (contact, report, photo viewer) */
.ad-dialog { width: min(600px, calc(100vw - 1.5rem)); max-height: calc(100dvh - 1.5rem); padding: 0; border: 0; border-radius: var(--iep-radius); box-shadow: var(--iep-shadow-lg); color: var(--iep-text); }
.ad-dialog::backdrop { background: rgba(0, 29, 61, .55); }
.ad-dialog-head { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1rem 1.25rem; background: #fff; border-bottom: 1px solid var(--iep-line); }
.ad-dialog-title { font-size: 1.15rem; margin: 0; display: flex; align-items: center; gap: .5rem; }
.ad-dialog-close { width: 44px; height: 44px; display: grid; place-items: center; border: 0; border-radius: 50%; background: transparent; color: var(--iep-navy-900); font-size: 1.1rem; }
.ad-dialog-close:hover { background: var(--iep-sky); }
.ad-dialog-body { padding: 1.1rem 1.25rem 1.35rem; }
.ad-dialog-ref { color: var(--iep-muted); font-size: .9rem; margin-bottom: .9rem; }
.ad-form form { margin: 0; }
.ad-form form > div { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; }
.ad-form .form-group { grid-column: 1 / -1; width: auto; max-width: none; padding: 0; margin: 0; }
@media (min-width: 576px) { .ad-form .form-group.col-sm-6 { grid-column: auto; } }
.ad-form .alert { grid-column: 1 / -1; margin: 0; border-radius: var(--iep-radius-sm); padding: .7rem 1rem; }
.ad-form .row { margin: 0; --bs-gutter-x: 0; }
.ad-form ul.list-unstyled { margin: 0; }
.ad-form .has-error .form-control, .ad-form .has-error .form-select { border-color: #b02a37; }
.ad-form .help-block { display: block; margin-top: .3rem; color: #b02a37; font-size: .85rem; }
.ad-form .form-control, .ad-form .form-select { min-height: 48px; border-radius: var(--iep-radius-sm); border-color: var(--iep-line); }
.ad-form textarea.form-control { min-height: 130px; }
.ad-form .mb-3 { margin-bottom: 0 !important; }
.ad-form [type="submit"] { width: 100%; --bs-btn-bg: var(--iep-orange-600); --bs-btn-border-color: var(--iep-orange-600); --bs-btn-hover-bg: #a63e00; --bs-btn-hover-border-color: #a63e00; --bs-btn-active-bg: #8f3e00; --bs-btn-color: #fff; --bs-btn-hover-color: #fff; }
.ad-form .g-recaptcha { min-height: 78px; }
@media (max-width: 575.98px) {
    .ad-dialog { width: 100vw; max-width: 100vw; max-height: 100dvh; height: 100dvh; margin: 0; border-radius: 0; }
}

.ad-viewer { width: 100vw; height: 100dvh; max-width: 100vw; max-height: 100dvh; margin: 0; padding: 0; border: 0; background: #06121d; color: #fff; }
.ad-viewer::backdrop { background: #06121d; }
.ad-viewer[open] { display: flex; flex-direction: column; }
.ad-viewer-bar { display: flex; align-items: center; justify-content: space-between; padding: .5rem .75rem .5rem 1.25rem; }
.ad-viewer-counter { font-weight: 600; font-size: .95rem; }
.ad-viewer-close { width: 48px; height: 48px; display: grid; place-items: center; border: 0; border-radius: 50%; background: rgba(255, 255, 255, .1); color: #fff; font-size: 1.2rem; }
.ad-viewer-figure { flex: 1 1 auto; min-height: 0; display: grid; place-items: center; padding: 0 0 1rem; }
.ad-viewer-figure img { max-width: 100%; max-height: 100%; object-fit: contain; }
.ad-viewer-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 52px; height: 52px; display: grid; place-items: center; border: 0; border-radius: 50%; background: rgba(255, 255, 255, .92); color: var(--iep-navy-900); font-size: 1.2rem; box-shadow: 0 4px 16px rgba(0, 0, 0, .3); }
.ad-viewer-prev { left: 1rem; }
.ad-viewer-next { right: 1rem; }
@media (max-width: 575.98px) { .ad-viewer-nav { width: 44px; height: 44px; } .ad-viewer-prev { left: .4rem; } .ad-viewer-next { right: .4rem; } }

/* Similar ads */
.ad-similar { margin-top: 2rem; }

/* "Ad not found" */
.ad-missing-card { padding: 1.5rem; }
.ad-missing-icon { width: 56px; height: 56px; display: grid; place-items: center; border-radius: 14px; background: var(--iep-orange-050); color: var(--iep-orange-600); font-size: 1.6rem; margin-bottom: 1rem; }
.ad-missing-causes { color: var(--iep-muted); padding-left: 1.1rem; margin: 0; }
.ad-missing-causes li { margin-bottom: .35rem; }
