/**
 * Map With Shops V2 Styles
 * Matches the updated layout:
 * - Full-width warm beige header with horizontal divider lines & crisp rectangular county buttons
 * - Centered active county title (e.g. Tallinn, Harjumaa)
 * - Clean text tabs (E-POED / JAEMÜÜJAD) with amber underline matching screenshot
 * - Two-column layout: Map on LEFT, Shop list with Name / Address / Phone on RIGHT
 */

.map-shops-v2-wrapper {
    width: 100%;
    margin: 0 auto;
    font-family: inherit;
    box-sizing: border-box;
}

.map-shops-v2-wrapper *,
.map-shops-v2-wrapper *::before,
.map-shops-v2-wrapper *::after {
    box-sizing: border-box;
}

/* =========================================================
   TOP SECTION - REGION HEADER & COUNTY BUTTONS (FULL WIDTH)
   ========================================================= */
.v2-header-section {
    background-color: #f3eee7;
    padding: 45px 20px;
    width: 100%;
    text-align: center;
}

/* Stretches background 100% full width of screen edge-to-edge */
.v2-header-section.full-width-bg {
    width: 100vw;
    position: relative;
    left: 50%;
    right: 50%;
    margin-left: -50vw;
    margin-right: -50vw;
    box-sizing: border-box;
}

.v2-header-inner {
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
    padding: 0 15px;
}

.v2-header-title-wrap {
    margin-bottom: 28px;
}

.v2-header-title-wrap.with-dividers {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 24px;
}

.v2-header-title-wrap.with-dividers::before,
.v2-header-title-wrap.with-dividers::after {
    content: "";
    flex: 1;
    max-width: 320px;
    height: 1px;
    background-color: #777777;
}

.v2-header-title {
    margin: 0;
    padding: 0;
    font-size: 21px;
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: #222222;
    white-space: nowrap;
}

.v2-county-tabs {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: stretch;
    gap: 14px 16px;
    max-width: 1100px;
    margin: 0 auto;
}

.map-shops-v2-wrapper button.v2-county-tab,
.map-shops-v2-wrapper .v2-county-tab,
.v2-county-tab {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    box-sizing: border-box;
    width: 195px;
    min-width: 195px;
    max-width: 195px;
    height: 48px;
    min-height: 48px;
    padding: 8px 12px;
    margin: 0;
    font-size: 15px;
    font-weight: 500;
    line-height: 1.25;
    text-decoration: none;
    color: #222222;
    background-color: transparent;
    border: 1px solid #2e2e2e;
    border-radius: 0px;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease, transform 0.15s ease;
}

.map-shops-v2-wrapper button.v2-county-tab:hover,
.map-shops-v2-wrapper button.v2-county-tab:focus-visible,
.map-shops-v2-wrapper .v2-county-tab:hover,
.map-shops-v2-wrapper .v2-county-tab:focus-visible,
.v2-county-tab:hover,
.v2-county-tab:focus-visible {
    background-color: #e6ddd0 !important;
    border-color: #111111 !important;
    color: #111111 !important;
    outline: none !important;
}

.map-shops-v2-wrapper button.v2-county-tab.active,
.map-shops-v2-wrapper .v2-county-tab.active,
.v2-county-tab.active {
    background-color: #2b2b2b !important;
    border-color: #2b2b2b !important;
    color: #ffffff !important;
}

@media (max-width: 480px) {
    .v2-county-tabs {
        gap: 10px 10px !important;
        max-width: 380px !important;
        margin: 0 auto !important;
    }

    .map-shops-v2-wrapper button.v2-county-tab,
    .map-shops-v2-wrapper .v2-county-tab,
    .v2-county-tab {
        width: calc(50% - 6px) !important;
        min-width: 0 !important;
        max-width: calc(50% - 6px) !important;
        height: 46px !important;
        min-height: 46px !important;
        padding: 6px 6px !important;
        font-size: 13px !important;
        white-space: normal !important;
        line-height: 1.2 !important;
    }

    .map-shops-v2-wrapper button.v2-county-tab:first-child,
    .map-shops-v2-wrapper .v2-county-tab:first-child,
    .v2-county-tab:first-child {
        width: calc(100% - 0px) !important;
        max-width: 220px !important;
    }
}

/* =========================================================
   MAIN CONTENT SECTION - ACTIVE COUNTY TITLE & SUB-TABS
   ========================================================= */
