/* 
 * Design Aesthetics: Clean, minimal, trustworthy.
 * White backgrounds, sharp typography, subtle borders.
 */

:root {
    --primary-blue: #2563eb;
    --primary-amber: #f59e0b;
    --slate-gray: #64748b;
    --border-color: #e2e8f0;
    --bg-white: #ffffff;
    --bg-light: #f8fafc;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --sidebar-width: 340px;
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

html, body.page-template-template-listing-map-layout {
    margin: 0;
    padding: 0;
    font-family: var(--font-family);
    background: var(--bg-white);
    overflow: hidden;
    height: 100%;
}

body.page-template-template-listing-map-layout #c27-site-wrapper {
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
}

body.page-template-template-listing-map-layout .slim-top-nav {
    flex-shrink: 0;
}

#explore-3-page-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

.mobile-hamburger {
    display: none;
    cursor: pointer;
    padding: 10px;
    margin-right: 10px;
}

@media (max-width: 768px) {
    .mobile-hamburger { display: block; }
}

.ml-child-side-drawer {
    position: fixed;
    top: 0;
    left: -280px;
    width: 280px;
    height: 100%;
    background: #fff;
    z-index: 3000;
    transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    box-shadow: 4px 0 15px rgba(0,0,0,0.1);
}

body.drawer-open .ml-child-side-drawer { left: 0; }

.ml-child-drawer-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ml-child-drawer-brand a {
    font-size: 18px;
    font-weight: 700;
    text-decoration: none;
}

.ml-child-drawer-close {
    background: none;
    border: none;
    padding: 5px;
    cursor: pointer;
}

.ml-child-drawer-content {
    flex-grow: 1;
    overflow-y: auto;
    padding: 20px 0;
}

#ml-child-side-drawer-nav {
    list-style: none;
    padding: 0;
    margin: 0;
}

#ml-child-side-drawer-nav li a {
    display: block;
    padding: 12px 20px;
    font-size: 15px;
    font-weight: 500;
    color: var(--text-main);
    text-decoration: none;
    transition: background 0.2s;
}

#ml-child-side-drawer-nav li a:hover {
    background: var(--bg-light);
    color: var(--primary-blue);
}

.ml-child-header-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0,0,0,0.4);
    z-index: 2500;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
}

body.drawer-open .ml-child-header-backdrop {
    opacity: 1;
    visibility: visible;
}

#explore-3-container.split-layout {
    display: flex;
    flex: 1;
    width: 100vw;
    height: 100%;
    overflow: hidden;
    position: relative;
}

#explore-3-sidebar {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    max-width: var(--sidebar-width);
    height: 100%;
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    background: var(--bg-white);
    z-index: 100;
    box-shadow: 2px 0 8px rgba(0,0,0,0.02);
    overflow: hidden;
    position: relative;
}

.sidebar-header {
    padding: 24px 20px;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

.site-logo {
    margin-bottom: 24px;
}

.site-logo a {
    font-size: 20px;
    font-weight: 700;
    text-decoration: none;
    letter-spacing: -0.02em;
}

.brand-ortho { color: var(--text-main); }
.brand-nearme { color: var(--primary-blue); }

.search-wrapper {
    position: relative;
    margin-bottom: 16px;
}

#e3-keyword {
    width: 100%;
    padding: 12px 40px 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.2s;
}

#e3-keyword:focus {
    outline: none;
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.location-detect {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--slate-gray);
    cursor: pointer;
    display: flex;
    align-items: center;
}

.location-detect:hover { color: var(--primary-blue); }

.filter-chips-wrapper {
    margin-bottom: 12px;
}

.filter-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.chip {
    padding: 3px 8px;
    background: var(--bg-light);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: var(--text-muted);
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.chip:hover {
    background: var(--bg-white);
    border-color: var(--primary-blue);
    color: var(--primary-blue);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.1);
}

.chip.active {
    background: var(--primary-blue);
    border-color: var(--primary-blue);
    color: #fff;
}

.results-meta {
    margin-top: 20px;
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 500;
}

.sidebar-scroll-area {
    flex: 1 1 0%;
    overflow-y: auto;
    background: #fdfdfd;
    min-height: 0;
    -webkit-overflow-scrolling: touch;
}

.e3-listing-card {
    display: flex;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: all 0.2s;
    background: var(--bg-white);
    align-items: center;
    box-sizing: border-box;
}

