/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* General Button Styles - Applied to all buttons with .legend-btn class */
.legend-btn {
    /* Base button styles */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 16px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    background: white;
    color: #1d1d1f;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
    white-space: nowrap;
    position: relative;
}

/* Inactive State (Default) */
.legend-btn:not(.active):not(:disabled) {
    background: #f8f9fa;
    border-color: rgba(0, 0, 0, 0.15);
    color: #6b7280;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.legend-btn:not(.active):not(:disabled) i {
    color: #6b7280;
    opacity: 0.8;
}

/* Enabled State (Hover) */
.legend-btn:not(.active):not(:disabled):hover {
    background: #e9ecef;
    border-color: rgba(0, 0, 0, 0.25);
    color: #495057;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.legend-btn:not(.active):not(:disabled):hover i {
    color: #495057;
    opacity: 1;
}

/* Active State */
.legend-btn.active {
    background: #1d1d1f;
    border-color: #1d1d1f;
    color: white;
    box-shadow: 0 2px 8px rgba(29, 29, 31, 0.3);
}

.legend-btn.active i {
    color: white;
    opacity: 1;
}

.legend-btn.active:hover {
    background: #333;
    border-color: #333;
    transform: translateY(-1px);
    box-shadow: 0 3px 12px rgba(29, 29, 31, 0.4);
}

/* Loading State for ZIP Button */
#zipBoundary.loading {
    background: #1d1d1f !important;
    border-color: #1d1d1f !important;
    color: white !important;
    cursor: wait !important;
    box-shadow: 0 2px 8px rgba(29, 29, 31, 0.3) !important;
    transform: none !important;
}

#zipBoundary.loading i {
    color: white !important;
    opacity: 1 !important;
}

#zipBoundary.loading:hover {
    background: #1d1d1f !important;
    border-color: #1d1d1f !important;
    transform: none !important;
    box-shadow: 0 2px 8px rgba(29, 29, 31, 0.3) !important;
}

/* Spinning animation for loading spinner */
.animate-spin {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

/* Disabled State */
.legend-btn:disabled {
    background: #f1f3f4;
    border-color: rgba(0, 0, 0, 0.1);
    color: #9aa0a6;
    cursor: not-allowed;
    pointer-events: none;
    opacity: 0.6;
    box-shadow: none;
}

.legend-btn:disabled i {
    color: #9aa0a6;
    opacity: 0.5;
}

.legend-btn:disabled:hover {
    transform: none;
    box-shadow: none;
}

/* Pressed State */
.legend-btn:active {
    transform: translateY(0);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
}

/* Button Variants */
.legend-btn.primary {
    background: #007AFF;
    border-color: #007AFF;
    color: white;
}

.legend-btn.primary:hover {
    background: #0056CC;
    border-color: #0056CC;
}

.legend-btn.danger {
    background: #ef4444;
    border-color: #ef4444;
    color: white;
}

.legend-btn.danger:hover {
    background: #dc2626;
    border-color: #dc2626;
}

.legend-btn.success {
    background: #10b981;
    border-color: #10b981;
    color: white;
}

.legend-btn.success:hover {
    background: #059669;
    border-color: #059669;
}

.legend-btn.secondary {
    background: #f1f1f1;
    border-color: #d1d5db;
    color: #6b7280;
}

.legend-btn.secondary:hover {
    background: #e5e7eb;
    border-color: #9ca3af;
    color: #374151;
}

/* Sync Script Button - Expand to fit text */
#sync-script-btn {
    width: auto !important;
    min-width: 40px;
    padding: 8px 12px;
    white-space: nowrap;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: transparent;
    color: #333;
    line-height: 1.6;
    overflow: hidden;
}

/* Top Navigation */
.top-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 78px;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    border-bottom: 0.5px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2%;
    z-index: 1000;
}

.nav-left {
    display: flex;
    align-items: center;
    flex: 0 0 auto;
}

.nav-title {
    font-size: 18px;
    font-weight: 600;
    color: white;
    margin: 0;
    letter-spacing: -0.01em;
}

.nav-tabs {
    display: flex;
    align-items: center;
    gap: 12px;
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
}

.nav-tab {
    background: rgba(0, 0, 0, 0.3);
    border: none;
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 18px;
    font-weight: 400;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    display: block;
    width: 120px;
    height: 40px;
    text-align: center;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    box-sizing: border-box;
}

.nav-tab:hover {
    background: rgba(0, 0, 0, 1);
}

.nav-tab:focus {
    outline: none;
    background: rgba(0, 0, 0, 0.8);
}

.nav-tab:active {
    background: rgba(0, 0, 0, 1);
    transform: scale(0.98);
}

/* Remove pointer-events: none to allow clicking on text */

.nav-tab.active {
    background: rgba(0, 0, 0, 1);
    font-weight: 500;
}

.nav-right {
    display: flex;
    align-items: center;
    flex: 0 0 auto;
}

/* Location Search with Dropdown */
.search-container {
    position: fixed;
    top: 102px;
    left: 24px;
    z-index: 1001;
}

.location-search-field {
    position: relative;
    width: 360px;
}

.location-search-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.2s ease;
}

.location-search-wrapper:focus-within {
    background: rgba(255, 255, 255, 1);
    border-color: #00d4ff;
    box-shadow: 0 4px 12px rgba(0, 212, 255, 0.2);
}

.location-search-input {
    flex: 1;
    padding: 12px 16px;
    background: transparent;
    border: none;
    color: #1d1d1f;
    font-size: 15px;
    outline: none;
}

.location-search-input::placeholder {
    color: #86868b;
}

.location-dropdown-toggle {
    padding: 12px 16px;
    background: transparent;
    border: none;
    color: #86868b;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s, color 0.2s;
}

.location-dropdown-toggle:hover {
    background: rgba(0, 0, 0, 0.05);
    color: #1d1d1f;
}

.location-dropdown-toggle svg {
    width: 18px;
    height: 18px;
}

.location-dropdown {
    position: absolute;
    top: 52px;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    max-height: 400px;
    overflow-y: auto;
    display: none;
    width: 100%;
    margin-top: 4px;
}

.location-dropdown.show {
    display: block;
}

.location-dropdown-content {
    padding: 8px 0;
}

.dropdown-section-header {
    padding: 8px 16px;
    font-size: 12px;
    font-weight: 600;
    color: #86868b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.location-option {
    display: flex;
    align-items: center;
    padding: 10px 16px;
    cursor: pointer;
    transition: background-color 0.2s;
    font-size: 14px;
    color: #1d1d1f;
}

.location-option:hover {
    background: #f5f5f5;
}

.location-option-name {
    flex: 1;
    font-weight: 500;
}

.location-option-counts {
    font-size: 13px;
    color: #86868b;
    margin-left: 12px;
}

