/* Cicada Dealer Locator - Frontend Styles */

#cdl-dealer-locator {
    --cdl-primary: #ef7300;
    --cdl-secondary: #d6692e;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, sans-serif;
    display: flex;
    gap: 0;
    border: 1px solid #ddd;
    border-radius: 4px;
    overflow: hidden;
    margin: 20px 0;
    /* Height is set inline from PHP to match map height */
}

/* Search Panel */
.cdl-search-panel {
    width: 360px;
    min-width: 360px;
    background: #f9f9f9;
    display: flex;
    flex-direction: column;
    border-right: 1px solid #ddd;
    overflow: hidden;
    height: 100%;
}

.cdl-search-form {
    padding: 16px;
    background: #fff;
    border-bottom: 1px solid #ddd;
}

.cdl-search-form label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 6px;
    color: #333;
}

#cdl-search-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 14px;
    margin-bottom: 10px;
    box-sizing: border-box;
}

#cdl-search-input:focus {
    border-color: var(--cdl-primary);
    outline: none;
    box-shadow: 0 0 0 2px rgba(239, 115, 0, 0.2);
}

.cdl-search-row {
    display: flex;
    gap: 8px;
    align-items: center;
}

#cdl-radius-select {
    flex: 1;
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 14px;
}

#cdl-search-btn {
    flex: 1;
    padding: 8px 16px;
    background: var(--cdl-primary);
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

#cdl-search-btn:hover {
    background: var(--cdl-secondary);
}

#cdl-reset-btn {
    display: block;
    margin-top: 8px;
    background: none;
    border: none;
    color: #666;
    font-size: 13px;
    cursor: pointer;
    text-decoration: underline;
    padding: 0;
}

#cdl-reset-btn:hover {
    color: var(--cdl-primary);
}

/* Result Count */
#cdl-result-count {
    padding: 8px 16px;
    font-size: 13px;
    color: #666;
    border-bottom: 1px solid #eee;
    background: #fff;
}

/* Results List */
#cdl-results-list {
    flex: 1;
    overflow-y: auto;
    padding: 0;
    min-height: 0;
}

.cdl-result-item {
    padding: 12px 16px;
    border-bottom: 1px solid #eee;
    cursor: pointer;
    transition: background 0.15s;
    position: relative;
}

.cdl-result-item:hover {
    background: #f0f0f0;
}

.cdl-result-item.cdl-result-active {
    background: #fff3e6;
    border-left: 3px solid var(--cdl-primary);
}

.cdl-result-name {
    margin: 0 0 4px 0;
    font-size: 14px;
    font-weight: 600;
    color: #222;
}

.cdl-result-location {
    margin: 0 0 2px 0;
    font-size: 13px;
    color: #555;
}

.cdl-result-phone,
.cdl-result-email {
    margin: 0;
    font-size: 13px;
    color: #555;
}

.cdl-result-distance {
    position: absolute;
    top: 12px;
    right: 16px;
    font-size: 12px;
    font-weight: 600;
    color: var(--cdl-primary);
    background: #fff3e6;
    padding: 2px 8px;
    border-radius: 10px;
}

.cdl-no-results,
.cdl-loading {
    padding: 20px 16px;
    text-align: center;
    color: #666;
    font-size: 14px;
}

/* Map Container */
.cdl-map-wrapper {
    flex: 1;
    min-width: 0;
    position: relative;
}

/* Ctrl+Scroll hint overlay */
.cdl-scroll-hint {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.45);
    color: #fff;
    font-size: 16px;
    font-weight: 600;
    z-index: 1000;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
    border-radius: 4px;
}

.cdl-scroll-hint-visible {
    opacity: 1;
}

#cdl-map {
    width: 100%;
    z-index: 1;
}

/* Marker Icon */
.cdl-marker-icon {
    background: transparent !important;
    border: none !important;
}

/* Popup Styles */
.cdl-popup {
    min-width: 200px;
}

.cdl-popup-name {
    margin: 0 0 8px 0;
    font-size: 16px;
    font-weight: 700;
    color: #222;
}

.cdl-popup-address,
.cdl-popup-phone,
.cdl-popup-email,
.cdl-popup-website,
.cdl-popup-more-info,
.cdl-popup-distance {
    margin: 0 0 4px 0;
    font-size: 13px;
    color: #555;
}

.cdl-popup-phone a,
.cdl-popup-email a {
    color: #333;
    text-decoration: none;
}

.cdl-popup-phone a:hover,
.cdl-popup-email a:hover {
    color: var(--cdl-primary);
}

.cdl-popup-more-info {
    font-style: italic;
}

.cdl-popup-website a {
    color: var(--cdl-primary);
    text-decoration: none;
    font-weight: 600;
}

.cdl-popup-website a:hover {
    text-decoration: underline;
}

.cdl-popup-distance {
    font-size: 12px;
    color: var(--cdl-primary);
    font-weight: 600;
}

/* Leaflet cluster override */
.marker-cluster-small {
    background-color: rgba(239, 115, 0, 0.3) !important;
}

.marker-cluster-small div {
    background-color: rgba(239, 115, 0, 0.6) !important;
    color: #fff !important;
}

.marker-cluster-medium {
    background-color: rgba(214, 105, 46, 0.3) !important;
}

.marker-cluster-medium div {
    background-color: rgba(214, 105, 46, 0.6) !important;
    color: #fff !important;
}

.marker-cluster-large {
    background-color: rgba(180, 80, 20, 0.3) !important;
}

.marker-cluster-large div {
    background-color: rgba(180, 80, 20, 0.6) !important;
    color: #fff !important;
}

/* Responsive */
@media (max-width: 768px) {
    #cdl-dealer-locator {
        flex-direction: column;
    }

    .cdl-search-panel {
        width: 100%;
        min-width: 100%;
        max-height: none;
        border-right: none;
        border-bottom: 1px solid #ddd;
    }

    #cdl-results-list {
        max-height: 200px;
    }

    .cdl-map-wrapper {
        width: 100%;
    }

    #cdl-map {
        min-height: 400px;
    }
}