.e3-listing-card:hover { background: var(--bg-light); }

.e3-listing-card.active {
    background: #eff6ff;
    outline: 2px solid var(--primary-blue);
    outline-offset: -2px;
}

.e3-listing-card.is-featured {
    background: #f0f7ff;
}

.initials-avatar {
    width: 48px;
    height: 48px;
    min-width: 48px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 700;
    font-size: 16px;
    margin-right: 16px;
    text-transform: uppercase;
}

.initials-avatar.private { background: var(--primary-blue); }
.initials-avatar.corporate { background: var(--primary-amber); }

.card-info { flex-grow: 1; overflow: hidden; }

.e3-card-title {
    font-size: 13px;
    font-weight: 700;
    margin: 0 0 6px 0;
    line-height: 1.3;
    color: var(--text-main);
}
.e3-card-title a {
    color: inherit;
    text-decoration: none;
}
.e3-card-title a:hover {
    color: var(--primary-blue);
}

.e3-card-address {
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 10px;
    line-height: 1.4;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.card-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.badge {
    font-size: 10px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.badge-ownership { background: #f1f5f9; color: var(--slate-gray); border: 1px solid #e2e8f0; }
.badge-certified { background: #dcfce7; color: #166534; }
.badge-featured { background: #dbeafe; color: #1e40af; }

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-white);
    flex-shrink: 0;
}

.btn-add-practice {
    color: var(--primary-blue);
    font-weight: 600;
    font-size: 13px;
    text-decoration: none;
}

.free-text {
    color: var(--text-muted);
    font-size: 12px;
}

#explore-3-map-container {
    flex-grow: 1;
    position: relative;
    background: #e5e7eb;
}

#explore-3-map {
    width: 100%;
    height: 100%;
}

.map-legend {
    position: absolute;
    bottom: 24px;
    right: 24px;
    background: #fff;
    padding: 12px 16px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    z-index: 1100;
    display: flex;
    flex-direction: column;
    gap: 10px;
    border: 1px solid var(--border-color);
}

.legend-item {
    display: flex;
    align-items: center;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-main);
}

@media (max-width: 768px) {
    .map-legend {
        top: 20px;
        left: 20px;
        right: auto;
        bottom: auto;
        padding: 8px 12px;
        gap: 6px;
        box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    }
    .legend-item {
        font-size: 10px;
    }
}

.dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 8px;
}

.dot.private { background: var(--primary-blue); }
.dot.corporate { background: var(--primary-amber); }

.e3-details-view {
    padding: 0;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from { transform: translateX(-20px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

.e3-details-header {
    height: 200px;
    position: relative;
    background: #f1f5f9;
}

.e3-details-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.e3-back-btn {
    position: absolute;
    top: 16px;
    left: 16px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #fff;
    border: none;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
}

.e3-details-body {
    padding: 24px 20px;
}

.e3-details-title {
    font-size: 20px;
    font-weight: 800;
    margin: 0 0 12px 0;
    color: var(--text-main);
}

.details-badges {
    margin-bottom: 20px;
}

.loading-skeleton {
    padding: 16px 20px;
}
.skeleton-card {
    display: flex;
    gap: 16px;
    padding: 16px;
    background: #fff;
    border-radius: 12px;
    margin-bottom: 12px;
    border: 1px solid #f1f5f9;
}
.sk-avatar {
    width: 48px;
    height: 48px;
    border-radius: 8px;
    background: #f1f5f9;
    flex-shrink: 0;
}
.sk-content {
    flex: 1;
}
.sk-title {
    height: 16px;
    width: 60%;
    background: #f1f5f9;
    border-radius: 4px;
    margin-bottom: 8px;
}
.sk-address {
    height: 12px;
    width: 80%;
    background: #f1f5f9;
    border-radius: 4px;
    margin-bottom: 16px;
}
.sk-badges {
    display: flex;
    gap: 8px;
}
.sk-badge {
    height: 18px;
    width: 60px;
    background: #f1f5f9;
    border-radius: 4px;
}

.sk-avatar, .sk-title, .sk-address, .sk-badge {
    animation: skeleton-pulse 1.5s infinite ease-in-out;
}

@keyframes skeleton-pulse {
    0% { opacity: 0.5; }
    50% { opacity: 1; }
    100% { opacity: 0.5; }
}

@media (max-width: 1024px) {
    #explore-3-container.split-layout {
        flex-direction: column;
    }
    
    #explore-3-sidebar {
        width: 100% !important;
        min-width: 0 !important;
        max-width: none !important;
        height: 85vh;
        height: 85dvh;
        position: fixed;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        z-index: 2000;
        border-top: 1px solid var(--border-color);
        border-radius: 24px 24px 0 0;
        transform: translateY(calc(85dvh - 130px));
        transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
        box-shadow: 0 -10px 40px rgba(0,0,0,0.1);
        background: #fff;
    }

    #explore-3-sidebar .search-wrapper {
        margin-bottom: 20px !important;
    }

    #explore-3-sidebar.is-expanded {
        transform: translateY(0);
    }
    
    #explore-3-map-container {
        height: 100vh;
        height: 100dvh;
    }

    body.drawer-open #explore-3-sidebar {
        z-index: 1000;
    }
}

