/* LSOC Retailer Map Frontend Styles */

/* Two-column container for map and grid */
.lsoc-map-grid-container {
    display: grid;
    grid-template-columns: 380px 1fr;
    gap: 20px;
    margin-top: 20px;
    height: auto;
    align-items: stretch;
    overflow: hidden;
}

/* Map section wrapper */
.lsoc-map-section {
    display: flex;
    flex-direction: column;
    gap: 15px;
    height: 100%;
}

.lsoc-map-container {
    flex: 1;
    min-height: 400px;
    height: 600px; /* Default desktop height */
    border: 1px solid #ddd;
    border-radius: 4px;
}

/* Grid wrapper in column layout */
.lsoc-retailer-grid-wrapper {
    margin-top: 0;
    border-top: none;
    padding-top: 0;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.lsoc-retailer-grid-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-shrink: 0;
    background: #fff;
    padding: 15px 20px;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.lsoc-retailer-grid-header h3 {
    margin: 0;
    font-size: 1.1em;
    font-weight: 600;
    color: #23282d;
}

.lsoc-grid-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

.lsoc-visible-count {
    color: #666;
    font-size: 0.9em;
}

.lsoc-visible-count span {
    font-weight: 600;
    color: #23282d;
}

/* Retailer Grid - 1 Column Layout */
.lsoc-retailer-grid {
    display: block;
    margin-bottom: 0;
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 10px;
    min-height: 0;
}

.lsoc-state-group, 
.lsoc-retailer-card {
    width: 100%;
    box-sizing: border-box;
    margin-bottom: 20px;
}

/* Desktop styling for map-view */
@media (min-width: 783px) {
    .lsoc-map-grid-container {
        height: calc(100vh - 250px);
        max-height: 800px;
        min-height: 600px;
    }
    .lsoc-retailer-grid-wrapper {
        height: calc(100vh - 250px); /* Match container height exactly like backend */
    }
    .lsoc-retailer-grid {
        max-width: 380px;
        flex: 1; /* Fill remaining space in wrapper */
        overflow-y: auto; /* Explicitly set for desktop */
        min-height: 0; /* Allow flex shrinking */
    }
}

/* State Group Headers - Full Width */
.lsoc-state-group {
    grid-column: 1 / -1;
    margin-top: 20px;
    margin-bottom: 10px;
    padding: 8px 12px;
    background: #f8f9fa;
    border-left: 4px solid #e87dac;
    border-radius: 4px;
}

.lsoc-state-group.hidden {
    display: none;
}

.lsoc-state-group:first-child {
    margin-top: 0;
}

.lsoc-state-group h4 {
    margin: 0;
    font-size: 1em;
    font-weight: 600;
    color: #23282d;
}

/* Retailer Info Cards */
.lsoc-retailer-card {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 16px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: all 0.2s ease;
    cursor: pointer;
}

.lsoc-retailer-card:hover {
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
    transform: translateY(-1px);
    border-color: #e87dac;
}

.lsoc-retailer-card.hidden {
    display: none;
}

.lsoc-retailer-card h4 {
    margin: 0 0 8px 0;
    font-size: 1em;
    font-weight: 600;
    color: #23282d;
    line-height: 1.3;
}

.lsoc-retailer-address {
    color: #666;
    font-size: 0.9em;
    line-height: 1.4;
    margin-bottom: 12px;
}

/* Action Buttons */
.lsoc-retailer-actions {
    display: flex;
    gap: 8px;
    margin-top: 15px;
    justify-content: flex-start;
    flex-wrap: wrap;
}

.lsoc-retailer-actions .lsoc-action-btn {
    flex: 1;
    min-width: 0; /* Allow shrinking */
    justify-content: flex-start;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    white-space: nowrap;
    transition: all 0.2s ease;
}

.lsoc-retailer-actions .lsoc-action-btn i {
    margin-right: 6px;
}


/* Popup Action Buttons */
.lsoc-popup-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    justify-content: flex-start;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #e9ecef;
    flex-wrap: wrap;
}

.lsoc-popup-actions .lsoc-popup-action-btn {
    flex: 1;
    min-width: 0;
    justify-content: center;
    padding: 0 8px;
    display: inline-flex;
    align-items: center;
    white-space: nowrap;
    font-size: 12px;
    height: 28px;
    line-height: 28px;
    border-radius: 4px;
    border: none;
    box-shadow: none;
    background-color: #fef7fb;
    color: #333;
    border: 1px solid #f5e6f0;
    transition: all 0.2s ease;
}

.lsoc-popup-actions .lsoc-popup-action-btn:hover {
    background-color: #e87dac;
    color: #fff;
    border-color: #e87dac;
}

.lsoc-popup-actions .lsoc-popup-action-btn i {
    margin-right: 4px;
    font-size: 11px;
}

/* Button Content Display Modes */
.lsoc-retailer-actions .lsoc-action-btn[data-display-mode="icon_only"] .lsoc-btn-label,
.lsoc-retailer-actions .lsoc-action-btn[data-display-mode="icon_only"] .w-btn-label,
.lsoc-popup-actions .lsoc-popup-action-btn[data-display-mode="icon_only"] .lsoc-btn-label {
    display: none;
}

.lsoc-retailer-actions .lsoc-action-btn[data-display-mode="text_only"] i,
.lsoc-popup-actions .lsoc-popup-action-btn[data-display-mode="text_only"] i {
    display: none;
}

/* Icon-only mode adjustments */
.lsoc-retailer-actions .lsoc-action-btn[data-display-mode="icon_only"] {
    width: 32px;
    padding: 0 6px;
}