.v2-content-section {
    background-color: #ffffff;
    padding: 45px 20px 50px;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

.v2-active-county-title {
    margin: 0 0 16px 0;
    padding: 0;
    text-align: center;
    font-size: 28px;
    font-weight: 700;
    line-height: 1.25;
    color: #1a1a1a;
    letter-spacing: 0.5px;
}

/* =========================================================
   SUB-TABS (E-POED / JAEMÜÜJAD) - EXACT MATCH SCREENSHOT
   ========================================================= */
.v2-subtabs-wrap {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 36px;
    margin: 0 0 35px 0;
    padding: 0;
    flex-wrap: wrap;
}

.map-shops-v2-wrapper .v2-subtabs-wrap button.v2-subtab,
.map-shops-v2-wrapper .v2-subtabs-wrap button.v2-city-tab,
.map-shops-v2-wrapper .v2-subtab,
.map-shops-v2-wrapper .v2-city-tab,
.v2-subtab,
.v2-city-tab {
    display: inline-block;
    position: relative;
    background: transparent !important;
    background-color: transparent !important;
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    padding: 0 0 8px 0 !important;
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 1.2px;
    text-transform: uppercase;
    color: #444444 !important;
    cursor: pointer;
    transition: color 0.2s ease;
    line-height: 1.3;
    opacity: 1 !important;
    visibility: visible !important;
}

.map-shops-v2-wrapper .v2-subtabs-wrap button.v2-subtab:hover,
.map-shops-v2-wrapper .v2-subtabs-wrap button.v2-subtab:focus,
.map-shops-v2-wrapper .v2-subtabs-wrap button.v2-subtab:focus-visible,
.map-shops-v2-wrapper .v2-subtabs-wrap button.v2-city-tab:hover,
.map-shops-v2-wrapper .v2-subtabs-wrap button.v2-city-tab:focus,
.map-shops-v2-wrapper .v2-subtabs-wrap button.v2-city-tab:focus-visible,
.map-shops-v2-wrapper .v2-subtab:hover,
.map-shops-v2-wrapper .v2-subtab:focus,
.map-shops-v2-wrapper .v2-subtab:focus-visible,
.map-shops-v2-wrapper .v2-city-tab:hover,
.map-shops-v2-wrapper .v2-city-tab:focus,
.map-shops-v2-wrapper .v2-city-tab:focus-visible,
.v2-subtab:hover,
.v2-subtab:focus,
.v2-subtab:focus-visible,
.v2-city-tab:hover,
.v2-city-tab:focus,
.v2-city-tab:focus-visible {
    color: #111111 !important;
    background: transparent !important;
    background-color: transparent !important;
    border: none !important;
    box-shadow: none !important;
    outline: none !important;
    opacity: 1 !important;
    visibility: visible !important;
}

.map-shops-v2-wrapper .v2-subtabs-wrap button.v2-subtab.active,
.map-shops-v2-wrapper .v2-subtabs-wrap button.v2-city-tab.active,
.map-shops-v2-wrapper .v2-subtab.active,
.map-shops-v2-wrapper .v2-city-tab.active,
.v2-subtab.active,
.v2-city-tab.active {
    color: #1a1a1a !important;
    font-weight: 700;
    background: transparent !important;
    background-color: transparent !important;
    opacity: 1 !important;
    visibility: visible !important;
}

.map-shops-v2-wrapper .v2-subtabs-wrap button.v2-subtab.active:hover,
.map-shops-v2-wrapper .v2-subtabs-wrap button.v2-subtab.active:focus,
.map-shops-v2-wrapper .v2-subtabs-wrap button.v2-city-tab.active:hover,
.map-shops-v2-wrapper .v2-subtabs-wrap button.v2-city-tab.active:focus,
.map-shops-v2-wrapper .v2-subtab.active:hover,
.map-shops-v2-wrapper .v2-subtab.active:focus,
.map-shops-v2-wrapper .v2-city-tab.active:hover,
.map-shops-v2-wrapper .v2-city-tab.active:focus,
.v2-subtab.active:hover,
.v2-subtab.active:focus,
.v2-city-tab.active:hover,
.v2-city-tab.active:focus {
    color: #1a1a1a !important;
    background: transparent !important;
    background-color: transparent !important;
}

/* Amber/Orange Underline */
.v2-subtab.active::after,
.v2-city-tab.active::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2.5px;
    background-color: #c99859;
    border-radius: 1px;
}

/* County Content Container */
.v2-county-contents {
    width: 100%;
    position: relative;
}

.v2-county-content {
    display: none;
    width: 100%;
}

.v2-county-content.active {
    display: block;
}