.custom-map-popup .leaflet-popup-content-wrapper {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.15);
    padding: 0;
    overflow: hidden;
}
.custom-map-popup .leaflet-popup-content {
    margin: 0;
    line-height: normal;
}
.custom-map-popup .leaflet-popup-tip {
    background: #fff;
    box-shadow: 0 10px 25px rgba(0,0,0,0.15);
}
.map-popup-card {
    padding: 16px;
    font-family: var(--font-family);
}
.map-popup-card .popup-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 6px;
    line-height: 1.3;
}
.map-popup-card .popup-address {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 12px;
}
.map-popup-card .popup-badge {
    display: inline-block;
    padding: 4px 10px;
    font-size: 11px;
    font-weight: 600;
    border-radius: 6px;
    text-transform: uppercase;
    margin-bottom: 14px;
    border: 1px solid transparent;
}
.map-popup-card .popup-btn {
    display: block;
    text-align: center;
    background: var(--primary-blue);
    color: #fff;
    text-decoration: none;
    padding: 8px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    transition: background 0.2s;
}
.map-popup-card .popup-btn:hover {
    background: #1d4ed8;
}

.single-job-listing.is-featured {
    background: #f0f7ff;
}

.single-job-listing .upgrade-cta-banner {
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.btn-upgrade-now:hover {
    background: #1d4ed8 !important;
}

.listing-main-info h1 {
    font-size: 32px !important;
    font-weight: 800 !important;
    letter-spacing: -0.025em;
    margin-bottom: 8px !important;
}

.pa-below-title .listing-rating {
    margin-right: 8px;
}

.e3-load-more-btn {
    width: 100%;
    background: var(--primary-blue);
    color: #fff !important;
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    text-transform: none;
    letter-spacing: normal;
}

.e3-load-more-btn:hover {
    background: #1d4ed8 !important;
}

.e3-load-more-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.e3-listing-card.is-free {
    background: var(--bg-white);
    border-bottom: 1px solid var(--border-color);
}

.e3-listing-card.is-featured {
    background: #eff6ff;
    border-left: 3px solid var(--primary-blue);
}
.e3-listing-card.is-featured:hover {
    background: #dbeafe;
}

.e3-card-phone {
    margin-bottom: 8px;
}
.e3-card-phone a {
    font-size: 12px;
    color: var(--primary-blue);
    text-decoration: none;
    font-weight: 500;
}
.e3-card-phone a:hover {
    text-decoration: underline;
}

.e3-card-reviews {
    margin-top: 6px;
    font-size: 12px;
    line-height: 1;
}
.e3-card-reviews .stars {
    color: #f59e0b;
    font-size: 13px;
    letter-spacing: 1px;
}
.e3-card-reviews .count {
    color: var(--text-muted);
    font-size: 11px;
    margin-left: 4px;
}

.e3-card-website-btn {
    display: inline-block;
    margin-top: 8px;
    padding: 4px 12px;
    background: var(--primary-blue);
    color: #fff !important;
    font-size: 11px;
    font-weight: 600;
    border-radius: 6px;
    text-decoration: none;
    transition: background 0.2s, transform 0.15s;
}
.e3-card-website-btn:hover {
    background: #1d4ed8;
    transform: translateY(-1px);
}

.details-meta {
    font-size: 14px;
    color: var(--text-muted);
    line-height: 1.6;
}

.e3-detail-website-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 12px;
    padding: 10px 20px;
    background: var(--primary-blue);
    color: #fff !important;
    font-size: 13px;
    font-weight: 600;
    border-radius: 8px;
    text-decoration: none;
    transition: background 0.2s, transform 0.15s;
}
.e3-detail-website-btn:hover {
    background: #1d4ed8;
    transform: translateY(-1px);
}

