/* =============================================================
 *  نمایندگی‌ها — آرشیو و تک نمایندگی
 * ============================================================= */

.agencies-archive,
.agency-single {
    --ag-primary: var(--primary, #005e62);
    --ag-primary-dark: #00464a;
    --ag-primary-soft: rgba(0, 94, 98, .08);
    --ag-border: #e6eaec;
    --ag-bg: #f5f7f8;
    --ag-text: var(--black, #1b1b1b);
    --ag-muted: var(--g1, #727376);
    --ag-radius: 18px;
    --ag-shadow: 0 10px 30px rgba(16, 38, 40, .06);
    background: var(--ag-bg);
    color: var(--ag-text);
    padding-bottom: 64px;
}

/* ── Breadcrumb ─────────────────────────────────────────────── */
.agencies-breadcrumb {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: rgba(255, 255, 255, .75);
    margin-bottom: 18px;
}

.agencies-breadcrumb a {
    color: rgba(255, 255, 255, .9);
    text-decoration: none;
}

.agencies-breadcrumb a:hover {
    color: #fff;
}

/* ── Hero (archive) ─────────────────────────────────────────── */
.agencies-hero,
.agency-hero {
    position: relative;
    isolation: isolate;
    color: #fff;
    background: linear-gradient(135deg, var(--ag-primary-dark) 0%, var(--ag-primary) 55%, #0a7f84 100%);
    overflow: hidden;
}

.agencies-hero {
    padding: 56px 0 96px;
}

.agencies-hero.has-image::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -2;
    background: var(--agencies-hero-bg) center / cover no-repeat;
}

.agencies-hero.has-image::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    background: linear-gradient(180deg, rgba(0, 50, 53, .55) 0%, rgba(0, 70, 74, .88) 100%);
}

/* دایره‌های تزئینی */
.agencies-hero:not(.has-image)::before,
.agency-hero::before {
    content: "";
    position: absolute;
    z-index: -1;
    width: 420px;
    height: 420px;
    border-radius: 50%;
    left: -120px;
    top: -180px;
    background: rgba(255, 255, 255, .06);
}

.agency-hero::after {
    content: "";
    position: absolute;
    z-index: -1;
    width: 260px;
    height: 260px;
    border-radius: 50%;
    right: -80px;
    bottom: -140px;
    background: rgba(255, 255, 255, .05);
}

.agencies-hero__title {
    font-size: clamp(26px, 4vw, 40px);
    font-weight: 800;
    color: #fff;
    margin: 0 0 10px;
}

.agencies-hero__desc {
    max-width: 560px;
    color: rgba(255, 255, 255, .85);
    margin: 0 0 24px;
}

.agencies-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    padding: 0;
    margin: 0;
}

.agencies-stats li {
    display: flex;
    align-items: baseline;
    gap: 8px;
    padding: 10px 18px;
    border-radius: 12px;
    background: rgba(255, 255, 255, .12);
    border: 1px solid rgba(255, 255, 255, .18);
    backdrop-filter: blur(6px);
}

.agencies-stats strong {
    font-size: 22px;
    font-weight: 800;
}

.agencies-stats span {
    font-size: 13px;
    opacity: .85;
}

/* ── Toolbar ────────────────────────────────────────────────── */
.agencies-body {
    position: relative;
    margin-top: -56px;
}

.agencies-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 14px;
    background: #fff;
    border-radius: var(--ag-radius);
    box-shadow: 0 18px 40px rgba(0, 50, 53, .12);
    padding: 16px;
    margin-bottom: 24px;
}

.agencies-search {
    position: relative;
    flex: 1 1 280px;
    margin: 0;
}

.agencies-search svg {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--ag-muted);
    pointer-events: none;
}

.agencies-search input {
    width: 100%;
    height: 50px;
    border: 1px solid var(--ag-border);
    border-radius: 12px;
    background: var(--ag-bg);
    padding: 0 48px 0 16px;
    font: inherit;
    color: var(--ag-text);
    outline: none;
    transition: border-color .2s, background .2s, box-shadow .2s;
}

.agencies-search input:focus {
    border-color: var(--ag-primary);
    background: #fff;
    box-shadow: 0 0 0 4px var(--ag-primary-soft);
}

.agencies-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.agencies-chip {
    height: 38px;
    padding: 0 16px;
    border-radius: 999px;
    border: 1px solid var(--ag-border);
    background: #fff;
    color: var(--ag-text);
    font: inherit;
    font-size: 14px;
    cursor: pointer;
    transition: all .2s;
}