/* Universal City Search Results (for both drawer and map) */
.universal-city-results {
    padding: 8px 0;
}

.universal-city-option {
    display: flex;
    align-items: center;
    padding: 10px 16px;
    cursor: pointer;
    transition: background-color 0.2s;
    font-size: 14px;
    color: #1d1d1f;
}

.universal-city-option:hover {
    background: #f5f5f5;
}

.market-divider {
    padding: 8px 0;
    border-top: 1px solid #e0e0e0;
    margin-top: 8px;
}

/* Drawer Toggle Container */
.drawer-toggle-container {
    position: fixed;
    top: 102px;
    right: 24px;
    z-index: 1001;
    transition: all 0.3s ease;
}

.drawer-toggle-container.drawer-open {
    right: 504px; /* 480px drawer + 24px spacing */
    top: 102px;
}

/* Drawer Toggle Button */
.drawer-toggle {
    width: 48px;
    height: 48px;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    color: black;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.drawer-toggle:hover {
    background: #f9fafb;
    transform: scale(1.05);
}

.drawer-toggle i {
    width: 20px;
    height: 20px;
}

/* Main Content */
.main-content {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    height: 100vh;
    width: 100vw;
}

/* Tab Content */
.tab-content {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    display: none;
}

.tab-content.active {
    display: block;
}

/* Map */
.map {
    width: 100%;
    height: 100%;
    position: relative;
}

.buttons-container {
    position: fixed;
    top: 102px;
    left: 398px;
    z-index: 9999;
    display: flex;
    flex-direction: row;
    gap: 16px;
}

.load-locations-btn {
    padding: 16px;
    background: #000000;
    border: none;
    border-radius: 8px;
    color: #ffffff;
    height: 42px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    outline: none;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    min-width: 120px;
}

.load-locations-btn .btn-text {
    min-width: 40px;
    text-align: center;
}

#load-locations-btn-2 {
    gap: 6px;
}

.load-locations-btn:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.load-locations-btn:active {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* Map Legend */
.search-container {
    position: fixed;
    top: 100px;
    left: 2%;
    z-index: 1001;
}

.legend-container {
    position: fixed;
    bottom: 4%;
    left: 2%;
    z-index: 1001;
    background: white;
    border-radius: 16px;
    padding: 16px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    width: 100px;
}

.legend-buttons {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 12px;
}

/* Legend-specific button styling - inherits from general .legend-btn */
.legend-btn {
    padding: 12px;
    min-height: 44px;
}

/* Red state for refresh button when marker limit reached */
.legend-btn.limit-reached {
    background: #ff4444 !important;
    border-color: #ff4444 !important;
}

.legend-btn.limit-reached i {
    color: white !important;
}

/* Hide refresh button from legend */
#refresh-btn {
    display: none !important;
}

/* Hide denoise and generalize controls */
#denoise, #generalize, label[for="denoise"], label[for="generalize"] {
    display: none !important;
}

/* Hide zip code button from legend */
/* ZIP boundary button is now enabled */

/* Hide legend count numbers, keep only headers and color dots */
#reflexer-count, #retailer-count {
    display: none !important;
}

.legend-btn-full-width {
    width: 100%;
}

.legend-content {
    /* No background or border - clean legend content */
}

.legend-title {
    font-weight: 600;
    margin-bottom: 8px;
    color: #1d1d1f;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.legend-item {
    display: flex;
    flex-direction: column;
    margin-bottom: 6px;
}

.legend-header {
    display: flex;
    align-items: center;
    margin-bottom: 2px;
}

.legend-item:last-child {
    margin-bottom: 0;
}

.legend-pin {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin-right: 8px;
    border: 2px solid #ffffff;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.5);
    margin-top: 2px;
    flex-shrink: 0;
}

.reflexer-pin {
    background-color: #000000;
    border: 2px solid #ffffff;
}

.retailer-pin {
    background-color: #00d4ff;
    transform: scale(0.85);
}

.legend-label {
    color: #1d1d1f;
    font-weight: 500;
    font-size: 11px;
}

.legend-text {
    display: flex;
    flex-direction: column;
    margin-left: 0;
    flex: 1;
}

.legend-count {
    font-size: 10px;
    color: #888;
    margin-left: 0;
    margin-top: 0;
    font-weight: 500;
    line-height: 1.4;
    font-family: monospace;
    text-align: left;
}

.legend-line {
    width: 20px;
    height: 2px;
    margin-right: 8px;
}

.isochrone-line {
    background: #8B5CF6;
    border: 1px dashed #8B5CF6;
}

.zipcode-line {
    background: transparent;
    border: 1px dashed #000;
}

/* Custom Map Markers */
.custom-marker {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: 1px solid white;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.5);
    cursor: pointer;
    transition: all 0.2s ease;
}

/* Pin markers have no fill background */
.custom-marker.icon-marker {
    background: none;
    border: none;
    box-shadow: none;
}

.retailer-marker {
    width: 15px;
    height: 15px;
}

.custom-marker:hover {
    transform: scale(1.2);
    box-shadow: none;
}

.custom-marker.pin:hover {
    transform: scale(1.1);
}

.reflexer-marker {
    background-color: #000000;
    border: 1px solid white;
}

.retailer-marker {
    background-color: #00d4ff;
    border: none;
    padding: 4px;
    box-shadow: none;
}

/* Alternative: Square markers */
.custom-marker.square {
    border-radius: 3px;
}

/* Alternative: Triangle markers */
.custom-marker.triangle {
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-bottom: 12px solid;
    background: none;
    border-radius: 0;
}

.reflexer-marker.triangle {
    border-bottom-color: #00d4ff;
}

.retailer-marker.triangle {
    border-bottom-color: #ff4444;
}

/* Icon-based markers for retailers */
.custom-marker.icon-marker {
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.custom-marker.icon-marker svg {
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
    transition: filter 0.2s ease;
}

.custom-marker.icon-marker:hover svg {
    transform: scale(1.1);
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.5));
}

/* Hover effects handled in JavaScript */

/* Dimmed markers outside isochrone */
.custom-marker.outside-isochrone {
    opacity: 0.4;
    border: 2px dashed;
    transition: all 0.3s ease;
}

.custom-marker.outside-isochrone:hover {
    opacity: 0.7;
    transform: scale(1.1);
}

.reflexer-marker.outside-isochrone {
    border-color: #000000;
}

.retailer-marker.outside-isochrone {
    border-color: #00d4ff;
}

.retailer-marker.icon-marker.outside-isochrone svg {
    opacity: 0.4;
}

/* Data Tab Styles */
#tab-data {
    position: relative;
    background-color: #000;
    margin-top: 78px;
    height: calc(100vh - 78px);
}

