/* =========================================================
   Location picker — map modal & field summary
   ========================================================= */

.wz-location {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.wz-location-card {
    display: flex;
    gap: 14px;
    align-items: flex-start;
    padding: 16px;
    border-radius: var(--wz-radius-sm);
    border: 1.5px dashed var(--wz-border);
    background: #f8f9fd;
    transition: border-color 0.2s, background 0.2s;
}

.wz-location-card.is-set {
    border-style: solid;
    border-color: rgba(59, 91, 253, 0.35);
    background: var(--wz-primary-soft);
}

.wz-location-icon {
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    background: #fff;
    color: var(--wz-primary);
    box-shadow: 0 2px 8px rgba(59, 91, 253, 0.12);
}

.wz-location-card.is-set .wz-location-icon {
    color: var(--wz-success);
}

.wz-location-status {
    font-size: 12px;
    font-weight: 600;
    color: var(--wz-text-soft);
    margin-bottom: 4px;
}

.wz-location-card.is-set .wz-location-status {
    color: var(--wz-success);
}

.wz-location-text {
    font-size: 14px;
    line-height: 1.55;
    color: var(--wz-text);
    word-break: break-word;
}

.wz-location-coords {
    margin-top: 6px;
    font-size: 12px;
    color: var(--wz-text-soft);
    direction: ltr;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.wz-location-open {
    width: 100%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

/* ---- Full-screen modal ---- */
body.wz-loc-open {
    overflow: hidden;
}

.wz-loc-modal {
    position: fixed;
    inset: 0;
    z-index: 1200;
    display: flex;
    align-items: stretch;
    justify-content: center;
}

.wz-loc-modal[hidden] {
    display: none !important;
}

.wz-loc-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(3px);
}

.wz-loc-sheet {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    max-height: 100dvh;
    min-height: 0;
    background: var(--wz-surface);
    animation: wzLocIn 0.26s ease;
    overflow: hidden;
}

@keyframes wzLocIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (min-width: 768px) {
    .wz-loc-modal {
        padding: 20px;
        align-items: center;
    }

    .wz-loc-sheet {
        width: min(760px, 100%);
        height: min(90vh, 860px);
        max-height: 90vh;
        border-radius: var(--wz-radius);
        box-shadow: 0 24px 64px rgba(15, 23, 42, 0.22);
    }
}

/* ---- Header (compact) ---- */
.wz-loc-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    padding-top: calc(10px + env(safe-area-inset-top));
    background: var(--wz-surface);
    flex-shrink: 0;
    border-bottom: 1px solid var(--wz-border);
}

.wz-loc-title {
    flex: 1;
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    text-align: center;
}

.wz-loc-header-spacer {
    width: 40px;
    flex-shrink: 0;
}

.wz-loc-icon-btn {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 10px;
    background: #f0f3fa;
    color: var(--wz-text);
    display: grid;
    place-items: center;
    cursor: pointer;
}

.wz-loc-icon-btn:active {
    transform: scale(0.96);
}

/* ---- Map stage (fills all space between header & bottom) ---- */
.wz-loc-stage {
    flex: 1;
    min-height: 0;
    position: relative;
    background: #dce3ef;
}

.wz-loc-map-wrap {
    position: absolute;
    inset: 0;
}

.wz-loc-map-loading {
    position: absolute;
    inset: 0;
    z-index: 600;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    background: #e8edf5;
    color: var(--wz-text-soft);
    font-size: 13px;
    font-weight: 600;
    transition: opacity 0.28s ease, visibility 0.28s ease;
    pointer-events: none;
}

.wz-loc-map-skeleton {
    position: absolute;
    inset: 0;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
    gap: 3px;
    padding: 3px;
    opacity: 0.55;
}

.wz-loc-map-skeleton span {
    border-radius: 4px;
    background: linear-gradient(
        110deg,
        #dde4f0 8%,
        #eef2f9 18%,
        #dde4f0 33%
    );
    background-size: 200% 100%;
    animation: wz-loc-skeleton-shimmer 1.4s ease-in-out infinite;
}

.wz-loc-map-skeleton span:nth-child(3n + 2) {
    animation-delay: 0.15s;
}

.wz-loc-map-skeleton span:nth-child(3n) {
    animation-delay: 0.3s;
}

@keyframes wz-loc-skeleton-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.wz-loc-map-wrap:not(.is-loading) .wz-loc-map-loading {
    opacity: 0;
    visibility: hidden;
}

.wz-loc-map-wrap.is-loading .wz-loc-map {
    opacity: 0;
    visibility: hidden;
}

.wz-loc-map-wrap.is-loading .wz-loc-pin,
.wz-loc-map-wrap.is-loading .wz-loc-search-float {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.wz-loc-map-wrap.is-loading .wz-loc-map .leaflet-control-zoom,
.wz-loc-map-wrap.is-loading .wz-loc-map .leaflet-control-attribution {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.wz-loc-map,
.wz-loc-pin,
.wz-loc-search-float {
    transition: opacity 0.28s ease, visibility 0.28s ease;
}

.wz-loc-map-spinner {
    position: relative;
    z-index: 1;
    width: 36px;
    height: 36px;
    border: 3px solid rgba(59, 91, 253, 0.18);
    border-top-color: var(--wz-primary);
    border-radius: 50%;
    animation: wz-loc-map-spin 0.75s linear infinite;
}

.wz-loc-map-loading-text {
    position: relative;
    z-index: 1;
}

@keyframes wz-loc-map-spin {
    to { transform: rotate(360deg); }
}

.wz-loc-map {
    width: 100%;
    height: 100%;
    z-index: 1;
}

.wz-loc-map .leaflet-container {
    background: #e8edf5 !important;
}

.wz-loc-map .leaflet-control-attribution {
    font-size: 9px;
    background: rgba(255, 255, 255, 0.82);
    border-radius: 6px 0 0 0;
    margin: 0;
    padding: 2px 6px;
}

.wz-loc-map .leaflet-control-zoom {
    border: none !important;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.14) !important;
    border-radius: 10px !important;
    overflow: hidden;
    margin-bottom: calc(12px + env(safe-area-inset-bottom)) !important;
    margin-left: 12px !important;
}

.wz-loc-map .leaflet-control-zoom a {
    width: 36px !important;
    height: 36px !important;
    line-height: 36px !important;
    font-size: 18px !important;
}

/* Center pin */
.wz-loc-pin {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, calc(-100% + 6px));
    z-index: 450;
    pointer-events: none;
    filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.28));
    transition: transform 0.15s ease;
}