/* =========================================================
   TWO-COLUMN LAYOUT: MAP ON LEFT, SHOPS ON RIGHT
   ========================================================= */
.v2-layout {
    display: flex;
    gap: 36px;
    align-items: stretch;
    width: 100%;
}

/* Left Column - Map */
.v2-map-col {
    flex: 1 1 50%;
    min-width: 0;
    position: relative;
    z-index: 1;
}

.v2-map-container {
    width: 100%;
    height: 420px;
    border: 1px solid #dcdcdc;
    border-radius: 4px;
    overflow: hidden;
    position: relative;
    z-index: 1 !important;
    isolation: isolate;
    background-color: #e9e9e9;
}

.v2-leaflet-map {
    width: 100%;
    height: 100%;
    position: relative;
    z-index: 1 !important;
}

/* Constrain Leaflet internal layers so they NEVER overlap the site sticky header */
.v2-map-container .leaflet-pane,
.v2-map-container .leaflet-map-pane {
    z-index: 2 !important;
}

.v2-map-container .leaflet-tile-pane {
    z-index: 1 !important;
}

.v2-map-container .leaflet-overlay-pane {
    z-index: 3 !important;
}

.v2-map-container .leaflet-shadow-pane {
    z-index: 4 !important;
}

.v2-map-container .leaflet-marker-pane {
    z-index: 5 !important;
}

.v2-map-container .leaflet-tooltip-pane {
    z-index: 6 !important;
}

.v2-map-container .leaflet-popup-pane {
    z-index: 7 !important;
}

.v2-map-container .leaflet-top,
.v2-map-container .leaflet-bottom {
    z-index: 8 !important;
}

.v2-map-container .leaflet-control {
    z-index: 9 !important;
}

/* =========================================================
   LEAFLET POPUP STYLES (MODERN, CLEAN & PREMIUM CARD)
   ========================================================= */
.v2-map-container .leaflet-popup {
    margin-bottom: 12px;
}

.v2-map-container .leaflet-popup-content-wrapper {
    background: #ffffff !important;
    border-radius: 8px !important;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.16), 0 2px 8px rgba(0, 0, 0, 0.08) !important;
    padding: 0 !important;
    overflow: hidden !important;
    border: 1px solid rgba(0, 0, 0, 0.06) !important;
}

.v2-map-container .leaflet-popup-content {
    margin: 0 !important;
    line-height: normal !important;
    font-family: inherit !important;
}

.v2-map-container .leaflet-popup-tip {
    background: #ffffff !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12) !important;
}

.v2-map-container .leaflet-popup-close-button {
    top: 8px !important;
    right: 8px !important;
    width: 22px !important;
    height: 22px !important;
    border-radius: 50% !important;
    background: #f4f2ee !important;
    color: #666666 !important;
    font-size: 14px !important;
    line-height: 22px !important;
    text-align: center !important;
    padding: 0 !important;
    transition: all 0.2s ease !important;
    z-index: 10 !important;
}

.v2-map-container .leaflet-popup-close-button:hover {
    background: #e5e0d8 !important;
    color: #111111 !important;
}

/* Card layout */
.v2-map-popup-card {
    padding: 14px 16px 14px 14px;
    max-width: 250px;
    border-top: 3px solid #c99859;
    box-sizing: border-box;
}

.v2-popup-header {
    margin-bottom: 8px;
    padding-right: 18px; /* Room for close button */
}

.v2-popup-name {
    margin: 0;
    font-size: 14px;
    font-weight: 700;
    color: #1a1a1a;
    line-height: 1.3;
    letter-spacing: -0.1px;
    word-break: break-word;
}

.v2-popup-body {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.v2-popup-row {
    display: flex;
    align-items: flex-start;
    gap: 7px;
    font-size: 12.5px;
    line-height: 1.35;
    color: #4a4a4a;
}

.v2-popup-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-top: 1.5px;
    color: #c99859;
}

.v2-popup-text {
    flex: 1;
    word-break: break-word;
}

.v2-popup-phone-link {
    color: #4a4a4a;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s ease;
}

.v2-popup-phone-link:hover {
    color: #c99859;
    text-decoration: underline;
}

.v2-popup-footer {
    margin-top: 6px;
    padding-top: 8px;
    border-top: 1px solid #f0eee9;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.v2-popup-gmaps-link {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 11.5px;
    font-weight: 600;
    color: #1a73e8;
    text-decoration: none;
    transition: color 0.2s ease;
}

.v2-popup-gmaps-link:hover {
    color: #1558b0;
    text-decoration: underline;
}

