/* Location SEO Manager - Frontend Selector Widget */

.lsm-selector-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 99999;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, sans-serif;
    font-size: 14px;
}

/* Position variants — controlled by PHP body class or JS */
.lsm-position-bottom-left .lsm-selector-widget,
body[data-lsm-position="bottom-left"] .lsm-selector-widget {
    left: 20px;
    right: auto;
}

body[data-lsm-position="top-right"] .lsm-selector-widget {
    top: 20px;
    bottom: auto;
    right: 20px;
}

body[data-lsm-position="top-left"] .lsm-selector-widget {
    top: 20px;
    bottom: auto;
    left: 20px;
    right: auto;
}

/* Toggle Button */
.lsm-selector-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    background: #1d2327;
    color: #fff;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
    transition: all 0.2s ease;
    line-height: 1;
}

.lsm-selector-toggle:hover {
    background: #2c3338;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.25);
    transform: translateY(-1px);
}

.lsm-selector-toggle svg {
    flex-shrink: 0;
}

.lsm-chevron {
    transition: transform 0.2s ease;
}

.lsm-selector-toggle[aria-expanded="true"] .lsm-chevron {
    transform: rotate(180deg);
}

/* Dropdown */
.lsm-selector-dropdown {
    position: absolute;
    bottom: calc(100% + 8px);
    right: 0;
    width: 280px;
    max-height: 400px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.05);
    overflow: hidden;
    animation: lsmSlideUp 0.2s ease;
}

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

.lsm-dropdown-header {
    padding: 14px 16px;
    font-weight: 600;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #646970;
    border-bottom: 1px solid #eee;
    background: #f9f9f9;
}

.lsm-dropdown-list {
    max-height: 340px;
    overflow-y: auto;
    padding: 6px 0;
}

.lsm-dropdown-list::-webkit-scrollbar {
    width: 6px;
}

.lsm-dropdown-list::-webkit-scrollbar-track {
    background: transparent;
}

.lsm-dropdown-list::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

/* Location Items */
.lsm-location-item {
    display: block;
    padding: 10px 16px;
    color: #1d2327;
    text-decoration: none;
    transition: background 0.15s ease;
    cursor: pointer;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    font-size: 14px;
}

.lsm-location-item:hover {
    background: #f0f0f1;
    color: #1d2327;
    text-decoration: none;
}

.lsm-location-item.lsm-active {
    background: #e8f0fe;
    color: #1a73e8;
    font-weight: 500;
}

.lsm-location-item.lsm-active::before {
    content: "✓ ";
}

/* Country Group */
.lsm-country-group {
    border-bottom: 1px solid #f0f0f1;
}

.lsm-country-group:last-child {
    border-bottom: none;
}

.lsm-country-header {
    display: flex;
    align-items: center;
}

.lsm-country-header .lsm-country-link {
    flex: 1;
    font-weight: 500;
}

.lsm-expand-btn {
    padding: 10px 14px;
    background: none;
    border: none;
    cursor: pointer;
    color: #646970;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.lsm-expand-btn:hover {
    color: #1d2327;
}

.lsm-expand-btn.lsm-expanded svg {
    transform: rotate(180deg);
}

/* City Items */
.lsm-city-item {
    padding-left: 32px;
    font-size: 13px;
    color: #50575e;
}

.lsm-city-item:hover {
    color: #1d2327;
}

/* ─── Full Locations Page (/locations/) ─── */
.lsm-locations-page {
    max-width: 1200px;
    margin: 0 auto;
    padding: 50px 20px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, sans-serif;
}

.lsm-locations-header {
    text-align: center;
    margin-bottom: 40px;
}

.lsm-locations-header h1 {
    font-size: 32px;
    margin: 0 0 8px;
    color: #1d2327;
}

.lsm-locations-header p {
    color: #646970;
    font-size: 16px;
    margin: 0;
}

.lsm-locations-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 20px;
}

