.dr-widget,
.dr-widget * {
    box-sizing: border-box;
}

.dr-widget {
    --dr-accent: #d71035;
    --dr-map-hover: #66a9d4;
    --dr-map-fill: #fff;
    --dr-map-border: #777;
    width: 100%;
    color: #272727;
    font-family: inherit;
    line-height: 1.9;
}

.dr-tabs {
    display: flex;
    justify-content: flex-start;
    align-items: stretch;
    gap: 6px;
    border-bottom: 1px solid #dedede;
    overflow-x: auto;
    scrollbar-width: thin;
}

.dr-tab-button {
    appearance: none;
    min-width: 170px;
    padding: 16px 24px;
    border: 1px solid #dedede;
    border-bottom: 0;
    border-top: 3px solid transparent;
    background: #f8f8f8;
    color: #888;
    font: inherit;
    font-size: 16px;
    cursor: pointer;
    white-space: nowrap;
    transition: color .2s ease, background .2s ease, border-color .2s ease;
}

.dr-tab-button:hover,
.dr-tab-button:focus-visible {
    color: #222;
    background: #fff;
    outline: none;
}

.dr-tab-button.is-active {
    color: #111;
    background: #fff;
    border-top-color: var(--dr-accent);
    font-weight: 700;
}

.dr-tab-panel {
    padding-top: 20px;
}

.dr-tab-panel[hidden] {
    display: none !important;
}

.dr-filters {
    display: grid;
    grid-template-columns: repeat(2, minmax(220px, 1fr));
    gap: 18px;
    margin-bottom: 20px;
}

.dr-select-wrap {
    position: relative;
    display: block;
}

.dr-select-wrap::after {
    content: '';
    position: absolute;
    left: 18px;
    top: 50%;
    width: 8px;
    height: 8px;
    border-left: 2px solid #5e7182;
    border-bottom: 2px solid #5e7182;
    transform: translateY(-70%) rotate(-45deg);
    pointer-events: none;
}

.dr-select-wrap select {
    width: 100%;
    min-height: 48px;
    padding: 0 20px 0 46px;
    border: 1px solid #eee;
    border-radius: 0;
    background: #fff;
    color: #555;
    font: inherit;
    appearance: none;
    cursor: pointer;
}

.dr-select-wrap select:focus {
    border-color: var(--dr-accent);
    outline: 2px solid color-mix(in srgb, var(--dr-accent) 18%, transparent);
    outline-offset: 0;
}

.dr-select-wrap select:disabled {
    color: #aaa;
    cursor: not-allowed;
    background: #fafafa;
}

.dr-representatives-layout {
    display: grid;
    grid-template-columns: minmax(280px, 34%) minmax(0, 66%);
    gap: 26px;
    direction: ltr;
    align-items: start;
}

.dr-map-column,
.dr-results-column {
    direction: rtl;
}

.dr-map-column {
    position: sticky;
    top: 24px;
}

.dr-map-shell {
    position: relative;
    min-height: 430px;
    padding: 12px 0;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    isolation: isolate;
}

.dr-map-shell::before,
.dr-map-shell::after {
    content: '';
    position: absolute;
    z-index: -1;
    border-radius: 50%;
    background: #e5e5e5;
    transform: rotate(22deg);
}

.dr-map-shell::before {
    width: 76%;
    height: 58%;
    left: 9%;
    top: 12%;
}

.dr-map-shell::after {
    width: 67%;
    height: 50%;
    left: 16%;
    top: 18%;
    background: #d8d8d8;
    opacity: .75;
}

.dr-iran-map {
    display: block;
    width: min(100%, 440px);
    height: auto;
    overflow: visible;
    filter: drop-shadow(0 1px 0 rgba(0, 0, 0, .05));
}

.dr-province-shape {
    fill: var(--dr-map-fill);
    stroke: var(--dr-map-border);
    stroke-width: 1.35;
    vector-effect: non-scaling-stroke;
    cursor: pointer;
    transition: fill .16s ease, stroke .16s ease, filter .16s ease;
}

.dr-province-shape:hover,
.dr-province-shape:focus,
.dr-province-shape.is-selected {
    fill: var(--dr-map-hover);
    stroke: #4c758d;
    outline: none;
    filter: brightness(1.02);
}

.dr-map-tooltip {
    position: absolute;
    z-index: 20;
    transform: translate(-50%, calc(-100% - 12px));
    min-width: max-content;
    padding: 6px 11px;
    border-radius: 4px;
    background: #111;
    color: #fff;
    font-size: 13px;
    line-height: 1.5;
    pointer-events: none;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .18);
}