.agencies-chip:hover {
    border-color: var(--ag-primary);
    color: var(--ag-primary);
}

.agencies-chip.is-active {
    background: var(--ag-primary);
    border-color: var(--ag-primary);
    color: #fff;
}

/* ── Layout ─────────────────────────────────────────────────── */
.agencies-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 24px;
    align-items: start;
}

@media (min-width: 992px) {
    .agencies-layout {
        grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
    }

    .agencies-layout.no-map {
        grid-template-columns: 1fr;
    }

    .agencies-map-wrap {
        position: sticky;
        top: 100px;
    }
}

/* روی موبایل نقشه بالای لیست */
@media (max-width: 991.98px) {
    .agencies-map-wrap {
        order: -1;
    }
}

.agencies-count {
    font-size: 14px;
    color: var(--ag-muted);
    margin: 0 0 12px;
}

.agencies-count span {
    font-weight: 800;
    color: var(--ag-primary);
}

.agencies-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
}

@media (min-width: 576px) {
    .agencies-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (min-width: 992px) {
    .agencies-layout.no-map .agencies-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

.agencies-empty {
    text-align: center;
    color: var(--ag-muted);
    background: #fff;
    border: 1px dashed var(--ag-border);
    border-radius: var(--ag-radius);
    padding: 40px 16px;
    margin: 16px 0 0;
}

/* ── Card ───────────────────────────────────────────────────── */
.agency-card {
    display: flex;
    flex-direction: column;
    gap: 14px;
    background: #fff;
    border: 1px solid var(--ag-border);
    border-radius: var(--ag-radius);
    padding: 20px;
    box-shadow: var(--ag-shadow);
    transition: transform .25s, box-shadow .25s, border-color .25s;
}

.agency-card:hover,
.agency-card.is-highlight {
    transform: translateY(-3px);
    border-color: rgba(0, 94, 98, .35);
    box-shadow: 0 18px 40px rgba(0, 50, 53, .12);
}

.agency-card[hidden] {
    display: none;
}

.agency-card__head {
    display: flex;
    align-items: center;
    gap: 12px;
}

.agency-card__badge {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 52px;
    border-radius: 14px;
    background: var(--ag-primary-soft);
    color: var(--ag-primary);
    overflow: hidden;
}

.agency-card__badge img {
    width: 100%;
    height: 100% !important;
    object-fit: contain;
    padding: 6px;
}

.agency-card__titles {
    min-width: 0;
}

.agency-card__title {
    font-size: 16px;
    font-weight: 800;
    margin: 0;
    line-height: 1.6;
}

.agency-card__title a {
    color: var(--ag-text);
    text-decoration: none;
    transition: color .2s;
}

.agency-card__title a:hover {
    color: var(--ag-primary);
}

.agency-card__city {
    display: inline-block;
    font-size: 12px;
    color: var(--ag-primary);
    background: var(--ag-primary-soft);
    border-radius: 999px;
    padding: 0 10px;
    line-height: 22px;
    margin-top: 2px;
}

.agency-card__info {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 14px 0 0;
    margin: 0;
    border-top: 1px dashed var(--ag-border);
    flex: 1 1 auto;
}

.agency-card__info li {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 14px;
    line-height: 1.9;
    color: var(--ag-muted);
}

.agency-card__info svg {
    flex: 0 0 auto;
    margin-top: 4px;
    color: var(--ag-primary);
}

.agency-card__info a {
    color: var(--ag-text);
    font-weight: 700;
    text-decoration: none;
}

.agency-card__info a:hover {
    color: var(--ag-primary);
}

.agency-card__actions {
    display: flex;
    gap: 8px;
}

.agency-card__actions .agency-btn {
    flex: 1 1 0;
}

/* ── Buttons ────────────────────────────────────────────────── */
.agency-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 42px;
    padding: 0 16px;
    border-radius: 12px;
    border: 1px solid transparent;
    font: inherit;
    font-size: 14px;
    font-weight: 700;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
    transition: all .2s;
}

.agency-btn--primary {
    background: var(--ag-primary);
    color: #fff;
}

.agency-btn--primary:hover {
    background: var(--ag-primary-dark);
    color: #fff;
}

.agency-btn--ghost {
    background: var(--ag-primary-soft);
    color: var(--ag-primary);
}

.agency-btn--ghost:hover {
    background: var(--ag-primary);
    color: #fff;
}

.agency-btn--light {
    background: #fff;
    color: var(--ag-primary);
}

.agency-btn--light:hover {
    background: rgba(255, 255, 255, .88);
    color: var(--ag-primary-dark);
}

.agency-btn--outline-light {
    border-color: rgba(255, 255, 255, .5);
    color: #fff;
}

.agency-btn--outline-light:hover {
    background: rgba(255, 255, 255, .12);
    border-color: #fff;
    color: #fff;
}

/* ── Map (Leaflet) ──────────────────────────────────────────── */
.agency-map {
    width: 100%;
    height: 360px;
    border-radius: var(--ag-radius);
    overflow: hidden;
    z-index: 1;
    background: #e8eeef;
}

.agency-map--archive {
    height: 420px;
    border: 4px solid #fff;
    box-shadow: var(--ag-shadow);
}

@media (min-width: 992px) {
    .agency-map--archive {
        height: calc(100vh - 140px);
        max-height: 640px;
    }
}

.agency-map .leaflet-popup-content-wrapper {
    border-radius: 12px;
    font-family: inherit;
    direction: rtl;
    text-align: right;
}

.agency-map .leaflet-popup-content {
    margin: 12px 14px;
    line-height: 1.8;
}

.agency-popup__title {
    display: block;
    font-weight: 800;
    font-size: 14px;
    color: var(--ag-text);
}

.agency-popup__address {
    display: block;
    font-size: 12px;
    color: var(--ag-muted);
    margin: 2px 0 6px;
}

.agency-popup__link {
    font-size: 12px;
    font-weight: 700;
    color: var(--ag-primary) !important;
}

/* ── Single: Hero ───────────────────────────────────────────── */
.agency-hero {
    padding: 48px 0 104px;
}

.agency-hero__main {
    display: flex;
    align-items: center;
    gap: 18px;
    margin-bottom: 24px;
}

.agency-hero__logo {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 84px;
    height: 84px;
    border-radius: 20px;
    background: #fff;
    padding: 10px;
    box-shadow: 0 10px 24px rgba(0, 0, 0, .15);
}

.agency-hero__logo img {
    max-height: 100% !important;
    object-fit: contain;
}

.agency-hero__tag {
    display: inline-block;
    font-size: 13px;
    padding: 2px 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, .14);
    border: 1px solid rgba(255, 255, 255, .2);
    margin-bottom: 8px;
}