/* Market Definitions Tab Styles */
#tab-market-definitions {
    position: relative;
    background-color: #000;
    margin-top: 78px;
    height: calc(100vh - 78px);
}

.data-map-background {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100% !important;
    height: 100% !important;
    z-index: 0;
}

.data-content {
    position: relative;
    z-index: 1;
    height: 100%;
    overflow-y: auto;
    background: rgba(37, 35, 35, 0.75);
    padding: 40px 80px 40px 80px;
}

.data-section {
    max-width: 2000px;
    margin: 0 auto;
}

.section-header {
    font-size: 24px;
    font-weight: 500;
    line-height: 28px;
    color: white;
    margin: 0 auto 8px auto;
    max-width: 2000px;
}

.section-header span {
    font-weight: 300;
}

/* Market Selector Styles */
.drawer-field:has(.market-search-container) {
    position: relative;
}

/* Market Option Styles */
.market-option {
    display: flex;
    align-items: center;
    padding: 8px 8px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.market-option:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}

.market-option.selected {
    background: rgba(0, 212, 255, 0.2);
    border-color: rgba(0, 212, 255, 0.4);
}

.market-option.selected .market-name {
    color: #00d4ff;
    font-weight: 600;
}

.market-option-content {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}

.market-info {
    display: flex;
    flex-direction: row;
    align-items: baseline;
    gap: 8px;
    flex: 1;
}

.market-name {
    font-size: 14px;
    font-weight: 500;
    color: #000000;
    line-height: 1.3;
}

.market-counts {
    font-size: 12px;
    color: #666666;
    line-height: 1.2;
}

.universal-city-option .market-counts {
    color: #999999;
    font-style: italic;
}

/* Market Tag Styles */
.market-tag {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    flex-shrink: 0;
}

.isochrone-tag {
    background: rgba(0, 212, 255, 0.15);
    color: #00d4ff;
    border: 1px solid rgba(0, 212, 255, 0.3);
}

.isochrone-tag i {
    width: 6px !important;
    height: 6px !important;
    margin-right: 3px;
    font-size: 6px;
}

.isochrone-tag i svg,
.isochrone-tag svg,
svg.lucide-check {
    width: 16px !important;
    height: 16px !important;
    max-width: 16px !important;
    max-height: 16px !important;
}

.market-search-container {
    position: relative;
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    overflow: visible;
}

.market-search-input {
    flex: 1;
    padding: 12px 16px;
    background: transparent;
    border: none;
    color: white;
    font-size: 14px;
    outline: none;
    opacity: 1;
    cursor: text;
}

.market-search-input:focus {
    color: white;
    opacity: 1;
}

.market-search-input:not(:placeholder-shown) {
    color: white;
    opacity: 1;
}

.market-search-input::placeholder {
    color: rgba(255, 255, 255, 0.6);
}

/* Ensure input never looks disabled */
.market-search-input[value] {
    color: white !important;
    opacity: 1 !important;
}

.market-search-input:not([value=""]) {
    color: white !important;
    opacity: 1 !important;
}

/* Make selected market input look active and clear */
.market-search-input:not(:placeholder-shown) {
    color: white !important;
    opacity: 1 !important;
    font-weight: 500;
}

.market-search-input:focus {
    color: white !important;
    opacity: 1 !important;
    font-weight: 500;
}

/* Ensure consistent styling for all states */
.market-search-input:not([value=""]) {
    color: white !important;
    opacity: 1 !important;
    font-weight: 500;
}

/* Active state styling - always look active when market is selected */
.market-search-input.has-value {
    color: white !important;
    opacity: 1 !important;
    font-weight: 500;
}

/* Container styling for active state */
.market-search-container.has-selection {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
}

.market-dropdown-toggle {
    padding: 12px 16px;
    background: transparent;
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
}

.market-dropdown-toggle:hover {
    background: rgba(255, 255, 255, 0.1);
}

.market-dropdown {
    position: absolute;
    top: 52px;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    max-height: 300px;
    overflow-y: auto;
    display: none;
    width: 100%;
    margin-top: 4px;
}

.market-dropdown.show {
    display: block;
}

.market-dropdown-content {
    padding: 8px 0;
}


.selected-markets {
    margin-top: 12px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.selected-market-tag {
    display: inline-flex;
    align-items: center;
    padding: 4px 8px;
    border-radius: 16px;
    font-size: 12px;
    font-weight: 500;
}

/* Active Market Tag - Blue theme */
.active-market-tag {
    background: rgba(0, 212, 255, 0.2);
    color: #00d4ff;
    border: 1px solid rgba(0, 212, 255, 0.3);
}

.active-market-tag .remove-market {
    margin-left: 6px;
    cursor: pointer;
    font-weight: bold;
    color: #00d4ff;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.active-market-tag .remove-market:hover {
    opacity: 1;
}

/* Universal City Tag - Black and white theme */
.universal-city-tag {
    background: rgba(0, 0, 0, 0.1);
    color: #333;
    border: 1px solid rgba(0, 0, 0, 0.2);
}

.universal-city-tag .remove-market {
    margin-left: 6px;
    cursor: pointer;
    font-weight: bold;
    color: #333;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.universal-city-tag .remove-market:hover {
    opacity: 1;
}

/* Modal Styles */
.geocoding-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    padding: 20px;
    box-sizing: border-box;
}

/* Alert Modal - Hugs content (for confirmations, etc.) */
.geocoding-modal-content.alert {
    background: white;
    border-radius: 12px;
    width: 100%;
    max-width: 500px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    overflow-y: auto;
    overflow-x: hidden;
    position: relative;
    transform: translateZ(0);
    will-change: auto;
}

/* Validation Modal - Fixed height (for geocoding, data cleanup, etc.) */
.geocoding-modal-content.validation {
    background: white;
    border-radius: 12px;
    width: 100%;
    max-width: 1000px;
    height: 720px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    position: relative;
    transform: translateZ(0);
    will-change: auto;
    display: flex;
    flex-direction: column;
}

.geocoding-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    background: #f8f9fa;
    flex-shrink: 0;
}

.geocoding-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #1d1d1f;
}

.close-modal-btn {
    background: none;
    border: none;
    padding: 8px;
    border-radius: 6px;
    cursor: pointer;
    color: #666;
    transition: all 0.2s ease;
}

.close-modal-btn:hover {
    background: rgba(0, 0, 0, 0.1);
    color: #333;
}

.geocoding-body {
    padding: 24px;
    flex: 1;
    overflow-y: auto;
}

.geocoding-body p {
    margin: 0 0 12px 0;
    color: #1d1d1f;
    line-height: 1.5;
}

.geocoding-body p:last-of-type {
    margin-bottom: 0;
}