.e3-detail-reviews {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}
.e3-detail-reviews h4 {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-main);
    margin: 0 0 10px 0;
}
.e3-detail-reviews .review-summary {
    display: flex;
    align-items: center;
    gap: 8px;
}
.e3-detail-reviews .stars {
    color: #f59e0b;
    font-size: 18px;
    letter-spacing: 2px;
}
.e3-detail-reviews .rating-value {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-main);
}
.e3-detail-reviews .review-count {
    font-size: 13px;
    color: var(--text-muted);
}

.upgrade-cta {
    margin-top: 32px;
    padding: 20px;
    background: #f0f7ff;
    border: 1px solid #dbeafe;
    border-radius: 12px;
}
.upgrade-cta .upgrade-title {
    margin: 0 0 8px 0;
    font-size: 13px;
    font-weight: 600;
    color: #1e40af;
}
.upgrade-cta .upgrade-desc {
    margin: 0 0 14px 0;
    font-size: 12px;
    color: #3b82f6;
    line-height: 1.5;
}

.e3-details-view.is-featured-detail .e3-details-body {
    border-top: 3px solid var(--primary-blue);
}

@media (max-width: 768px) {
    .listing-main-info h1 {
        font-size: 24px !important;
    }
}

/* ============================================================
   MOBILE — Bottom sheet: tap target, drag handle, label, search
   ============================================================ */

@media (max-width: 1024px) {
    /* Hide non-essential elements when collapsed */
    #explore-3-sidebar:not(.is-expanded) .sidebar-scroll-area,
    #explore-3-sidebar:not(.is-expanded) #e3-sidebar-results,
    #explore-3-sidebar:not(.is-expanded) #e3-sidebar-details,
    #explore-3-sidebar:not(.is-expanded) .results-meta,
    #explore-3-sidebar:not(.is-expanded) .filter-chips-wrapper,
    #explore-3-sidebar:not(.is-expanded) .sidebar-footer,
    #explore-3-sidebar:not(.is-expanded) .site-logo {
        display: none !important;
    }

    #explore-3-sidebar:not(.is-expanded) {
        cursor: pointer;
    }

    #explore-3-sidebar .search-wrapper {
        display: block !important;
        position: relative;
    }

    /* Prevent iOS zoom on input focus */
    #e3-keyword {
        font-size: 16px !important;
        height: 44px;
    }

    /* Wide invisible tap target across the top strip */
    #explore-3-sidebar::before {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        height: 50px;
        background: transparent;
        z-index: 3;
        cursor: pointer;
    }

    /* Visible drag handle pill */
    #explore-3-sidebar::after {
        content: '';
        position: absolute;
        top: 8px;
        left: 50%;
        transform: translateX(-50%);
        width: 60px;
        height: 6px;
        background: #cbd5e1;
        border-radius: 3px;
        z-index: 2;
        pointer-events: none;
        transition: background 0.2s;
    }

    /* Press feedback */
    #explore-3-sidebar:active::after {
        background: #94a3b8;
    }

    /* Instructional label (text set by JS) */
    .onm-sheet-label {
        position: absolute;
        top: 22px;
        left: 50%;
        transform: translateX(-50%);
        font-size: 11px;
        font-weight: 700;
        color: #64748b;
        letter-spacing: 0.04em;
        z-index: 2;
        pointer-events: none;
        white-space: nowrap;
        text-transform: uppercase;
        transition: color 0.2s;
    }
    #explore-3-sidebar:active .onm-sheet-label {
        color: #2563eb;
    }

    /* Push header content below handle + label */
    #explore-3-sidebar .sidebar-header {
        padding: 50px 20px 20px !important;
    }
    #explore-3-sidebar:not(.is-expanded) .sidebar-header {
        padding: 44px 20px 16px !important;
    }
}

/* Hide the label entirely on desktop */
@media (min-width: 1025px) {
    .onm-sheet-label { display: none !important; }
}