/* Modern Product Map Styles */

/* CSS Variables for consistent theming */
:root {
    --primary-color: #3B82F6;
    --primary-hover: #2563EB;
    --primary-light: #EBF4FF;
    --secondary-color: #10B981;
    --secondary-hover: #059669;
    --info-color: #06B6D4;
    --info-hover: #0891B2;
    --danger-color: #EF4444;
    --warning-color: #F59E0B;
    --success-color: #10B981;
    --success-hover: #059669;
    --gray-50: #F9FAFB;
    --gray-100: #F3F4F6;
    --gray-200: #E5E7EB;
    --gray-300: #D1D5DB;
    --gray-400: #9CA3AF;
    --gray-500: #6B7280;
    --gray-600: #4B5563;
    --gray-700: #374151;
    --gray-800: #1F2937;
    --gray-900: #111827;
    --border-radius: 12px;
    --border-radius-lg: 16px;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --transition-base: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-fast: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Base Container */
.product-vendor-store-locator {
    margin: 24px 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
}

/* Layout Grid */
.dokan-geolocation-row {
    display: flex;
    gap: 24px;
    flex-wrap: wrap;
    align-items: flex-start;
}

.dokan-geolocation-map-right {
    flex-direction: row;
}

.dokan-geolocation-col-7 {
    flex: 0 0 42%;
    min-width: 360px;
    max-width: 42%;
}

.dokan-geolocation-col-5 {
    flex: 0 0 56%;
    min-width: 400px;
    max-width: 56%;
    position: sticky;
    top: 24px;
    height: fit-content;
}

.dokan-geolocation-col-12 {
    flex: 1 1 100%;
}

/* Map Container */
#product-map {
    width: 100%;
    height: 100%;
    min-height: 600px;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    border: 1px solid var(--gray-200);
}

/* Search Filters Container */
.dokan-geolocation-location-filters {
    background: linear-gradient(135deg, #FFFFFF 0%, #F8FAFC 100%);
    padding: 28px;
    border-radius: var(--border-radius-lg);
    margin-bottom: 24px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--gray-200);
    position: relative;
    overflow: hidden;
}

.dokan-geolocation-location-filters::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color), var(--info-color));
}

/* Form Layout */
.dokan-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.dokan-geo-filters-column.dokan-w12 {
    grid-column: 1 / -1;
}

/* Modern Input Fields */
.dokan-form-control {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid var(--gray-200);
    border-radius: var(--border-radius);
    font-size: 15px;
    font-weight: 500;
    color: var(--gray-800);
    background: #FFFFFF;
    transition: var(--transition-base);
    position: relative;
}

.dokan-form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
    transform: translateY(-1px);
}

.dokan-form-control::placeholder {
    color: var(--gray-400);
    font-weight: 400;
}

/* Location Input with Icon */
.location-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

#location-search {
    padding-left: 48px;
    padding-right: 52px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%236B7280' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 10c0 7-9 13-9 13s-9-6-9-13a9 9 0 0 1 18 0z'%3E%3C/path%3E%3Ccircle cx='12' cy='10' r='3'%3E%3C/circle%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: 16px center;
    background-size: 20px 20px;
}

#location-search:focus {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%233B82F6' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 10c0 7-9 13-9 13s-9-6-9-13a9 9 0 0 1 18 0z'%3E%3C/path%3E%3Ccircle cx='12' cy='10' r='3'%3E%3C/circle%3E%3C/svg%3E");
}

/* Crosshair Button */
.location-crosshair-btn {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: var(--gray-100);
    border: none;
    color: var(--gray-500);
    cursor: pointer;
    padding: 10px;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    font-size: 18px;
    transition: var(--transition-base);
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
}

.location-crosshair-btn:hover {
    background: var(--primary-color);
    color: white;
    transform: translateY(-50%) scale(1.05);
}

.location-crosshair-btn:active {
    transform: translateY(-50%) scale(0.95);
}

.location-crosshair-btn.loading {
    animation: spin 1s linear infinite;
}

/* Button Group */
.button-group {
    display: flex;
    gap: 12px;
    width: 100%;
}

/* Primary Button (Search) */
#custom-product-search-btn,
.dokan-btn {
    padding: 14px 24px;
    border: none;
    border-radius: var(--border-radius);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-base);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-decoration: none;
    position: relative;
    overflow: hidden;
}

#custom-product-search-btn {
    flex: 1;
    background: var(--primary-color);
    color: white;
    box-shadow: var(--shadow-md);
}