.agency-hero__title {
    font-size: clamp(24px, 3.6vw, 36px);
    font-weight: 800;
    color: #fff;
    margin: 0;
    line-height: 1.5;
}

.agency-hero__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.agency-hero__actions .agency-btn {
    min-height: 48px;
    padding: 0 22px;
}

/* ── Single: Body ───────────────────────────────────────────── */
.agency-body {
    position: relative;
    margin-top: -64px;
}

.agency-contact {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
    margin-bottom: 24px;
}

@media (min-width: 992px) {
    .agency-contact {
        grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
    }

    .agency-contact.no-map {
        grid-template-columns: 1fr;
    }
}

.agency-info,
.agency-map-card,
.agency-section {
    background: #fff;
    border: 1px solid var(--ag-border);
    border-radius: var(--ag-radius);
    box-shadow: var(--ag-shadow);
}

.agency-info {
    padding: 24px;
}

.agency-map-card {
    padding: 8px;
}

.agency-map-card .agency-map {
    height: 100%;
    min-height: 360px;
    border-radius: 14px;
}

.agency-info__list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 0;
    margin: 0;
}

.agency-info__item {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 12px;
    border-radius: 14px;
    transition: background .2s;
}

.agency-info__item:hover {
    background: var(--ag-bg);
}

.agency-info__icon {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: var(--ag-primary-soft);
    color: var(--ag-primary);
}

.agency-info__label {
    display: block;
    font-size: 12px;
    color: var(--ag-muted);
    line-height: 1.6;
}

.agency-info__value {
    display: block;
    font-size: 15px;
    font-weight: 700;
    color: var(--ag-text);
    line-height: 1.9;
    text-decoration: none;
}

a.agency-info__value:hover {
    color: var(--ag-primary);
}

a.agency-info__value[dir="ltr"] {
    text-align: right;
    letter-spacing: .5px;
}

/* Sections */
.agency-section {
    padding: 24px;
    margin-bottom: 24px;
}

.agency-section__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 18px;
}

.agency-section__head .agency-section__title {
    margin: 0;
}

.agency-section__title {
    position: relative;
    font-size: 18px;
    font-weight: 800;
    color: var(--ag-text);
    margin: 0 0 18px;
    padding-right: 16px;
}