.lsoc-popup-actions .lsoc-popup-action-btn[data-display-mode="icon_only"] {
    width: 28px;
    padding: 0 4px;
}

/* Radio group styling for admin settings */
.lsoc-radio-group {
    margin-top: 10px;
}

.lsoc-radio-option {
    display: block;
    margin-bottom: 8px;
    cursor: pointer;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    transition: border-color 0.2s ease;
}

.lsoc-radio-option:hover {
    border-color: #e87dac;
}

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

.lsoc-radio-text {
    font-weight: 500;
    color: #23282d;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .lsoc-map-grid-container {
        grid-template-columns: 1fr;
        gap: 15px;
        height: auto; /* Allow container to expand */
        overflow: visible; /* Show all content */
    }

    .lsoc-retailer-grid-wrapper {
        order: 2;
        height: auto; /* Allow wrapper to expand */
        max-height: none; /* Remove height constraint */
    }

    .lsoc-map-section {
        order: 1;
        height: auto;
    }

    .lsoc-map-container {
        height: 400px;
        flex: none;
    }

    .lsoc-retailer-grid {
        height: auto; /* Allow grid to be as tall as content */
        max-height: none; /* Remove height constraints */
        overflow-y: visible; /* Show all content without scrolling */
        overflow-x: hidden;
        flex: none;
    }
}

@media (max-width: 600px) {
    .lsoc-retailer-grid-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
        padding: 12px 15px;
    }
    .lsoc-grid-controls {
        width: 100%;
        justify-content: space-between;
    }
    .lsoc-admin-grid-search-wrapper {
        flex-wrap: wrap;
    }
    .lsoc-admin-grid-search-input-group {
        width: 100%;
        flex: none;
    }
    .lsoc-admin-grid-radius-group {
        flex: 1;
    }
}

@media (max-width: 400px) {
    .lsoc-retailer-actions .lsoc-action-btn .lsoc-btn-label {
        display: none;
    }
    .lsoc-retailer-actions .lsoc-action-btn i {
        margin-right: 0;
    }
    .lsoc-retailer-actions .lsoc-action-btn {
        justify-content: center;
    }
}

/* Retailer Card Header Layout */
.lsoc-retailer-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 8px;
}

.lsoc-retailer-header h4 {
    margin: 0;
    font-size: 1em;
    font-weight: 600;
    color: #23282d;
    line-height: 1.3;
}

.lsoc-distance-badge {
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 12px;
    white-space: nowrap;
    text-transform: uppercase;
    display: inline-block;
}

.lsoc-distance-badge.tier-0 { background: #e8f5e9; color: #2e7d32; border: 1px solid #4caf50; }
.lsoc-distance-badge.tier-5 { background: #e3f2fd; color: #1565c0; border: 1px solid #2196f3; }
.lsoc-distance-badge.tier-25, .lsoc-distance-badge.tier-50 { background: #fff3e0; color: #e65100; border: 1px solid #ff9800; }
.lsoc-distance-badge.tier-150, .lsoc-distance-badge.tier-300, .lsoc-distance-badge.tier-500 { background: #f5f5f5; color: #616161; border: 1px solid #bdbdbd; }

/* Search Results Group */
.lsoc-search-results-group {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 4px;
    margin: 10px 0;
    padding: 8px 12px;
}

.lsoc-search-results-label {
    font-weight: 600;
    color: #495057;
    font-size: 14px;
}

/* Card Highlight Styling */
.lsoc-card-highlight {
    border: 1px solid #e87dac !important;
    border-radius: 8px;
}

/* Leaflet Popup Customizations */
.lsoc-retailer-popup {
    padding: 16px;
}

/* Admin Grid Search Container */
.lsoc-admin-grid-search-container {
    margin-bottom: 20px;
    padding: 16px;
    background: #f8f9fa;
    border-radius: 6px;
    border: 1px solid #e1e5e9;
}

.lsoc-admin-grid-search-wrapper {
    display: flex;
    flex-wrap: nowrap;
    gap: 10px;
    align-items: center;
}

.lsoc-admin-grid-search-input-group {
    position: relative;
    flex: 1;
    min-width: 180px;
}

.lsoc-admin-location-search {
    width: 100%;
    padding: 8px 10px;
    padding-right: 70px;
    font-size: 14px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.lsoc-admin-search-type-indicator {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    padding: 2px 5px;
    border-radius: 3px;
}

.lsoc-admin-search-type-indicator.postcode { background: #e3f2fd; color: #1565c0; }
.lsoc-admin-search-type-indicator.suburb { background: #e8f5e9; color: #2e7d32; }

.lsoc-admin-grid-radius-group { min-width: 90px; }
.lsoc-admin-radius-select {
    padding: 8px 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #fff;
}

.lsoc-admin-search-btn {
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
    color: #666;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s ease;
}

.lsoc-admin-search-btn:hover {
    color: #e87dac;
}

.lsoc-admin-mode-indicator {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    margin-left: 10px;
}

.lsoc-admin-mode-indicator.viewport-mode { background: #e87dac; color: #000000; }
.lsoc-admin-mode-indicator.search-mode { background: #e87dac; color: #000000; }

.lsoc-search-results-group {
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
    border-left: 4px solid #2196f3;
    position: relative;
}

.lsoc-search-results-label {
    font-weight: 600;
    color: #1565c0;
    font-size: 1.1em;
    display: block;
    padding: 8px 0;
}

.lsoc-retailer-card.search-hidden {
    display: none;
}

/* Custom scrollbar styling for better UX */
.lsoc-retailer-grid::-webkit-scrollbar {
    width: 6px;
}

.lsoc-retailer-grid::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.lsoc-retailer-grid::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.lsoc-retailer-grid::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}