#custom-product-search-btn:hover:not(:disabled) {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

#custom-product-search-btn:active {
    transform: translateY(0);
}

#custom-product-search-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Clear Button */
.clear-filters-btn {
    flex: 1;
    background: var(--gray-100);
    color: var(--gray-700);
    border: 2px solid var(--gray-200);
    box-shadow: var(--shadow-sm);
}

.clear-filters-btn:hover {
    background: var(--gray-200);
    border-color: var(--gray-300);
    transform: translateY(-1px);
}

/* Loading State */
#custom-product-search-btn.loading {
    color: transparent;
}

#custom-product-search-btn.loading::after {
    content: "";
    position: absolute;
    width: 20px;
    height: 20px;
    top: 50%;
    left: 50%;
    margin-left: -10px;
    margin-top: -10px;
    border: 2px solid white;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 0.8s linear infinite;
}

/* Range Slider Container */
.range-slider-container {
    display: flex;
    justify-content: space-between;
    gap: 8px;
}

.dokan-range-slider-value {
    font-size: 16px;
    color: var(--gray-800);
    font-weight: 600;
    min-width: 120px;
    display: flex;
    align-items: center;
    gap: 8px;
}

#radius-unit {
    color: var(--primary-color);
    font-weight: 700;
}

/* Custom Range Slider */
.dokan-range-slider {
    flex: 1;
    height: 8px;
    border-radius: 50px;
    background: linear-gradient(to right, var(--primary-light) 0%, var(--gray-200) 100%);
    outline: none;
    -webkit-appearance: none;
    min-width: 200px;
    position: relative;
}

.dokan-range-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-hover));
    cursor: pointer;
    transition: var(--transition-base);
    box-shadow: var(--shadow-md);
    border: 4px solid white;
}

.dokan-range-slider::-webkit-slider-thumb:hover {
    transform: scale(1.15);
    box-shadow: 0 0 0 8px rgba(59, 130, 246, 0.15), var(--shadow-lg);
}

.dokan-range-slider::-moz-range-thumb {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-hover));
    cursor: pointer;
    transition: var(--transition-base);
    border: 4px solid white;
    box-shadow: var(--shadow-md);
}

/* Unit Toggle Switch */
.unit-toggle {
    display: inline-flex;
    align-items: center;
    background: var(--gray-100);
    border-radius: 50px;
    padding: 4px;
    position: relative;
    min-width: 140px;
    height: 44px;
    border: 2px solid var(--gray-200);
}

.unit-toggle::before {
    content: "";
    position: absolute;
    width: calc(50% - 6px);
    height: 34px;
    background: linear-gradient(135deg, white, var(--gray-50));
    border-radius: 50px;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-md);
    left: 4px;
}

.unit-toggle.km-active::before {
    transform: translateX(calc(100% + 4px));
}

.unit-toggle input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.unit-toggle label {
    flex: 1;
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 600;
    color: var(--gray-500);
    cursor: pointer;
    transition: var(--transition-base);
    border-radius: 50px;
    margin: 0;
    text-align: center;
    z-index: 1;
    position: relative;
    user-select: none;
}

.unit-toggle input[type="radio"]:checked + label {
    color: var(--primary-color);
}

/* Product List */
#product-list {
    display: block;
    max-height: 580px;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 8px;
    margin-right: -8px;
}

/* Custom Scrollbar */
#product-list::-webkit-scrollbar {
    width: 6px;
}

#product-list::-webkit-scrollbar-track {
    background: var(--gray-100);
    border-radius: 3px;
}

#product-list::-webkit-scrollbar-thumb {
    background: var(--gray-300);
    border-radius: 3px;
    transition: var(--transition-base);
}

#product-list::-webkit-scrollbar-thumb:hover {
    background: var(--gray-400);
}

#product-list li {
    list-style: none;
    margin-bottom: 20px;
}

/* Store Card - Enhanced Design */
.store-wrapper {
    background: linear-gradient(135deg, #FFFFFF 0%, #FAFBFC 100%);
    border-radius: var(--border-radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-md);
    transition: var(--transition-base);
    height: 100%;
    display: flex;
    flex-direction: column;
    width: 100%;
    border: 1px solid var(--gray-200);
    position: relative;
}

.store-wrapper::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.store-wrapper:hover::before {
    transform: scaleX(1);
}

.store-wrapper:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-xl);
    border-color: var(--primary-color);
}