.geocoding-progress {
    margin-top: 20px;
    padding: 16px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 8px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #007AFF, #00C7FF);
    border-radius: 4px;
    transition: width 0.3s ease;
    width: 0%;
}

.progress-text {
    font-size: 14px;
    color: #666;
    text-align: center;
}

/* Distance Cities List Styles */
.distance-cities-list {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
}

.distance-city-item {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    margin: 4px 0;
    background: white;
    border-radius: 6px;
    border: 1px solid #e0e0e0;
    gap: 12px;
}

.distance-city-checkbox {
    margin: 0;
    transform: scale(1.1);
}

.distance-city-info {
    flex: 1;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.distance-city-name {
    font-weight: 500;
    color: #333;
}

.distance-city-distance {
    font-size: 14px;
    color: #666;
    font-weight: 600;
}

.distance-city-remove {
    color: #dc3545;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    border: 1px solid #dc3545;
    background: transparent;
    transition: all 0.2s ease;
}

.distance-city-remove:hover {
    background: #dc3545;
    color: white;
}

.geocoding-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 20px 24px;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    background: #f8f9fa;
    flex-shrink: 0;
}

.geocoding-btn {
    padding: 10px 20px;
    border-radius: 6px;
    border: none;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.geocoding-btn.cancel-btn {
    background: #f1f1f1;
    color: #666;
}

.geocoding-btn.cancel-btn:hover {
    background: #e5e5e5;
    color: #333;
}

.geocoding-btn.start-btn {
    background: #007AFF;
    color: white;
}

.geocoding-btn.start-btn:hover {
    background: #0056CC;
}

.geocoding-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.section-divider {
    max-width: 2000px;
    margin: 32px auto;
    height: 1px;
    background: rgba(255, 255, 255, 0.2);
}

.notes-section {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    padding: 16px 20px;
    margin-top: 24px;
}

.notes-section.global-notes {
    max-width: 2000px;
    margin: 0 auto 40px auto;
}

.notes-header {
    font-size: 24px;
    font-weight: 500;
    line-height: 28px;
    color: white;
    margin: 0 0 12px 0;
}

.notes-list {
    list-style: none;
    padding: 0;
    margin: 4px 0 0 0;
}

.notes-list li {
    font-size: 16px;
    line-height: 20px;
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 4px;
    padding-left: 24px;
    position: relative;
}

.notes-list li:before {
    content: "•";
    position: absolute;
    left: 0;
    color: rgba(255, 255, 255, 0.5);
}

.notes-list li:last-child {
    margin-bottom: 0;
}

.notes-list li strong {
    color: white;
}

.table-controls {
    font-weight: 300;
    position: relative;
    display: flex;
    align-items: center;
    gap: 24px;
    margin-bottom: 30px;
}

.controls-group {
    display: flex;
    align-items: center;
    gap: 12px;
}

.controls-label {
    font-size: 13px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.7);
    margin-right: 4px;
}

.controls-divider {
    width: 1px;
    height: 32px;
    background: rgba(255, 255, 255, 0.2);
}

.table-control-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.2s ease;
}

.table-control-btn:hover {
    background: rgba(255, 255, 255, 1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transform: translateY(-1px);
    color: #1d1d1f;
}

.table-control-btn.save-btn.has-changes {
    background: #ef4444;
    color: white;
    border-color: #ef4444;
    animation: pulse 2s ease-in-out infinite;
}

.table-control-btn.save-btn.has-changes:hover {
    background: #dc2626;
    border-color: #dc2626;
    color: white;
}

@keyframes pulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
    }
    50% {
        box-shadow: 0 0 0 8px rgba(239, 68, 68, 0);
    }
}

.table-control-btn i {
    width: 16px;
    height: 16px;
}

.data-table-container {
    position: relative;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 8px 8px 0 0;
    overflow: hidden;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
    max-height: 900px;
    overflow-y: auto;
}

.table-footer {
    background: rgba(255, 255, 255, 0.95);
    padding: 12px 16px;
    border-radius: 0 0 8px 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
    margin-bottom: 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.row-count {
    font-size: 13px;
    color: rgba(0, 0, 0, 0.6);
    font-weight: 500;
}

.last-updated {
    font-size: 11px;
    color: rgba(0, 0, 0, 0.5);
    font-weight: 400;
    font-style: italic;
    line-height: 1.2;
    max-width: none;
    flex: 1;
    text-align: right;
    white-space: nowrap;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table thead {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(10px);
}

.data-table th {
    padding: 12px 16px;
    text-align: left;
    font-size: 13px;
    font-weight: 600;
    color: #1d1d1f;
}

/* Sortable headers */
.data-table th[style*="cursor: pointer"] {
    transition: background-color 0.15s ease;
}

.data-table th[style*="cursor: pointer"]:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

/* Sort icons - base styling for all sortable columns */
#reflexers-table th svg,
#retail-table th svg {
    width: 14px !important;
    height: 14px !important;
    vertical-align: middle;
    margin-left: 4px;
    color: #9ca3af !important;
    stroke: #9ca3af !important;
    stroke-width: 2;
    transition: all 0.2s ease;
}

/* Sort icons on hover */
#reflexers-table th:hover svg,
#retail-table th:hover svg {
    color: #232525 !important;
    stroke: #232525 !important;
}

/* Sort icons when column is actively sorted */
#reflexers-table th.sorted-column svg,
#retail-table th.sorted-column svg {
    color: #232525 !important;
    stroke: #232525 !important;
    stroke-width: 2.5;
}

/* Specific column widths for markets table */
#markets-table th:nth-child(1), /* Market Name */
#markets-table td:nth-child(1) {
    width: 15%;
}

#markets-table th:nth-child(2), /* Cities Included */
#markets-table td:nth-child(2) {
    width: 25%;
}

#markets-table th:nth-child(3), /* State */
#markets-table td:nth-child(3) {
    width: 12%;
}

#markets-table th:nth-child(4), /* Zip Codes */
#markets-table td:nth-child(4) {
    width: 22%;
}

#markets-table th:nth-child(5), /* Retail Location Count */
#markets-table td:nth-child(5) {
    width: 10%;
    text-align: right;
}

#markets-table th:nth-child(6), /* Reflexer Count */
#markets-table td:nth-child(6) {
    width: 10%;
    text-align: right;
}

#markets-table th:nth-child(7), /* Delete */
#markets-table td:nth-child(7) {
    width: auto;
    text-align: right;
    padding-right: 24px;
}

/* Isochrones table column widths and alignment */
#isochrones-table th:nth-child(1), /* Market Name */
#isochrones-table td:nth-child(1) {
    width: 15%;
}

#isochrones-table th:nth-child(2), /* Zips */
#isochrones-table td:nth-child(2) {
    width: 20%;
}