.lsm-location-card {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    padding: 22px;
    transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.lsm-location-card:hover {
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
    border-color: #c5c5c5;
}

.lsm-location-card.lsm-card-active {
    border-color: #1a73e8;
    border-width: 2px;
}

.lsm-card-title {
    margin: 0 0 8px;
    font-size: 18px;
}

.lsm-card-title a {
    color: #1d2327;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.lsm-card-title a:hover {
    color: #1a73e8;
}

.lsm-active-badge {
    background: #1a73e8;
    color: #fff;
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 500;
}

.lsm-card-desc {
    color: #646970;
    font-size: 13px;
    margin: 0 0 12px;
    line-height: 1.5;
}

.lsm-card-cities {
    list-style: none;
    margin: 0;
    padding: 0;
}

.lsm-card-cities li {
    margin: 0;
}

.lsm-card-cities a {
    display: block;
    padding: 7px 0;
    color: #50575e;
    text-decoration: none;
    border-top: 1px solid #f0f0f1;
    font-size: 14px;
}

.lsm-card-cities a:hover {
    color: #1a73e8;
}

.lsm-card-cities a.lsm-city-active {
    color: #1a73e8;
    font-weight: 500;
}

.lsm-card-visit {
    display: inline-block;
    margin-top: 8px;
    color: #1a73e8;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
}

.lsm-card-visit:hover {
    text-decoration: underline;
}

.lsm-locations-empty {
    text-align: center;
    color: #646970;
    padding: 40px;
}

/* ─── Market Directory (responsive grid, no tables) ─── */
.lsm-market-wrap {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, sans-serif;
    margin: 0 auto;
    padding: 20px 0;
}

.lsm-market-heading {
    font-size: 22px;
    font-weight: 700;
    color: #1d2327;
    margin: 30px 0 16px;
    padding-bottom: 10px;
    border-bottom: 2px solid #E67E22;
}
.lsm-market-heading:first-child { margin-top: 0; }

.lsm-market-row {
    display: flex;
    flex-wrap: wrap;
    margin: 0 -10px;
}

.lsm-market-col {
    padding: 0 10px;
    margin-bottom: 20px;
    box-sizing: border-box;
}

/* Column variants */
.lsm-market-cols-2 .lsm-market-col { flex: 0 0 50%; max-width: 50%; }
.lsm-market-cols-3 .lsm-market-col { flex: 0 0 33.3333%; max-width: 33.3333%; }
.lsm-market-cols-4 .lsm-market-col { flex: 0 0 25%; max-width: 25%; }

@media (max-width: 991px) {
    .lsm-market-cols-3 .lsm-market-col,
    .lsm-market-cols-4 .lsm-market-col { flex: 0 0 50%; max-width: 50%; }
}

@media (max-width: 575px) {
    .lsm-market-cols-2 .lsm-market-col,
    .lsm-market-cols-3 .lsm-market-col,
    .lsm-market-cols-4 .lsm-market-col { flex: 0 0 100%; max-width: 100%; }
}

/* Solo country pill (country with no cities) */
.lsm-country-pill {
    display: block;
    padding: 14px 18px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    color: #1d2327;
    text-decoration: none;
    font-size: 15px;
    font-weight: 600;
    text-align: center;
    transition: all 0.2s ease;
}

.lsm-country-pill:hover {
    border-color: #E67E22;
    color: #E67E22;
    background: #fef5eb;
    text-decoration: none;
    transform: translateY(-2px);
    box-shadow: 0 4px 14px rgba(230, 126, 34, 0.15);
}

.lsm-country-pill.lsm-pill-active {
    border-color: #E67E22;
    background: #fef0e0;
    color: #E67E22;
}

/* Per-country section (country heading + responsive city grid) */
.lsm-country-section {
    margin-bottom: 30px;
}

.lsm-country-section-head {
    font-size: 18px;
    font-weight: 700;
    color: #1d2327;
    margin: 0 0 14px;
    padding-bottom: 8px;
    border-bottom: 2px solid #E67E22;
}

.lsm-country-section-head a {
    color: inherit;
    text-decoration: none;
}

.lsm-country-section-head a:hover {
    color: #E67E22;
    text-decoration: none;
}

.lsm-country-section-head.lsm-section-active a {
    color: #E67E22;
}

.lsm-city-grid {
    display: grid;
    gap: 10px;
}

.lsm-city-cols-2 { grid-template-columns: repeat(2, 1fr); }
.lsm-city-cols-3 { grid-template-columns: repeat(3, 1fr); }
.lsm-city-cols-4 { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 991px) {
    .lsm-city-cols-3,
    .lsm-city-cols-4 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 575px) {
    .lsm-city-cols-2,
    .lsm-city-cols-3,
    .lsm-city-cols-4 { grid-template-columns: 1fr; }
}

.lsm-city-link {
    display: block;
    padding: 8px 12px;
    background: #f7f7f8;
    border: 1px solid #ececef;
    border-radius: 6px;
    color: #50575e;
    text-decoration: none;
    font-size: 13.5px;
    transition: all 0.15s ease;
}

.lsm-city-link:hover {
    background: #fef5eb;
    border-color: #E67E22;
    color: #E67E22;
    text-decoration: none;
}

.lsm-city-link.lsm-city-on {
    background: #fef0e0;
    border-color: #E67E22;
    color: #E67E22;
    font-weight: 600;
}

/* ─── Legacy Grid Wrapper (kept for backwards compat) ─── */
.lsm-grid-wrap {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, sans-serif;
    margin: 0 auto;
    padding: 20px 0;
}

.lsm-grid-wrap .lsm-locations-grid {
    display: grid;
    gap: 20px;
}

.lsm-cols-2 .lsm-locations-grid { grid-template-columns: repeat(2, 1fr); }
.lsm-cols-3 .lsm-locations-grid { grid-template-columns: repeat(3, 1fr); }
.lsm-cols-4 .lsm-locations-grid { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 900px) {
    .lsm-cols-3 .lsm-locations-grid,
    .lsm-cols-4 .lsm-locations-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
    .lsm-cols-2 .lsm-locations-grid,
    .lsm-cols-3 .lsm-locations-grid,
    .lsm-cols-4 .lsm-locations-grid { grid-template-columns: 1fr; }
}

/* Flat tile grid (cities without countries) */
.lsm-flat-grid {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)) !important;
}