.dr-map-tooltip::after {
    content: '';
    position: absolute;
    left: 50%;
    bottom: -6px;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: #111;
    border-bottom: 0;
}

.dr-results-title {
    margin: 0 0 15px;
    font-size: 18px;
    font-weight: 800;
    color: #202020;
}

.dr-results {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.dr-agent-card {
    position: relative;
    display: grid;
    grid-template-columns: 40px minmax(0, 1fr);
    min-height: 178px;
    border: 1px solid #efefef;
    background: #fff;
    overflow: hidden;
    transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}

.dr-agent-card:hover {
    transform: translateY(-2px);
    border-color: #e2e2e2;
    box-shadow: 0 10px 28px rgba(0, 0, 0, .07);
}

.dr-agent-pin {
    display: flex;
    align-items: center;
    justify-content: center;
    border-left: 1px solid #e7e7e7;
    color: var(--dr-accent);
}

.dr-agent-pin svg {
    width: 22px;
    height: 22px;
    fill: currentColor;
}

.dr-agent-pin-button {
    appearance: none;
    width: 100%;
    padding: 0;
    border: 0;
    border-left: 1px solid #e7e7e7;
    background: transparent;
    color: var(--dr-accent);
    cursor: pointer;
    transition: background .16s ease, color .16s ease;
}

.dr-agent-pin-button:hover,
.dr-agent-pin-button:focus-visible {
    background: color-mix(in srgb, var(--dr-accent) 8%, #fff);
    color: color-mix(in srgb, var(--dr-accent) 82%, #000);
    outline: none;
}

.dr-agent-pin-button:focus-visible {
    box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--dr-accent) 35%, transparent);
}

.dr-agent-body {
    min-width: 0;
    padding: 18px 18px 14px;
}

.dr-agent-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding-bottom: 10px;
    margin-bottom: 8px;
    border-bottom: 1px solid #ededed;
}

.dr-agent-heading h3 {
    min-width: 0;
    margin: 0;
    color: #333;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.9;
}

.dr-agent-heading .dr-label {
    font-weight: 800;
}

.dr-city-badge {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    min-height: 22px;
    padding: 1px 14px;
    background: var(--dr-accent);
    color: #fff;
    font-size: 12px;
    line-height: 1.6;
}

.dr-agent-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 3px 18px;
}

.dr-agent-meta p,
.dr-agent-address {
    margin: 3px 0;
    color: #555;
    font-size: 12px;
    line-height: 1.95;
}

.dr-agent-meta a {
    color: inherit;
    text-decoration: none;
}

.dr-agent-meta a:hover {
    color: var(--dr-accent);
}

.dr-agent-address {
    word-break: break-word;
}

.dr-social-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 9px;
}

.dr-social-link {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    min-height: 27px;
    padding: 2px 10px;
    border: 1px solid #e4e4e4;
    border-radius: 5px;
    background: #fff;
    color: #444;
    text-decoration: none !important;
    font-size: 10px;
    line-height: 1.5;
    transition: border-color .15s ease, background .15s ease, transform .15s ease;
}

.dr-social-icon {
    display: inline-flex;
    width: 16px;
    height: 16px;
    flex: 0 0 16px;
    align-items: center;
    justify-content: center;
}

.dr-social-icon svg {
    display: block;
    width: 100%;
    height: 100%;
}

.dr-social-link:hover,
.dr-social-link:focus-visible {
    border-color: var(--dr-accent);
    background: color-mix(in srgb, var(--dr-accent) 5%, #fff);
    color: var(--dr-accent);
    transform: translateY(-1px);
    outline: none;
}

.dr-routing-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 10px;
    margin-top: 10px;
    font-size: 11px;
    color: #555;
}

.dr-routing-links {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.dr-route-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    min-height: 26px;
    padding: 2px 7px;
    border: 1px solid #e5e5e5;
    border-radius: 5px;
    background: #fafafa;
    color: #333;
    text-decoration: none !important;
    font-size: 10px;
    line-height: 1.4;
    transition: background .15s ease, border-color .15s ease, transform .15s ease;
}

.dr-route-link:hover,
.dr-route-link:focus-visible {
    border-color: #cfcfcf;
    background: #fff;
    transform: translateY(-1px);
    outline: none;
}

.dr-route-icon {
    display: inline-grid;
    place-items: center;
    flex: 0 0 auto;
    width: 24px;
    height: 24px;
    overflow: hidden;
    border-radius: 6px;
    background: #fff;
}