#isochrones-table th:nth-child(3), /* Cities */
#isochrones-table td:nth-child(3) {
    width: 30%;
    text-align: left;
}

#isochrones-table th:nth-child(4), /* Reflexer Count */
#isochrones-table td:nth-child(4) {
    width: 10%;
    text-align: right;
}

#isochrones-table th:nth-child(5), /* Origin */
#isochrones-table td:nth-child(5) {
    width: 20%;
    text-align: center;
}

#isochrones-table th:nth-child(6), /* Boundary */
#isochrones-table td:nth-child(6) {
    width: 20%;
    text-align: center;
}

#isochrones-table th:nth-child(7), /* GeoJSON */
#isochrones-table td:nth-child(7) {
    width: 5%;
    text-align: center;
}

/* Center the download button in GeoJSON cells */
.geojson-cell {
    text-align: center;
}

.geojson-cell .download-geojson-btn {
    display: inline-block;
    margin: 0 auto;
}

/* Specific column widths for reflexers table */
#reflexers-table th:nth-child(1), /* Zip Code */
#reflexers-table td:nth-child(1) {
    width: 15%;
}

#reflexers-table th:nth-child(2), /* Count */
#reflexers-table td:nth-child(2) {
    width: 15%;
    text-align: right;
}

#reflexers-table th:nth-child(3), /* Lat */
#reflexers-table td:nth-child(3) {
    width: 15%;
    text-align: right;
}

#reflexers-table th:nth-child(4), /* Lon */
#reflexers-table td:nth-child(4) {
    width: 15%;
    text-align: right;
}

#reflexers-table th:nth-child(5), /* City */
#reflexers-table td:nth-child(5) {
    width: 15%;
}

#reflexers-table th:nth-child(6), /* State */
#reflexers-table td:nth-child(6) {
    width: 25%; /* Remaining space */
    text-align: left;
}

/* Specific column widths for retailers table */
#retail-table th:nth-child(1), /* City */
#retail-table td:nth-child(1) {
    width: 20%;
}

#retail-table th:nth-child(2), /* State */
#retail-table td:nth-child(2) {
    width: 20%;
}

#retail-table th:nth-child(3), /* Zip Codes */
#retail-table td:nth-child(3) {
    width: 45%;
}

#retail-table th:nth-child(4), /* Retail Location Count */
#retail-table td:nth-child(4) {
    width: auto;
    text-align: right;
}
    border-bottom: 2px solid rgba(0, 0, 0, 0.1);
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(10px);
}

/* Duplicate merge modal styles */
.duplicate-list {
    max-height: 400px;
    overflow-y: auto;
    margin: 20px 0;
}


.duplicate-group {
    margin-bottom: 20px;
    padding: 15px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    background: #f9f9f9;
}

.duplicate-group-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    cursor: pointer;
    padding: 8px;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.duplicate-group-header:hover {
    background: #f0f0f0;
}

.duplicate-group-header input[type="checkbox"] {
    margin: 0;
}

.duplicate-group-header h4 {
    margin: 0;
    color: #333;
    font-size: 16px;
    font-weight: 600;
}

.duplicate-entries {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.duplicate-entry {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    border-radius: 4px;
    background: white;
    cursor: pointer;
    transition: background-color 0.2s;
}

.duplicate-entry:hover {
    background: #f0f0f0;
}

.duplicate-entry input[type="checkbox"] {
    margin: 0;
}

.duplicate-entry span {
    font-size: 14px;
    color: #666;
}

/* Drawer Content Styling */
.drawer-header {
    font-size: 24px;
    font-weight: 500;
    color: #ffffff;
    margin: 0 0 32px 0;
    padding-bottom: 20px;
}

.drawer-section {
}

.drawer-section:not(:first-child) {
    border-top: 1px solid rgba(255, 255, 255, 0.6);
    margin-top: 8px;
}


.drawer-section-header {
    font-size: 20px;
    font-weight: 500;
    color: #ffffff;
    margin: 0;
    padding: 16px 0;
}

.drawer-fields {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.drawer-radio-fields {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.drawer-field {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.drawer-field-row {
    display: flex;
    align-items: end;
    gap: 12px;
}

.drawer-field-row .drawer-field {
    flex: 1;
    min-width: 0;
}

.drawer-field-or {
    font-size: 14px;
    font-weight: 500;
    color: #ffffff;
    padding-bottom: 8px;
    text-align: center;
    min-width: 30px;
}

.drawer-field label {
    font-size: 14px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.4);
    margin: 0;
    transition: all 0.3s ease;
}

.drawer-field:hover label {
    color: #ffffff;
}

.drawer-field:focus-within label {
    color: #ffffff;
}

.drawer-field input {
    padding: 16px 20px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    color: #1d1d1f;
    background: rgba(255, 255, 255, 0.4);
    transition: all 0.3s ease;
    outline: none;
    font-weight: 500;
}

.drawer-field input:hover {
    background: rgba(255, 255, 255, 0.8);
}

.drawer-field input:focus {
    outline: none;
    background: rgba(255, 255, 255, 0.8);
}

.drawer-field input::placeholder {
    color: #8e8e93;
    font-style: italic;
    font-weight: 400;
}

.drawer-field input:disabled {
    background: rgba(255, 255, 255, 0.3);
    color: #666666;
    cursor: not-allowed;
    opacity: 0.6;
}

/* ZIP Buffer Settings - White text color to match dropdown */
#zip-buffer-distance {
    color: #ffffff !important;
}

#zip-buffer-distance:hover {
    color: #ffffff !important;
}

#zip-buffer-distance:focus {
    color: #ffffff !important;
}

/* Active basis field styling */
.drawer-field input.active {
    background: rgba(0, 212, 255, 0.1);
    border-color: #00d4ff;
    color: #00d4ff;
}

.drawer-field label.active {
    color: #00d4ff;
    font-weight: 600;
}

/* Basis Option Radio Button Structure */
.basis-option {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 16px;
    padding: 12px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    transition: all 0.2s ease;
}

/* Override for Isochrone Basis section - use vertical layout */
.basis-section .drawer-fields {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.basis-section .basis-option {
    flex-direction: row;
    align-items: center;
    flex: 1;
    margin-bottom: 0;
}

.radio-row {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
}

.basis-option:hover {
    border-color: rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.05);
}

.basis-option input[type="radio"] {
    margin: 0;
    width: 16px;
    height: 16px;
    accent-color: #00d4ff;
    flex-shrink: 0;
}

.basis-option label {
    margin: 0;
    font-weight: 500;
    color: #ffffff;
    cursor: pointer;
    flex: 1;
}

/* Remove the old rule that's no longer needed */

.radio-header {
    font-weight: 600;
    color: rgba(255, 255, 255, 0.95);
    margin-bottom: 4px;
    font-size: 14px;
}