.wz-loc-map-wrap.is-moving .wz-loc-pin {
    transform: translate(-50%, calc(-100% + 2px)) scale(1.06);
}

/* ---- Floating search (above map tiles) ---- */
.wz-loc-search-float {
    position: absolute;
    top: 12px;
    left: 12px;
    right: 12px;
    z-index: 500;
    pointer-events: none;
}

.wz-loc-search-panel {
    pointer-events: auto;
    border-radius: 18px;
    background: transparent;
    transition: box-shadow 0.22s ease, background 0.22s ease;
}

.wz-loc-search-panel.is-open {
    background: #fff;
    box-shadow:
        0 4px 6px rgba(28, 35, 51, 0.04),
        0 18px 48px rgba(28, 35, 51, 0.18);
    border: 1px solid rgba(59, 91, 253, 0.1);
}

.wz-loc-search-box {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #fff;
    border: 1.5px solid rgba(28, 35, 51, 0.08);
    border-radius: 18px;
    padding: 0 14px;
    min-height: 52px;
    box-shadow: 0 8px 28px rgba(28, 35, 51, 0.14);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.wz-loc-search-panel.is-open .wz-loc-search-box {
    border-color: transparent;
    box-shadow: none;
    border-radius: 18px 18px 0 0;
    border-bottom: none;
}

.wz-loc-search-box:focus-within {
    border-color: rgba(59, 91, 253, 0.35);
    box-shadow: 0 10px 32px rgba(59, 91, 253, 0.18);
}

.wz-loc-search-panel.is-open .wz-loc-search-box:focus-within {
    box-shadow: none;
    border-color: transparent;
}

.wz-loc-search-panel.is-pending .wz-loc-search-leading {
    animation: wz-loc-search-pulse 0.9s ease-in-out infinite;
}

@keyframes wz-loc-search-pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.65; transform: scale(0.96); }
}

.wz-loc-search-leading {
    flex-shrink: 0;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    display: grid;
    place-items: center;
    background: var(--wz-primary-soft);
    color: var(--wz-primary);
}

.wz-loc-search-ico {
    color: inherit;
    flex-shrink: 0;
}

.wz-loc-search-input {
    flex: 1;
    border: none;
    background: transparent;
    padding: 14px 0;
    font: inherit;
    font-size: 15px;
    outline: none;
    min-width: 0;
}

.wz-loc-search-input::placeholder {
    color: #9aa3b8;
}

.wz-loc-search-input::-webkit-search-cancel-button {
    display: none;
}

.wz-loc-search-clear {
    border: none;
    background: #eef1f8;
    color: var(--wz-text-soft);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.15s, color 0.15s, transform 0.12s;
}