.store-wrapper.nearest-highlight {
    border: 2px solid var(--primary-color);
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1), var(--shadow-xl);
    animation: pulse-highlight 2s ease-in-out;
}

@keyframes pulse-highlight {
    0%, 100% {
        box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1), var(--shadow-xl);
    }
    50% {
        box-shadow: 0 0 0 8px rgba(59, 130, 246, 0.2), var(--shadow-xl);
    }
}

/* Store Header */
.store-header {
    position: relative;
    height: 140px;
    overflow: hidden;
}

.store-banner img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.store-wrapper:hover .store-banner img {
    transform: scale(1.05);
}

/* Store Content */
.store-content {
    padding: 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.store-content h2 {
    margin: 0 0 8px;
    font-size: 18px;
    font-weight: 700;
    line-height: 1.3;
}

.store-content h2 a {
    color: var(--gray-800);
    text-decoration: none;
    transition: var(--transition-base);
}

.store-content h2 a:hover {
    color: var(--primary-color);
}

.store-name {
    color: var(--gray-600);
    font-size: 14px;
    margin: 0 0 8px;
    font-weight: 600;
}

.store-address {
    color: var(--gray-500);
    font-size: 13px;
    margin: 0 0 12px;
    line-height: 1.4;
}

.store-distance {
    color: var(--primary-color);
    font-size: 13px;
    font-weight: 700;
    margin: 8px 0;
    background: var(--primary-light);
    padding: 4px 8px;
    border-radius: 6px;
    display: inline-block;
}

.store-price {
    color: var(--success-color);
    font-size: 16px;
    font-weight: 700;
    margin: 8px 0;
    background: linear-gradient(135deg, #D1FAE5, #A7F3D0);
    padding: 8px 12px;
    border-radius: 8px;
    display: inline-block;
}

/* Store Actions - Updated for Two Rows */
.store-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: auto;
    padding-top: 16px;
}

.action-row {
    display: flex;
    gap: 8px;
}

.store-actions button {
    flex: 1;
    padding: 10px 12px;
    font-size: 13px;
    font-weight: 600;
    border-radius: 8px;
    border: 2px solid transparent;
    cursor: pointer;
    transition: var(--transition-base);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    position: relative;
    overflow: hidden;
}

/* Button Variants */
.dokan-btn-sm {
    padding: 8px 12px;
    font-size: 12px;
}

.dokan-btn-theme,
.route-btn {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.dokan-btn-theme:hover,
.route-btn:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.dokan-btn-success,
.view-product-btn {
    background: var(--success-color);
    color: white;
    border-color: var(--success-color);
}

.dokan-btn-success:hover,
.view-product-btn:hover {
    background: var(--success-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.dokan-btn-info,
.visit-store-btn {
    background: var(--info-color);
    color: white;
    border-color: var(--info-color);
}

.dokan-btn-info:hover,
.visit-store-btn:hover {
    background: var(--info-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.zoom-btn {
    background: var(--gray-100);
    color: var(--gray-700);
    border-color: var(--gray-200);
}

.zoom-btn:hover {
    background: var(--gray-200);
    border-color: var(--gray-300);
    transform: translateY(-2px);
}

/* Map Info Window Styles */
.map-info-window {
    min-width: 280px;
    padding: 16px;
    font-family: inherit;
}

.map-info-window h3 {
    margin: 0 0 12px;
    font-size: 18px;
    font-weight: 700;
    color: var(--gray-800);
}

.map-info-window p {
    margin: 6px 0;
    font-size: 14px;
    color: var(--gray-600);
    line-height: 1.4;
}

.map-info-window strong {
    color: var(--gray-800);
}

.info-button-row {
    display: flex;
    gap: 8px;
    justify-content: space-between;
    margin-top: 8px;
}

.info-button-row button {
    flex: 1;
    padding: 8px 12px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    transition: var(--transition-base);
}

.info-zoom-btn {
    background: var(--gray-100);
    color: var(--gray-700);
}

.info-zoom-btn:hover {
    background: var(--gray-200);
    transform: translateY(-1px);
}

.info-route-btn {
    background: var(--primary-color);
    color: white;
}

.info-route-btn:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

.info-view-product-btn {
    background: var(--success-color) !important;
    color: white !important;
}

.info-view-product-btn:hover {
    background: var(--success-hover) !important;
    transform: translateY(-1px);
}

.info-visit-store-btn {
    background: var(--info-color) !important;
    color: white !important;
}

.info-visit-store-btn:hover {
    background: var(--info-hover) !important;
    transform: translateY(-1px);
}

/* Search Autocomplete Dropdown */
.search-autocomplete-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 2px solid var(--gray-200);
    border-top: none;
    border-radius: 0 0 var(--border-radius) var(--border-radius);
    max-height: 320px;
    overflow-y: auto;
    z-index: 1000;
    box-shadow: var(--shadow-lg);
    margin-top: -2px;
}

.autocomplete-item {
    padding: 12px 16px;
    cursor: pointer;
    border-bottom: 1px solid var(--gray-100);
    display: flex;
    align-items: center;
    gap: 12px;
    transition: var(--transition-base);
}

.autocomplete-item:last-child {
    border-bottom: none;
}

.autocomplete-item:hover,
.autocomplete-item.selected {
    background: var(--primary-light);
}

.autocomplete-type {
    font-size: 18px;
    min-width: 24px;
    text-align: center;
}

.autocomplete-type.product {
    color: var(--success-color);
}

.autocomplete-type.vendor {
    color: var(--info-color);
}

.autocomplete-text {
    flex: 1;
    font-size: 14px;
    color: var(--gray-700);
    font-weight: 500;
}

.autocomplete-text strong {
    color: var(--gray-900);
    font-weight: 700;
    background: var(--warning-color);
    color: white;
    padding: 2px 4px;
    border-radius: 4px;
}

/* Route Info */
.route-info {
    padding: 16px;
    min-width: 240px;
}

.route-info h4 {
    margin: 0 0 12px;
    font-size: 16px;
    font-weight: 700;
    color: var(--gray-800);
}

.route-info p {
    margin: 6px 0;
    font-size: 14px;
    color: var(--gray-600);
}

.route-info button {
    margin-top: 12px;
    padding: 10px 16px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: var(--transition-base);
}

.route-info button:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

/* Loading States */
.dokan-spinner {
    text-align: center;
    padding: 60px;
}

.dokan-loading {
    display: inline-block;
    width: 48px;
    height: 48px;
    border: 4px solid var(--gray-200);
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Error Message */
.error-message {
    background: linear-gradient(135deg, #FEF3C7, #FDE68A);
    border: 2px solid var(--warning-color);
    color: #92400E;
    padding: 20px;
    border-radius: var(--border-radius);
    text-align: center;
    margin: 20px 0;
    font-weight: 600;
}

/* Custom Map Control */
.custom-map-control {
    margin: 12px;
    padding: 10px 20px;
    background: white;
    border: 2px solid var(--gray-200);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-md);
    color: var(--gray-800);
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    text-align: center;
    transition: var(--transition-base);
}

.custom-map-control:hover {
    background: var(--primary-color);
    color: white;
    transform: translateY(-2px);
}

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

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Responsive Design */
@media (max-width: 1200px) {
    .dokan-geolocation-col-7 {
        flex: 0 0 45%;
        max-width: 45%;
    }
    
    .dokan-geolocation-col-5 {
        flex: 0 0 53%;
        max-width: 53%;
    }
}

@media (max-width: 768px) {
    .dokan-geolocation-row {
        flex-direction: column;
        gap: 16px;
    }
    
    .dokan-geolocation-col-7,
    .dokan-geolocation-col-5 {
        width: 100%;
        flex: 1 1 100%;
        max-width: 100%;
        min-width: auto;
    }
    
    .dokan-geolocation-col-5 {
        position: relative;
        top: 0;
    }
    
    #product-map {
        min-height: 400px;
    }
    
    #product-list {
        max-height: 500px;
    }
    
    .dokan-row {
        grid-template-columns: 1fr;
    }
    
    .range-slider-container {
        flex-direction: column;
        align-items: stretch;
        gap: 16px;
    }
    
    .dokan-range-slider-value {
        min-width: auto;
        justify-content: space-between;
    }
}

@media (max-width: 480px) {
    .product-vendor-store-locator {
        margin: 16px -16px;
        padding: 0 16px;
    }
    
    .dokan-geolocation-location-filters {
        padding: 20px;
        margin-bottom: 16px;
    }
    
    .button-group {
        flex-direction: column;
    }
    
    .unit-toggle {
        min-width: 120px;
        height: 40px;
    }
    
    #product-list {
        max-height: 400px;
    }
    
    .store-actions {
        gap: 6px;
    }
    
    .action-row {
        gap: 6px;
    }
    
    .map-info-window {
        min-width: 240px;
    }
}