.radio-description {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.7);
    line-height: 1.4;
    margin: 0;
}

.origin-selection {
    margin-top: 0;
    padding: 0;
    background: transparent;
    border: none;
    border-radius: 0;
    width: 100%;
}

.selection-header {
    font-size: 14px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
    margin: 0 0 12px 0;
}

.selection-header-row {
    display: flex;
    align-items: center;
    margin-bottom: 12px;
    gap: 6px;
}

.selection-header-row .selection-header {
    margin: 0;
}

.select-all-checkbox {
    margin: 0;
    width: 14px;
    height: 14px;
    accent-color: #00d4ff;
}

.checkbox-container {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 0;
    max-height: 200px;
    overflow-y: auto;
    width: 100%;
}

.retailer-checkbox-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
    max-height: 200px;
    overflow-y: auto;
    width: 100%;
}

.checkbox-item {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 6px 0;
    border-radius: 4px;
    transition: background-color 0.2s ease;
}

/* City checkbox labels */
.checkbox-item label {
    display: flex;
    flex-direction: column;
    gap: 2px;
    line-height: 1.2;
    color: #ffffff !important;
    font-size: 12px !important;
}

/* Make all retailer brand/location text white with specific styling */
.checkbox-item .brand-name,
.checkbox-item .location-name {
    color: #ffffff !important;
}

.checkbox-item .brand-name {
    font-weight: 600 !important;
    font-size: 12px !important;
    line-height: 1.3 !important;
    margin-bottom: 0 !important;
}

.checkbox-item .location-name {
    font-weight: 400 !important;
    font-size: 10px !important;
    line-height: 1.2 !important;
    opacity: 0.9 !important;
}

.checkbox-item:hover {
    background: rgba(0, 212, 255, 0.1);
}

.checkbox-item input[type="checkbox"] {
    margin: 0;
    width: 16px;
    height: 16px;
    accent-color: #00d4ff;
}

.checkbox-item label {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.8);
    cursor: pointer;
    margin: 0;
    flex: 1;
}

.basis-option input[type="text"] {
    flex: 1;
    max-width: 128px;
    margin: 0;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    color: #ffffff;
    font-size: 14px;
}

.basis-option input[type="text"]::placeholder {
    color: #ffffff;
    opacity: 0.7;
}

.basis-option input[type="text"]:disabled {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
    color: #666666;
    cursor: not-allowed;
}

.basis-option input[type="text"]:enabled {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
    color: #ffffff;
}

/* Active basis option styling */
.basis-option:has(input[type="radio"]:checked) {
    border-color: #00d4ff;
    background: rgba(0, 212, 255, 0.1);
}

.basis-option:has(input[type="radio"]:checked) label {
    color: #00d4ff;
    font-weight: 600;
}

.basis-option:has(input[type="radio"]:checked) input[type="text"] {
    background: rgba(0, 212, 255, 0.1);
    border-color: #00d4ff;
    color: #00d4ff;
}

.drawer-field-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.6);
    margin: 20px 0;
}

.generate-isochrone-btn {
    flex: 1;
    padding: 12px 20px;
    background: rgba(0, 212, 255, 0.15);
    border: 1px solid rgba(0, 212, 255, 0.3);
    border-radius: 8px;
    color: #00d4ff;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    outline: none;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.generate-isochrone-btn:hover {
    background: rgba(0, 212, 255, 0.25);
    border-color: rgba(0, 212, 255, 0.5);
}

.generate-isochrone-btn:active {
    background: rgba(0, 212, 255, 0.3);
}

.generate-isochrone-btn:disabled {
    background: rgba(0, 212, 255, 0.05);
    border-color: rgba(0, 212, 255, 0.1);
    color: rgba(0, 212, 255, 0.3);
    cursor: not-allowed;
    opacity: 0.5;
}

.generate-isochrone-btn:disabled:hover {
    background: rgba(0, 212, 255, 0.05);
    border-color: rgba(0, 212, 255, 0.1);
}


/* Radio Button Styling - Independent Classes */
.radio-option {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    padding: 12px 16px;
    border-radius: 12px;
    transition: all 0.2s ease;
    border: 1px solid transparent;
    background: transparent;
}

.radio-option:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}

.radio-option input[type="radio"] {
    width: 16px;
    height: 16px;
    margin: 0;
    cursor: pointer;
    accent-color: #ffffff;
}

.radio-option-text {
    font-size: 16px;
    font-weight: 500;
    color: #ffffff;
    cursor: pointer;
    transition: all 0.2s ease;
}

.radio-option:hover .radio-option-text {
    color: #ffffff;
}

.radio-option:has(input:checked) {
    background: rgba(0, 212, 255, 0.1);
    border-color: rgba(0, 212, 255, 0.3);
}

.radio-option:has(input:checked) .radio-option-text {
    color: #00d4ff;
    font-weight: 600;
}




/* Markets table column widths */
#markets-table th:nth-child(1) {
    width: 200px;
}

#markets-table th:nth-child(2) {
    width: 60px;
}

#markets-table th:nth-child(3) {
    width: 80px;
}

#markets-table th:nth-child(4) {
    width: 100px;
}

#markets-table th:nth-child(5) {
    width: 100px;
}

#markets-table th:nth-child(6) {
    width: auto;
    text-align: right;
    padding-right: 24px;
}

/* Reflexers table column widths - removed old conflicting rules */

/* Retailers table column widths */
#retail-table th:nth-child(1) {
    width: 300px; /* Brand - 2x wider */
}

#retail-table th:nth-child(2) {
    width: 300px; /* Location - 2x wider */
}

#retail-table th:nth-child(3) {
    width: 375px; /* Address - 1.5x wider */
}

#retail-table th:nth-child(4) {
    width: auto; /* City - takes remaining space */
}

#retail-table th:nth-child(5) {
    width: 60px; /* State */
}

#retail-table th:nth-child(6) {
    width: 80px; /* Zip */
}

#retail-table th:nth-child(7) {
    width: 90px; /* Lat */
}

#retail-table th:nth-child(8) {
    width: 90px; /* Long */
}

#retail-table th:nth-child(9) {
    width: auto;
    text-align: right;
    padding-right: 24px;
}

.data-table td {
    padding: 12px 16px;
    font-size: 14px;
    color: #1d1d1f;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    vertical-align: middle;
}

.data-table td:last-child {
    text-align: right;
    padding-right: 24px;
}

/* Column widths for reflexer and retailer tables */
#reflexers-table th,
#reflexers-table td,
#retail-table th,
#retail-table td {
    width: 15%;
    text-align: left;
}

/* Specific column formatting for lat/lon */
#reflexers-table td[data-field="lat"],
#reflexers-table td[data-field="lon"],
#retail-table td[data-field="lat"],
#retail-table td[data-field="lon"] {
    font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
    font-size: 13px;
}