.wz-loc-search-clear[hidden] {
    display: none !important;
}

.wz-loc-search-clear:hover {
    background: #e2e8f4;
    color: var(--wz-text);
}

.wz-loc-search-clear:active {
    transform: scale(0.94);
}

.wz-loc-results {
    margin: 0;
    padding: 0 6px 8px;
    list-style: none;
    background: transparent;
    border-radius: 0 0 18px 18px;
    max-height: min(48vh, 340px);
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: #c5cce8 transparent;
}

.wz-loc-search-panel:not(.is-open) .wz-loc-results {
    display: none !important;
}

.wz-loc-results[hidden] {
    display: none !important;
}

.wz-loc-results::-webkit-scrollbar {
    width: 6px;
}

.wz-loc-results::-webkit-scrollbar-thumb {
    background: #c5cce8;
    border-radius: 6px;
}

.wz-loc-results-head {
    padding: 10px 10px 8px;
    list-style: none;
    position: sticky;
    top: 0;
    z-index: 3;
    margin: 0;
    background: #fff;
    border-top: 1px solid #eef1f8;
    border-bottom: 1px solid #f3f5fa;
}

.wz-loc-results-head-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.wz-loc-results-head-title {
    font-size: 12px;
    font-weight: 800;
    color: var(--wz-text);
    letter-spacing: 0.01em;
}

.wz-loc-results-count {
    flex-shrink: 0;
    font-size: 11px;
    font-weight: 700;
    color: var(--wz-primary);
    background: var(--wz-primary-soft);
    padding: 4px 10px;
    border-radius: 999px;
}

.wz-loc-results-count--error {
    color: #dc2626;
    background: #fef2f2;
}

.wz-loc-results-query {
    margin-top: 3px;
    font-size: 11px;
    color: var(--wz-text-soft);
    padding-inline: 0;
}

.wz-loc-result {
    padding: 11px 10px;
    border-radius: 14px;
    cursor: pointer;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    transition: background 0.15s ease, box-shadow 0.15s ease, transform 0.12s ease;
    border: 1.5px solid transparent;
}

.wz-loc-result + .wz-loc-result {
    margin-top: 2px;
}

.wz-loc-result:hover,
.wz-loc-result:focus,
.wz-loc-result.is-active {
    background: linear-gradient(135deg, rgba(59, 91, 253, 0.07) 0%, rgba(59, 91, 253, 0.03) 100%);
    border-color: rgba(59, 91, 253, 0.18);
    outline: none;
    box-shadow: 0 4px 14px rgba(59, 91, 253, 0.08);
}

.wz-loc-result:active {
    transform: scale(0.995);
}

.wz-loc-result-icon {
    flex-shrink: 0;
    width: 46px;
    height: 46px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    color: var(--wz-primary);
    background: var(--wz-primary-soft);
    margin-top: 0;
}

.wz-loc-result-icon--city {
    color: #2563eb;
    background: #eff6ff;
}

.wz-loc-result-icon--village {
    color: #059669;
    background: #ecfdf5;
}

.wz-loc-result-icon--hamlet {
    color: #0d9488;
    background: #f0fdfa;
}

.wz-loc-result-icon--area {
    color: #d97706;
    background: #fffbeb;
}

.wz-loc-result-icon--street {
    color: #7c3aed;
    background: #f5f3ff;
}

.wz-loc-result-icon--place {
    color: var(--wz-primary);
    background: var(--wz-primary-soft);
}