.dr-route-icon img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.dr-loading {
    margin-bottom: 10px;
    padding: 8px 12px;
    border-right: 3px solid var(--dr-accent);
    background: #fff;
    color: #666;
    font-size: 12px;
}

.dr-widget.is-loading .dr-results {
    opacity: .55;
    pointer-events: none;
}

.dr-empty-state {
    grid-column: 1 / -1;
    display: flex;
    min-height: 180px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 28px;
    border: 1px dashed #d7d7d7;
    background: #fff;
    color: #777;
    text-align: center;
}

.dr-empty-state p {
    margin: 0;
}

.dr-empty-icon {
    font-size: 32px;
    color: var(--dr-accent);
}

.dr-error-state {
    border-color: #e7b6bf;
    color: #a20d28;
}


.dr-location-modal[hidden] {
    display: none !important;
}

.dr-location-modal {
    position: fixed;
    z-index: 999999;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 20px;
    direction: rtl;
}

.dr-location-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, .56);
    backdrop-filter: blur(2px);
}

.dr-location-dialog {
    position: relative;
    z-index: 1;
    width: min(860px, 100%);
    max-height: calc(100vh - 40px);
    overflow: auto;
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 24px 70px rgba(0, 0, 0, .28);
}

.dr-location-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 18px;
    border-bottom: 1px solid #ececec;
}

.dr-location-title {
    margin: 0;
    font-size: 16px;
    font-weight: 800;
    color: #222;
}

.dr-location-close {
    appearance: none;
    display: inline-grid;
    place-items: center;
    width: 34px;
    height: 34px;
    padding: 0;
    border: 1px solid #e1e1e1;
    border-radius: 50%;
    background: #fff;
    color: #333;
    font: inherit;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
}

.dr-location-close:hover,
.dr-location-close:focus-visible {
    border-color: var(--dr-accent);
    color: var(--dr-accent);
    outline: none;
}

.dr-location-content {
    padding: 16px;
}

.dr-location-status {
    min-height: 24px;
    margin-bottom: 10px;
    color: #666;
    font-size: 12px;
}

.dr-location-status:empty {
    display: none;
}

.dr-location-status.is-error {
    padding: 12px;
    border-right: 3px solid var(--dr-accent);
    background: #fff4f6;
    color: #9d1230;
}

.dr-location-frame {
    display: block;
    width: 100%;
    height: min(520px, 62vh);
    border: 0;
    border-radius: 7px;
    background: #f3f3f3;
}

.dr-location-footer {
    padding: 0 16px 16px;
    text-align: left;
}

.dr-location-external {
    display: inline-flex;
    min-height: 38px;
    align-items: center;
    justify-content: center;
    padding: 6px 15px;
    border-radius: 6px;
    background: var(--dr-accent);
    color: #fff !important;
    text-decoration: none !important;
    font-size: 12px;
    font-weight: 700;
}

body.dr-location-modal-open {
    overflow: hidden;
}

.dr-editor-content {
    padding: 28px 0;
}

.dr-editor-content > :first-child {
    margin-top: 0;
}

.dr-editor-content > :last-child {
    margin-bottom: 0;
}

@media (max-width: 1100px) {
    .dr-representatives-layout {
        grid-template-columns: minmax(250px, 32%) minmax(0, 68%);
        gap: 18px;
    }
    .dr-results {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 780px) {
    .dr-tab-button {
        min-width: 145px;
        padding: 13px 18px;
        font-size: 14px;
    }
    .dr-filters {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    .dr-representatives-layout {
        grid-template-columns: 1fr;
    }
    .dr-map-column {
        position: static;
    }
    .dr-map-shell {
        min-height: 300px;
        max-width: 520px;
        margin: 0 auto;
    }
    .dr-results-column {
        margin-top: 4px;
    }
}

@media (max-width: 480px) {
    .dr-agent-card {
        grid-template-columns: 34px minmax(0, 1fr);
    }
    .dr-agent-body {
        padding: 14px 12px 12px;
    }
    .dr-agent-heading {
        gap: 8px;
    }
    .dr-city-badge {
        padding-inline: 9px;
    }
    .dr-routing-row {
        align-items: flex-start;
        flex-direction: column;
    }
}

@media (prefers-reduced-motion: reduce) {
    .dr-widget *,
    .dr-widget *::before,
    .dr-widget *::after {
        scroll-behavior: auto !important;
        transition-duration: .01ms !important;
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
    }
}