.agency-section__title::before {
    content: "";
    position: absolute;
    right: 0;
    top: 50%;
    width: 5px;
    height: 70%;
    border-radius: 4px;
    transform: translateY(-50%);
    background: var(--ag-primary);
}

.agency-content {
    color: var(--ag-muted);
    line-height: 2.1;
}

.agency-content > :last-child {
    margin-bottom: 0;
}

/* Video */
.agency-video {
    max-width: 960px;
    margin: 0 auto;
    border-radius: 14px;
    overflow: hidden;
    background: #111;
}

.agency-video video,
.agency-video iframe {
    display: block;
    width: 100% !important;
    aspect-ratio: 16 / 9;
    height: auto !important;
    border: 0;
}

/* Gallery */
.agency-gallery__nav {
    display: flex;
    gap: 8px;
}

.agency-gallery__arrow {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid var(--ag-border);
    background: #fff;
    color: var(--ag-text);
    cursor: pointer;
    transition: all .2s;
}

.agency-gallery__arrow:hover {
    background: var(--ag-primary);
    border-color: var(--ag-primary);
    color: #fff;
}

.agency-gallery__arrow.swiper-button-disabled {
    opacity: .4;
    pointer-events: none;
}

.agency-gallery__item {
    position: relative;
    display: block;
    border-radius: 14px;
    overflow: hidden;
}

.agency-gallery__item::after {
    content: "";
    position: absolute;
    inset: 0;
    background: rgba(0, 50, 53, .35);
    opacity: 0;
    transition: opacity .25s;
}

.agency-gallery__img {
    display: block;
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    transition: transform .4s;
}

.agency-gallery__item:hover .agency-gallery__img {
    transform: scale(1.06);
}

.agency-gallery__item:hover::after,
.agency-gallery__item:hover .agency-gallery__zoom {
    opacity: 1;
}

.agency-gallery__zoom {
    position: absolute;
    z-index: 2;
    inset: 0;
    margin: auto;
    width: 46px;
    height: 46px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: #fff;
    color: var(--ag-primary);
    opacity: 0;
    transition: opacity .25s;
}

.agency-gallery .swiper-pagination {
    position: static;
    margin-top: 16px;
}

.agency-gallery .swiper-pagination-bullet-active {
    background: var(--ag-primary);
}

.agency-back {
    text-align: center;
}

/* ── Lightbox ───────────────────────────────────────────────── */
.agency-lightbox {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(10, 18, 19, .92);
    opacity: 0;
    visibility: hidden;
    transition: opacity .25s, visibility .25s;
}

.agency-lightbox.is-open {
    opacity: 1;
    visibility: visible;
}

.agency-lightbox__img {
    max-width: 92vw;
    max-height: 86vh !important;
    border-radius: 10px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, .5);
}

.agency-lightbox__btn {
    position: absolute;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 0;
    background: rgba(255, 255, 255, .12);
    color: #fff;
    font-size: 26px;
    line-height: 1;
    cursor: pointer;
    transition: background .2s;
}

.agency-lightbox__btn:hover {
    background: rgba(255, 255, 255, .25);
}

.agency-lightbox__close {
    top: 20px;
    left: 20px;
}

.agency-lightbox__prev {
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
}

.agency-lightbox__next {
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
}

.agency-lightbox__counter {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(255, 255, 255, .8);
    font-size: 14px;
    direction: ltr;
}

@media (max-width: 575.98px) {
    .agencies-hero {
        padding: 40px 0 88px;
    }

    .agency-hero__main {
        flex-direction: column;
        align-items: flex-start;
    }

    .agency-hero__actions .agency-btn {
        flex: 1 1 0;
    }

    .agency-info,
    .agency-section {
        padding: 18px;
    }

    .agency-lightbox__prev,
    .agency-lightbox__next {
        top: auto;
        bottom: 12px;
        transform: none;
    }
}

/* ── Map pin (fallback) ─────────────────────────────────────── */
.agency-pin {
    background: none;
    border: 0;
}

.agency-pin span {
    position: relative;
    display: block;
    width: 34px;
    height: 34px;
    border-radius: 50% 50% 50% 0;
    transform: rotate(-45deg);
    background: var(--primary, #005e62);
    border: 3px solid #fff;
    box-shadow: 0 6px 14px rgba(0, 50, 53, .35);
}

.agency-pin span::after {
    content: "";
    position: absolute;
    inset: 0;
    margin: auto;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #fff;
}