.wz-loc-result-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.wz-loc-result-top {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.wz-loc-result-title {
    font-size: 15px;
    font-weight: 800;
    color: var(--wz-text);
    line-height: 1.35;
}

.wz-loc-result-badge {
    flex-shrink: 0;
    font-size: 10px;
    font-weight: 800;
    padding: 3px 9px;
    border-radius: 999px;
    background: #eef1f8;
    color: var(--wz-text-soft);
    letter-spacing: 0.02em;
}

.wz-loc-result-badge--city {
    color: #2563eb;
    background: #eff6ff;
}

.wz-loc-result-badge--village {
    color: #059669;
    background: #ecfdf5;
}

.wz-loc-result-badge--hamlet {
    color: #0d9488;
    background: #f0fdfa;
}

.wz-loc-result-badge--area {
    color: #d97706;
    background: #fffbeb;
}

.wz-loc-result-badge--street {
    color: #7c3aed;
    background: #f5f3ff;
}

.wz-loc-result-badge--place {
    color: var(--wz-primary);
    background: var(--wz-primary-soft);
}

.wz-loc-result-lines {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.wz-loc-result-line {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    min-width: 0;
}

.wz-loc-result-line-ico {
    flex-shrink: 0;
    margin-top: 2px;
    color: #a8b0c4;
}

.wz-loc-result-line--address .wz-loc-result-line-ico {
    color: #7c8aa8;
}

.wz-loc-result-line--region .wz-loc-result-line-ico,
.wz-loc-result-line--neighbourhood .wz-loc-result-line-ico {
    color: #b0b8ca;
}

.wz-loc-result-line-text {
    font-size: 12px;
    line-height: 1.55;
    color: var(--wz-text-soft);
    word-break: break-word;
}

.wz-loc-result-line--address .wz-loc-result-line-text {
    color: #5c667a;
}

.wz-loc-result-sub {
    font-size: 12px;
    color: var(--wz-text-soft);
    line-height: 1.45;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.wz-loc-result-go {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    margin-top: 8px;
    border-radius: 8px;
    display: grid;
    place-items: center;
    color: var(--wz-text-soft);
    background: #f3f5fa;
    opacity: 0.85;
    transition: opacity 0.15s, transform 0.15s, background 0.15s, color 0.15s;
}

.wz-loc-result:hover .wz-loc-result-go,
.wz-loc-result.is-active .wz-loc-result-go {
    opacity: 1;
    color: var(--wz-primary);
    background: var(--wz-primary-soft);
    transform: translateX(-2px);
}

.wz-loc-result--empty {
    cursor: default;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 6px;
    padding: 20px 16px 24px;
    border: none;
    box-shadow: none;
}

.wz-loc-result--empty:hover,
.wz-loc-result--empty:focus {
    background: transparent;
    border-color: transparent;
    box-shadow: none;
    transform: none;
}

.wz-loc-empty-icon {
    color: var(--wz-text-soft);
    opacity: 0.55;
    margin-bottom: 4px;
}

.wz-loc-empty-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--wz-text);
}

.wz-loc-empty-sub {
    font-size: 12px;
    color: var(--wz-text-soft);
    line-height: 1.5;
    max-width: 240px;
}

.wz-loc-result--skeleton {
    pointer-events: none;
    border-color: transparent;
    box-shadow: none;
}

.wz-loc-result--skeleton:hover {
    background: transparent;
    transform: none;
}

.wz-loc-skel-icon,
.wz-loc-skel-line {
    background: linear-gradient(90deg, #eef1f8 25%, #f8f9fd 50%, #eef1f8 75%);
    background-size: 200% 100%;
    animation: wz-loc-shimmer 1.2s ease-in-out infinite;
    border-radius: 8px;
}

.wz-loc-skel-icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
}

.wz-loc-skel-line {
    display: block;
    height: 10px;
}

.wz-loc-skel-line--title {
    width: 65%;
    margin-bottom: 8px;
}

.wz-loc-skel-line--sub {
    width: 88%;
    margin-bottom: 6px;
}

.wz-loc-skel-line--meta {
    width: 72%;
}

@keyframes wz-loc-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ---- Bottom panel (address + actions) ---- */
.wz-loc-bottom {
    flex-shrink: 0;
    background: var(--wz-surface);
    border-top: 1px solid var(--wz-border);
    padding: 12px 14px;
    padding-bottom: calc(12px + env(safe-area-inset-bottom));
    box-shadow: 0 -8px 24px rgba(28, 35, 51, 0.06);
}

.wz-loc-address-label {
    font-size: 11px;
    font-weight: 700;
    color: var(--wz-text-soft);
    margin-bottom: 4px;
    letter-spacing: 0.03em;
}

.wz-loc-address-text {
    font-size: 14px;
    line-height: 1.55;
    color: var(--wz-text);
    min-height: 1.4em;
    word-break: break-word;
}

.wz-loc-address-text.is-loading {
    color: var(--wz-text-soft);
}

.wz-loc-bottom--coords-only .wz-loc-address-label,
.wz-loc-bottom--coords-only .wz-loc-address-text {
    display: none;
}

.wz-loc-bottom--coords-only .wz-loc-coords {
    margin-bottom: 10px;
    font-size: 14px;
    font-weight: 600;
}

.wz-loc-coords {
    margin-top: 4px;
    font-size: 11px;
    color: var(--wz-text-soft);
    direction: ltr;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.wz-loc-footer {
    display: flex;
    gap: 10px;
    margin-top: 12px;
}

.wz-loc-gps {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.wz-loc-confirm {
    flex: 1;
}

@media (max-width: 420px) {
    .wz-loc-gps {
        font-size: 13px;
        padding-left: 12px;
        padding-right: 12px;
    }
}