.v2-popup-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 11.5px;
    font-weight: 600;
    color: #c99859;
    text-decoration: none;
    transition: all 0.2s ease;
}

.v2-popup-btn:hover {
    color: #a4763b;
    text-decoration: none;
    transform: translateX(2px);
}

/* Editor Placeholder */
.v2-editor-map-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    background-color: #f2f3f5;
    color: #777777;
    text-align: center;
    padding: 20px;
}

.v2-editor-map-placeholder .dashicons {
    font-size: 44px;
    margin-bottom: 12px;
    color: #ea4335;
}

/* Right Column - Shops List */
.v2-shops-col {
    flex: 1 1 50%;
    min-width: 0;
}

.v2-shops-col.full-width {
    flex: 1 1 100%;
}

.v2-shops-scroll {
    position: relative;
    max-height: 500px;
    overflow-y: auto;
    padding-right: 15px;
    scroll-behavior: smooth;
}

/* Clean custom scrollbar for shops column */
.v2-shops-scroll::-webkit-scrollbar {
    width: 5px;
}

.v2-shops-scroll::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.v2-shops-scroll::-webkit-scrollbar-thumb {
    background: #c99859;
    border-radius: 3px;
}

.v2-shops-scroll::-webkit-scrollbar-thumb:hover {
    background: #a97839;
}

/* City block */
.v2-city-block {
    display: block;
}

.v2-city-title {
    margin: 0 0 12px 0;
    font-size: 16px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: #1a1a1a;
}

.v2-shops-list {
    display: flex;
    flex-direction: column;
}

/* Shop Item */
.v2-shop-item {
    display: block;
    padding: 18px 12px;
    border-bottom: 1px solid #e5e5e5;
    text-decoration: none;
    color: inherit;
    cursor: pointer;
    transition: background-color 0.2s ease, padding-left 0.2s ease, border-left 0.2s ease;
    border-left: 3px solid transparent;
}

.v2-shop-item:last-child {
    border-bottom: 1px solid #e5e5e5;
}

.v2-shop-item:hover {
    background-color: #faf7f2;
    padding-left: 16px;
}

.v2-shop-item.click-active {
    background-color: rgba(201, 152, 89, 0.15) !important;
    border-left: 4px solid #c99859 !important;
    padding-left: 16px !important;
}

.v2-shop-name {
    font-size: 18px;
    font-weight: 700;
    line-height: 1.35;
    color: #1a1a1a;
    margin-bottom: 4px;
}

.v2-shop-address {
    font-size: 15px;
    font-weight: 400;
    line-height: 1.45;
    color: #444444;
    margin-bottom: 3px;
}

.v2-shop-phone {
    font-size: 15px;
    font-weight: 400;
    line-height: 1.45;
    color: #444444;
}

.v2-no-shops {
    font-size: 15px;
    color: #777777;
    padding: 20px 0;
}

/* =========================================================
   LEAFLET CUSTOM PIN & ZOOM CONTROL (GOOGLE MAPS VIBE)
   ========================================================= */
.v2-custom-marker {
    background: transparent !important;
    border: none !important;
}

.v2-pin-wrap {
    cursor: pointer;
    transition: transform 0.2s ease;
}

.v2-pin-wrap:hover {
    transform: scale(1.12);
}

/* Leaflet Zoom buttons matching Google Maps */
.v2-map-container .leaflet-control-zoom {
    border: none !important;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3) !important;
    border-radius: 3px !important;
    overflow: hidden;
    margin-bottom: 16px !important;
    margin-right: 16px !important;
}

.v2-map-container .leaflet-control-zoom a {
    width: 32px !important;
    height: 32px !important;
    line-height: 32px !important;
    font-size: 18px !important;
    color: #666666 !important;
    background-color: #ffffff !important;
    border-bottom: 1px solid #e6e6e6 !important;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.v2-map-container .leaflet-control-zoom a:last-child {
    border-bottom: none !important;
}

.v2-map-container .leaflet-control-zoom a:hover {
    background-color: #f7f7f7 !important;
    color: #111111 !important;
}

/* Popup style */
.v2-map-container .leaflet-popup-content-wrapper {
    border-radius: 4px;
    box-shadow: 0 3px 14px rgba(0, 0, 0, 0.25);
    padding: 8px 12px;
}

/* =========================================================
   RESPONSIVE STYLES
   ========================================================= */