.lsm-location-tile {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px 18px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    text-decoration: none;
    color: #1d2327;
    font-size: 15px;
    font-weight: 500;
    transition: all 0.2s ease;
    position: relative;
}

.lsm-location-tile:hover {
    border-color: #1a73e8;
    color: #1a73e8;
    box-shadow: 0 4px 14px rgba(26, 115, 232, 0.12);
    transform: translateY(-2px);
    text-decoration: none;
}

.lsm-location-tile.lsm-tile-active {
    border-color: #1a73e8;
    background: #e8f0fe;
    color: #1a73e8;
}

.lsm-tile-icon {
    flex-shrink: 0;
    color: #646970;
    display: flex;
    align-items: center;
}

.lsm-location-tile:hover .lsm-tile-icon,
.lsm-location-tile.lsm-tile-active .lsm-tile-icon {
    color: #1a73e8;
}

.lsm-tile-name {
    flex: 1;
}

/* Standalone pills section */
.lsm-standalone-section {
    margin-top: 36px;
}

.lsm-standalone-title {
    font-size: 18px;
    color: #1d2327;
    margin: 0 0 16px;
    font-weight: 600;
}

.lsm-standalone-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.lsm-standalone-pill {
    display: inline-block;
    padding: 8px 16px;
    background: #f0f0f1;
    border-radius: 50px;
    color: #1d2327;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.lsm-standalone-pill:hover {
    background: #1a73e8;
    color: #fff;
    text-decoration: none;
}

.lsm-standalone-pill.lsm-pill-active {
    background: #1a73e8;
    color: #fff;
}

@media (max-width: 480px) {
    .lsm-locations-header h1 { font-size: 26px; }
    .lsm-locations-grid { grid-template-columns: 1fr; }

    .lsm-selector-widget {
        bottom: 12px;
        right: 12px;
    }

    .lsm-selector-dropdown {
        width: calc(100vw - 24px);
        right: 0;
        max-height: 60vh;
    }

    .lsm-selector-toggle {
        padding: 8px 14px;
        font-size: 13px;
    }
}