.data-table tbody tr {
    background: white;
}

.data-table tbody tr:hover {
    background: rgba(0, 0, 0, 0.02);
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

.data-table td[contenteditable="true"] {
    cursor: text;
    position: relative;
}

.data-table td[contenteditable="true"]:focus {
    outline: 2px solid #3b82f6;
    outline-offset: -2px;
    background: rgba(59, 130, 246, 0.05);
}

.delete-row-btn {
    background: none;
    color: #6b7280;
    border: none;
    padding: 4px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.delete-row-btn:hover {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.delete-row-btn i {
    width: 16px;
    height: 16px;
}

.delete-confirm {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    background: rgba(239, 68, 68, 0.1);
    border-radius: 6px;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.delete-confirm-text {
    font-size: 12px;
    color: #ef4444;
    margin-right: 4px;
}

.delete-confirm-btn {
    background: #ef4444;
    color: white;
    border: none;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.delete-confirm-btn:hover {
    background: #dc2626;
}

.delete-cancel-btn {
    background: transparent;
    color: #6b7280;
    border: none;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.delete-cancel-btn:hover {
    background: rgba(0, 0, 0, 0.05);
}

.save-success-alert {
    position: absolute;
    top: 50%;
    right: 0;
    transform: translateY(-50%);
    padding: 12px 20px;
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.3);
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 10px;
    color: #059669;
    font-size: 14px;
    font-weight: 500;
    z-index: 2000;
    opacity: 0;
    animation: fadeSlideIn 0.3s ease forwards;
}

.save-success-alert i {
    width: 18px;
    height: 18px;
}

.save-error-alert {
    position: absolute;
    top: 50%;
    right: 0;
    transform: translateY(-50%);
    padding: 12px 20px;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 10px;
    color: #dc2626;
    font-size: 14px;
    font-weight: 500;
    z-index: 2000;
    opacity: 0;
    animation: fadeSlideIn 0.3s ease forwards;
}

.save-error-alert i {
    width: 18px;
    height: 18px;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOutRight {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

@keyframes fadeSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50%) translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateY(-50%) translateX(0);
    }
}

@keyframes fadeSlideOut {
    from {
        opacity: 1;
        transform: translateY(-50%) translateX(0);
    }
    to {
        opacity: 0;
        transform: translateY(-50%) translateX(20px);
    }
}

/* Drawer */
.drawer {
    position: fixed;
    top: 78px;
    right: -480px;
    width: 480px;
    height: calc(100vh - 78px);
    background: rgba(37, 35, 35, 0.65);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-left: 0.5px solid rgba(255, 255, 255, 0.1);
    box-shadow: -4px 0 12px rgba(0, 0, 0, 0.08);
    transition: right 0.3s ease;
    z-index: 999;
    overflow-y: auto;
}

.drawer.open {
    right: 0;
}

.drawer-content {
    padding: 24px;
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    padding-top: 80px; /* Space for fixed header */
    padding-bottom: 120px; /* Space for fixed footer */
}

/* Fixed Drawer Header */
.drawer-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.98);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding: 16px 24px;
    z-index: 1001;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.drawer-header h2 {
    margin: 0;
    color: #ffffff;
    font-size: 18px;
    font-weight: 600;
}

/* Drawer Footer */
.drawer-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.98);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding: 16px 24px 24px 24px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.drawer-footer-buttons {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
    justify-content: flex-start;
}

.drawer-footer-btn {
    padding: 12px 12px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    color: #ffffff;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1;
}

.drawer-footer-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.3);
}

.drawer-footer-btn:disabled {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.3);
    cursor: not-allowed;
    opacity: 0.5;
}

.drawer-footer-btn:disabled:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
}


/* Drawer Toggle States */
.drawer-toggle.drawer-open {
    background: white;
}

/* Mapbox Overrides */
.mapboxgl-popup-content {
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    padding: 16px;
}

.mapboxgl-popup-tip {
    border-top-color: white;
}

.mapboxgl-ctrl-group {
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    border: 1px solid #e5e7eb;
}

.mapboxgl-ctrl-zoom-in,
.mapboxgl-ctrl-zoom-out {
    border-radius: 8px;
}

.mapboxgl-ctrl-group button {
    border-radius: 8px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .top-nav {
        padding: 0 16px;
        height: 56px;
    }
    
    .nav-title {
        font-size: 18px;
    }
    
    .nav-tabs {
        gap: 4px;
    }
    
    .nav-tab {
        padding: 6px 12px;
        font-size: 13px;
    }
    
    .search-container {
        top: 76px;
        left: 16px;
    }
    
    .location-search-field {
        width: 280px;
    }
    
    .location-search-input {
        font-size: 14px;
    }
    
    .location-dropdown {
        max-height: 300px;
    }
    
    .drawer-toggle {
        width: 44px;
        height: 44px;
    }
    
    .drawer-toggle-container {
        top: 56px;
        right: 16px;
    }
    
    .main-content {
        margin-top: 56px;
    }
    
    .drawer {
        top: 56px;
        width: min(480px, 90vw);
        right: min(-480px, -90vw);
    }
    
    .drawer.open {
        right: 0;
    }
}

@media (max-width: 480px) {
    .nav-tabs {
        display: none; /* Hide tabs on very small screens */
    }
    
    .nav-title {
        font-size: 16px;
    }
}

/* Cell Dropdowns for Editing */
.cell-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    max-height: 300px;
    overflow-y: auto;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    margin-top: 4px;
}

.cell-dropdown-option {
    padding: 8px 12px;
    cursor: pointer;
    transition: background 0.15s;
}

.cell-dropdown-option:hover {
    background: #f3f4f6;
}

.cell-dropdown-option.selected {
    background: #dbeafe;
    color: #1e40af;
    font-weight: 500;
}

.cell-dropdown-search {
    padding: 8px;
    border-bottom: 1px solid #e5e7eb;
}

.cell-dropdown-search input {
    width: 100%;
    padding: 6px 10px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: 14px;
}

.cell-dropdown-search input:focus {
    outline: none;
    border-color: #00d4ff;
}

.cities-cell {
    position: relative;
    cursor: pointer;
}

.state-cell {
    position: relative;
    cursor: default;
    color: #6b7280;
}

.cities-cell[contenteditable="false"] {
    background: #f9fafb;
}

.cities-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.city-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    background: #e0f2fe;
    color: #075985;
    border-radius: 4px;
    font-size: 12px;
}

.city-tag-remove {
    cursor: pointer;
    color: #64748b;
    font-weight: bold;
}

.city-tag-remove:hover {
    color: #dc2626;
}