@media (max-width: 991px) {
    .v2-layout {
        flex-direction: column;
        gap: 30px;
    }

    .v2-map-col,
    .v2-shops-col {
        flex: 1 1 100%;
        max-width: 100%;
    }

    .v2-map-container {
        height: 330px;
    }

    .v2-shops-scroll {
        max-height: 350px;
    }
}

@media (max-width: 767px) {
    .v2-header-section {
        padding: 30px 16px;
    }

    .v2-header-title-wrap.with-dividers {
        gap: 14px;
        margin-bottom: 20px;
    }

    .v2-header-title-wrap.with-dividers::before,
    .v2-header-title-wrap.with-dividers::after {
        max-width: 40px;
    }

    .v2-header-title {
        font-size: 17px;
        letter-spacing: 1.2px;
    }

    .v2-county-tabs {
        gap: 12px;
    }

    .map-shops-v2-wrapper button.v2-county-tab,
    .map-shops-v2-wrapper .v2-county-tab,
    .v2-county-tab {
        width: 175px;
        min-width: 175px;
        max-width: 175px;
        height: 46px;
        min-height: 46px;
        padding: 6px 10px;
        font-size: 13.5px;
    }

    .v2-content-section {
        padding: 30px 16px;
    }

    .v2-active-county-title {
        font-size: 22px;
        margin-bottom: 14px;
    }

    .v2-subtabs-wrap {
        gap: 14px 18px;
        margin-bottom: 20px;
        padding: 0 6px;
    }

    .map-shops-v2-wrapper .v2-subtabs-wrap button.v2-subtab,
    .map-shops-v2-wrapper .v2-subtabs-wrap button.v2-city-tab,
    .v2-subtab,
    .v2-city-tab {
        font-size: 13px !important;
        letter-spacing: 0.8px !important;
        padding: 0 0 6px 0 !important;
    }

    .v2-map-container {
        height: 340px !important;
    }

    .v2-shops-scroll {
        max-height: 340px;
    }

    .v2-shop-name {
        font-size: 16px;
    }

    .v2-shop-address,
    .v2-shop-phone {
        font-size: 14px;
    }
}

@media (max-width: 480px) {
    .v2-map-container {
        height: 340px !important;
    }

    .v2-shops-scroll {
        max-height: 320px !important;
    }

    .v2-subtabs-wrap {
        gap: 10px 14px !important;
        padding: 0 4px !important;
        margin-bottom: 18px !important;
    }

    .map-shops-v2-wrapper .v2-subtabs-wrap button.v2-subtab,
    .map-shops-v2-wrapper .v2-subtabs-wrap button.v2-city-tab,
    .v2-subtab,
    .v2-city-tab {
        font-size: 12px !important;
        letter-spacing: 0.5px !important;
    }

    /* Larger & Clearer Popup Box on mobile */
    .v2-map-container .leaflet-popup {
        max-width: 275px !important;
    }

    .v2-map-container .leaflet-popup-content-wrapper {
        border-radius: 8px !important;
        padding: 0 !important;
    }

    .v2-map-container .leaflet-popup-content {
        margin: 0 !important;
        max-width: 270px !important;
    }

    .v2-map-popup-card {
        padding: 13px 15px 13px 13px !important;
        max-width: 270px !important;
        border-top-width: 3px !important;
    }

    .v2-popup-header {
        margin-bottom: 8px !important;
        padding-right: 22px !important;
    }

    .v2-popup-name {
        font-size: 14.5px !important;
        line-height: 1.3 !important;
        font-weight: 700 !important;
    }

    .v2-popup-body {
        gap: 6px !important;
    }

    .v2-popup-row {
        gap: 7px !important;
        font-size: 13px !important;
        line-height: 1.35 !important;
    }

    .v2-popup-icon svg {
        width: 13.5px !important;
        height: 13.5px !important;
    }

    .v2-popup-footer {
        margin-top: 6px !important;
        padding-top: 7px !important;
        gap: 6px !important;
    }

    .v2-popup-gmaps-link {
        font-size: 12px !important;
        gap: 5px !important;
    }

    .v2-popup-gmaps-link svg {
        width: 12px !important;
        height: 12px !important;
    }

    .v2-popup-btn {
        font-size: 12px !important;
        gap: 5px !important;
    }

    .v2-popup-btn svg {
        width: 12px !important;
        height: 12px !important;
    }

    .v2-map-container .leaflet-popup-close-button {
        top: 7px !important;
        right: 7px !important;
        font-size: 14px !important;
        width: 22px !important;
        height: 22px !important;
        line-height: 22px !important;
    }
}
