/* Dealer Map Styles */

/* Map Container - Full Width */
.dealer-map-page {
    width: 100%;
    position: relative;
}

.dealer-map-container {
    position: relative;
    width: 100%;
    height: 800px;
    background: #f5f5f5;
}

/* Map Canvas */
.map-canvas {
    width: 100%;
    height: 100%;
}

/* Overlay Controls Container */
.map-overlay-controls {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 600px;
    z-index: 10;
    padding: 0 20px;
}

/* Search Overlay */
.search-overlay {
    background: white;
    border-radius: 4px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
    margin-bottom: 12px;
}

.search-box {
    display: flex;
    align-items: center;
    position: relative;
    gap: 10px;
}

.search-input {
    flex: 1;
    padding: 14px 140px 14px 16px; /* Increased right padding for all buttons */
    border: none;
    font-size: 16px;
    outline: none;
    border-radius: 4px;
}

.search-input:focus {
    box-shadow: 0 0 0 2px rgba(25, 118, 210, 0.2);
}

.search-btn,
.location-btn,
.search-box .global-toggle {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    color: #666;
    transition: color 0.2s;
}

.search-box .global-toggle {
    right: 88px; /* Position All button to the left of search button */
}

.search-btn {
    right: 48px;
}

.location-btn {
    right: 8px;
}

.search-btn:hover,
.location-btn:hover {
    color: #1976D2;
}

/* Icons */
.icon {
    fill: currentColor;
}

.dealer-card .icon {
    fill: #ffffff;
}

/* Tag Filters */
.filter-overlay {
    background: white;
    border-radius: 4px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
    padding: 12px;
}

.tag-filter-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.tag-chip {
    display: inline-flex;
    align-items: center;
    padding: 6px 12px;
    background: #f5f5f5;
    border: 1px solid #e0e0e0;
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 14px;
}

.tag-chip:hover {
    background: #eeeeee;
}

.tag-chip.active {
    background: #1976D2;
    color: white;
    border-color: #1976D2;
}

.tag-checkbox {
    display: none;
}

.search-box .global-toggle {
    /* Override shared button styles */
    padding: 6px 12px;
    background: black;
    color: white;
    border: 1px solid black;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 500;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.search-box .global-toggle:hover {
    background: #333;
    border-color: #333;
    color: white;
}

.search-box .global-toggle.active {
    background: rgb(0, 255, 207);
    color: black;
    border-color: rgb(0, 255, 207);
}

.tag-filter-container .global-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 16px;
    background: white;
    border: 2px solid #666;
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 14px;
    font-weight: 500;
    margin-left: auto;
}

.tag-filter-container .global-toggle.active {
    background: #666;
    color: white;
}

/* Loading Overlay */
.map-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    z-index: 20;
}

.loading-spinner {
    background: white;
    padding: 24px 32px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.spinner {
    width: 40px;
    height: 40px;
    margin: 0 auto 16px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #1976D2;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Results Section */
.dealer-results-section {
    background: #000000;
    padding: 40px 0;
}

.results-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.results-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 24px;
}

.results-header h2 {
    margin: 0;
    font-size: 24px;
    color: #ffffff;
}

.result-count {
    color: #999999;
    font-size: 14px;
}

/* Dealer Grid */
.dealer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 20px;
}

.dealer-card {
    background: #1a1a1a;
    border: 1px solid #2a2a2a;
    border-radius: 8px;
    padding: 24px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.dealer-card:hover {
    box-shadow: 0 4px 12px rgba(255,255,255,0.1);
    border-color: #3a3a3a;
}

.dealer-card.active {
    border-color: #ffffff;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.2);
}

.dealer-main {
    flex: 1;
}

.dealer-name {
    margin: 0 0 24px 0;
    font-size: 24px;
    font-weight: 700;
    color: #ffffff;
}

.dealer-section {
    margin-bottom: 20px;
}

.section-label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #999999;
    margin-bottom: 10px;
}

.dealer-address {
    color: #ffffff;
    line-height: 1.6;
    margin-bottom: 16px;
    font-size: 14px;
}

.dealer-phone,
.dealer-email,
.dealer-website,
.dealer-distance {
    margin-bottom: 8px;
    font-size: 14px;
    color: #ffffff;
}

.dealer-phone span,
.dealer-email span,
.dealer-website span {
    color: #ffffff;
}

.dealer-phone a,
.dealer-email a,
.dealer-website a {
    color: #ffffff;
    text-decoration: none;
}

.dealer-phone a:hover,
.dealer-email a:hover,
.dealer-website a:hover {
    text-decoration: underline;
}

.dealer-distance {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #ffffff;
    margin-top: 16px;
}

.dealer-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 12px;
}

.tag-label {
    display: inline-block;
    padding: 4px 8px;
    background: #333333;
    color: #ffffff;
    border-radius: 4px;
    font-size: 12px;
}

/* Dealer Actions */
.dealer-actions {
    padding-top: 16px;
    border-top: 1px solid #333333;
}

.action-directions {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: #ffffff;
    color: #000000;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.2s;
    text-decoration: none;
}

.action-directions:hover {
    background: #f0f0f0;
    transform: translateY(-1px);
}

/* No Results */
.no-results-section {
    padding: 80px 20px;
    text-align: center;
    background: #000000;
}

.no-results-message {
    max-width: 400px;
    margin: 0 auto;
}

.no-results-message .icon {
    color: #ccc;
    margin-bottom: 24px;
}