/* Zip Code Tags */
.zip-codes-cell {
    position: relative;
    min-width: 200px;
}

.zip-codes-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    align-items: center;
}

.zip-tag {
    display: inline-flex;
    align-items: center;
    background: rgba(99, 102, 241, 0.1);
    color: #6366f1;
    padding: 2px 6px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
    border: 1px solid rgba(99, 102, 241, 0.2);
    cursor: pointer;
    transition: all 0.2s ease;
}

.zip-tag:hover {
    background: rgba(99, 102, 241, 0.2);
    border-color: rgba(99, 102, 241, 0.4);
}

.zip-tag-remove {
    margin-left: 4px;
    cursor: pointer;
    font-weight: bold;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.zip-tag-remove:hover {
    opacity: 1;
}

/* Utility Classes */
.hidden {
    display: none !important;
}

.text-center {
    text-align: center;
}

.text-muted {
    color: #6b7280;
}

/* Animation Classes */
.fade-in {
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.slide-in-right {
    animation: slideInRight 0.3s ease;
}

@keyframes slideInRight {
    from { transform: translateX(100%); }
    to { transform: translateX(0); }
}

/* Progress Steps Styles */
.progress-steps {
    margin: 20px 0;
}

.progress-step {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    margin: 8px 0;
    border-radius: 8px;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    transition: all 0.3s ease;
}

.progress-step.active {
    background: #e3f2fd;
    border-color: #2196f3;
    color: #1976d2;
}

.progress-step.completed {
    background: #e8f5e8;
    border-color: #4caf50;
    color: #2e7d32;
}

.step-number {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #dee2e6;
    color: #6c757d;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    margin-right: 12px;
    transition: all 0.3s ease;
}

.progress-step.active .step-number {
    background: #2196f3;
    color: white;
}

.progress-step.completed .step-number {
    background: #4caf50;
    color: white;
}

.step-text {
    font-size: 14px;
    font-weight: 500;
    flex: 1;
}

/* Missing Cities Modal Styles */
.missing-city-item {
    margin-bottom: 10px;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    background-color: #f9f9f9;
}

.missing-city-row {
    display: flex;
    gap: 10px;
    align-items: center;
}

.city-input {
    flex: 1;
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 14px;
}

.state-select {
    flex: 1;
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 14px;
    background-color: white;
}

.delete-city-btn {
    padding: 8px 12px;
    background-color: #dc3545;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
}

.delete-city-btn:hover {
    background-color: #c82333;
}

.market-header {
    margin-bottom: 15px;
    padding: 10px;
    background-color: #e9ecef;
    border-radius: 5px;
}

.market-name-header {
    margin: 0;
    font-size: 18px;
    font-weight: bold;
    color: #333;
}

.missing-cities-section {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 2px solid #dc3545;
}

.missing-cities-list {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
}

/* Did you mean section styles */
.did-you-mean-section {
    margin-top: 10px;
    padding: 10px;
    background-color: #f8f9fa;
    border-radius: 5px;
    border-left: 3px solid #007bff;
}

.did-you-mean-label {
    margin: 0 0 8px 0;
    font-size: 14px;
    font-weight: 600;
    color: #007bff;
}

.matching-cities-list {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.city-options {
    margin: 10px 0;
}

.city-option {
    display: block;
    padding: 4px 0;
    cursor: pointer;
}

.city-option input[type="radio"] {
    margin-right: 8px;
}

.city-option-text {
    display: inline;
}

.city-option.remove-option .city-option-text {
    color: #dc3545;
    font-weight: 600;
}

/* Validation section headers */
.validation-section-header {
    margin-bottom: 15px;
    text-align: left;
}

.validation-section-title {
    margin: 0 0 8px 0;
    font-size: 18px;
    font-weight: bold;
    color: #000;
}

.validation-section-description {
    margin: 0;
    font-size: 14px;
    color: #000;
    line-height: 1.4;
}

.matching-city-option input[type="radio"] {
    margin: 0;
}

.matching-city-name {
    font-size: 14px;
    color: #333;
}

.distant-city-main {
    margin-bottom: 5px;
}

/* Modal Section Styles */
.modal-section {
    margin-bottom: 30px;
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

.modal-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
}


.section-title {
    margin: 0 0 8px 0;
    font-size: 20px;
    font-weight: 600;
    color: #333;
}

.section-description {
    margin: 0;
    font-size: 14px;
    color: #666;
    line-height: 1.4;
}

.section-content {
    margin-top: 15px;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.market-group {
    background-color: #f8f9fa;
    border-radius: 8px;
    padding: 15px;
    border: 1px solid #e9ecef;
}

.market-name-header {
    margin: 0 0 15px 0;
    font-size: 16px;
    font-weight: 600;
    color: #495057;
}

.cities-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.outside-market-section .section-title {
    color: #007bff;
}

.non-existent-section .section-title {
    color: #dc3545;
}

/* Missing Cities Styles */
.missing-city-item {
    margin-bottom: 10px;
}

.missing-city-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.city-input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.state-select {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    min-width: 150px;
}

.delete-city-btn {
    padding: 8px 12px;
    border: 1px solid #dc3545;
    background-color: #f8f9fa;
    color: #dc3545;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 4px;
}

.delete-city-btn:hover {
    background-color: #dc3545;
    color: white;
}

/* GeoJSON Cell Styles */
.geojson-cell {
    position: relative;
    min-width: 200px;
    max-width: 300px;
}

.geojson-cell-content {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
}

.geojson-preview {
    flex: 1;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 12px;
    color: #6b7280;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
}

.download-geojson-btn {
    background: none;
    color: #6b7280;
    border: none;
    padding: 4px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.download-geojson-btn:hover {
    background: rgba(59, 130, 246, 0.1);
    color: #3b82f6;
}

.download-geojson-btn i {
    width: 16px;
    height: 16px;
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
}

.modal-content {
    background: #1a1a1a;
    border: 1px solid #333;
    border-radius: 8px;
    padding: 0;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px 16px;
    border-bottom: 1px solid #333;
}

.modal-header h3 {
    margin: 0;
    color: #ffffff;
    font-size: 18px;
    font-weight: 600;
}

.modal-close-btn {
    background: none;
    border: none;
    color: #999;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: color 0.2s ease, background-color 0.2s ease;
}

.modal-close-btn:hover {
    color: #ffffff;
    background-color: rgba(255, 255, 255, 0.1);
}

.modal-body {
    padding: 20px 24px;
}

.modal-body p {
    margin: 0 0 12px 0;
    color: #cccccc;
    line-height: 1.5;
}

.modal-body p:last-child {
    margin-bottom: 0;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 24px 20px;
    border-top: 1px solid #333;
}

.modal-footer .legend-btn {
    padding: 8px 16px;
    font-size: 14px;
}