.no-results-message h3 {
    margin: 0 0 12px 0;
    font-size: 20px;
    color: #ffffff;
}

.no-results-message p {
    color: #999999;
    line-height: 1.5;
}

/* Mobile Responsive */
@media (max-width: 767px) {
    .dealer-map-container {
        height: 500px;
    }
    
    .map-overlay-controls {
        max-width: calc(100% - 20px);
        padding: 0 10px;
    }
    
    .search-input {
        font-size: 16px; /* Prevent zoom on iOS */
    }
    
    .tag-filter-container {
        overflow-x: auto;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
        margin: 0 -12px;
        padding: 0 12px;
    }
    
    .tag-chip {
        flex-shrink: 0;
    }
    
    .global-toggle {
        margin-left: 12px;
    }
    
    .dealer-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .results-header {
        flex-direction: column;
        gap: 8px;
    }
}

@media (max-width: 1023px) and (min-width: 768px) {
    .dealer-map-container {
        height: 600px;
    }
    
    .dealer-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Google Maps Autocomplete Dropdown */
.pac-container {
    z-index: 9999;
    border-radius: 4px;
    border-top: none;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.pac-item {
    padding: 10px 16px;
    cursor: pointer;
}

.pac-item:hover {
    background: #f5f5f5;
}

.pac-item-selected {
    background: #e3f2fd;
}

/* Map Info Window */
.gm-style-iw {
    max-width: 280px;
}

.gm-style-iw-c {
    padding: 16px !important;
}

/* Google Maps Info Window Dark Theme Override */
.gm-style .gm-style-iw-c {
    background: #1a1a1a !important;
    border-radius: 8px !important;
    padding: 0 !important;
}

.gm-style .gm-style-iw-d {
    overflow: auto !important;
}

.gm-style .gm-style-iw-tc::after {
    background: #1a1a1a !important;
}

.gm-ui-hover-effect {
    background: #333333 !important;
    border-radius: 50% !important;
}

.gm-ui-hover-effect span {
    background-color: #ffffff !important;
}

.map-info-window {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
    padding: 16px;
    min-width: 250px;
    max-width: 280px;
    background: #1a1a1a;
    color: #ffffff;
}

.map-info-window .info-name {
    margin: 0 0 12px 0;
    font-size: 18px;
    font-weight: 700;
    color: #ffffff;
    line-height: 1.2;
}

.map-info-window .info-section {
    margin-bottom: 12px;
}

.map-info-window .info-label {
    display: block;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #999999;
    margin-bottom: 6px;
}

.map-info-window .info-address {
    color: #ffffff;
    font-size: 13px;
    line-height: 1.4;
}

.map-info-window .info-item {
    margin-bottom: 4px;
    font-size: 13px;
    color: #ffffff;
    line-height: 1.3;
}

.map-info-window .info-item span {
    color: #ffffff;
}

.map-info-window .info-link {
    color: #ffffff;
    text-decoration: none;
}

.map-info-window .info-link:hover {
    text-decoration: underline;
}

.map-info-window .info-actions {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #333333;
}

.map-info-window .info-directions {
    display: inline-block;
    padding: 6px 14px;
    background: #ffffff;
    color: #000000;
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    border-radius: 4px;
    transition: all 0.2s;
}

.map-info-window .info-directions:hover {
    background: #f0f0f0;
    transform: translateY(-1px);
}

/* Map Error Container */
.map-error-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 600px;
    background: #f5f5f5;
    padding: 40px 20px;
}

.map-error-message {
    background: white;
    border-radius: 8px;
    padding: 48px;
    text-align: center;
    max-width: 500px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.map-error-message .error-icon {
    color: #ff9800;
    margin-bottom: 24px;
}

.map-error-message h2 {
    margin: 0 0 16px 0;
    font-size: 24px;
    font-weight: 600;
    color: #333;
}

.map-error-message p {
    margin: 0 0 12px 0;
    color: #666;
    line-height: 1.6;
}

.map-error-message .setup-instructions {
    text-align: left;
    margin-top: 32px;
    padding: 24px;
    background: #f8f9fa;
    border-radius: 6px;
}

.map-error-message .setup-instructions h3 {
    margin: 0 0 16px 0;
    font-size: 18px;
    font-weight: 600;
    color: #333;
}

.map-error-message .setup-instructions ol {
    margin: 0;
    padding-left: 24px;
}

.map-error-message .setup-instructions li {
    margin-bottom: 12px;
    line-height: 1.6;
    color: #555;
}

.map-error-message .setup-instructions ul {
    margin: 8px 0;
    padding-left: 20px;
}

.map-error-message .setup-instructions ul li {
    margin-bottom: 4px;
}

.map-error-message .setup-instructions a {
    color: #1976D2;
    text-decoration: none;
}

.map-error-message .setup-instructions a:hover {
    text-decoration: underline;
}

.map-error-message .admin-path {
    display: inline-block;
    margin-top: 4px;
    padding: 4px 8px;
    background: #e8f0ff;
    border-radius: 4px;
    font-family: monospace;
    font-size: 13px;
    color: #1565C0;
}

.map-error-message .demo-mode-info {
    margin-top: 24px;
    padding: 16px;
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: 6px;
}

.map-error-message .demo-mode-info p {
    margin: 0;
    color: #856404;
}

@media (max-width: 767px) {
    .map-error-container {
        min-height: 400px;
    }
    
    .map-error-message {
        padding: 32px 24px;
    }
    
    .map-error-message h2 {
        font-size: 20px;
    }
}