/**
 * Morocco Pharmacy Locator - Frontend Styles
 * 
 * @package Morocco_Pharmacy_Locator
 */

/* Container */
.mpl-locator-container {
    width: 100%;
    max-width: 100%;
    margin: 20px 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Ubuntu, Cantarell, sans-serif;
}

/* Search and Filters */
.mpl-search-filters {
    background: #fff;
    padding: 20px;
    margin-bottom: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.mpl-search-row {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.mpl-search-field {
    flex: 1;
    min-width: 200px;
}

.mpl-search-field label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    font-size: 14px;
    color: #333;
}

/* Search field wrapper for autocomplete positioning */
.mpl-search-wrapper {
    position: relative;
}

.mpl-search-field {
    position: relative;
}

.mpl-city-input,
.mpl-radius-select {
    width: 100%;
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

/* Autocomplete dropdown */
.mpl-autocomplete-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #ddd;
    border-top: none;
    border-radius: 0 0 4px 4px;
    max-height: 300px;
    overflow-y: auto;
    z-index: 9999 !important;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    display: none;
    margin-top: 0;
}

.mpl-autocomplete-results[style*="display: block"] {
    display: block !important;
}

.mpl-autocomplete-item {
    padding: 12px 15px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    transition: background-color 0.2s;
    font-size: 14px;
}

.mpl-autocomplete-item:hover {
    background-color: #f5f5f5;
}

.mpl-autocomplete-item:last-child {
    border-bottom: none;
}

.mpl-search-actions {
    display: flex;
    gap: 10px;
    align-items: flex-end;
}

.mpl-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
    display: inline-block;
}

.mpl-btn-primary {
    background: #0073aa;
    color: #fff;
}

.mpl-btn-primary:hover {
    background: #005177;
}

.mpl-btn-secondary {
    background: #2ea44f;
    color: #fff;
}

.mpl-btn-secondary:hover {
    background: #2c974b;
}

.mpl-btn-small {
    padding: 6px 12px;
    font-size: 12px;
}

.mpl-btn .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
    vertical-align: middle;
    margin-right: 5px;
}

.mpl-filters-row {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    padding-top: 15px;
    border-top: 1px solid #eee;
}

.mpl-filter-checkbox {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-size: 14px;
}

.mpl-filter-checkbox input {
    margin-right: 8px;
    cursor: pointer;
}

/* Content Container */
.mpl-content-container {
    display: grid;
    grid-template-columns: 1fr 450px;
    gap: 20px;
}

@media (max-width: 1024px) {
    .mpl-content-container {
        grid-template-columns: 1fr;
    }
}

/* Map */
.mpl-map-container {
    position: relative;
    background: #f5f5f5;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

#mpl-map {
    width: 100%;
    min-height: 500px;
}

/* Search in area button */
.mpl-search-area-btn {
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    padding: 12px 24px;
    background: white;
    border: none;
    border-radius: 8px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.2);
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    color: #333;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
    animation: slideDown 0.3s ease;
}

.mpl-search-area-btn:hover {
    background: #4CAF50;
    color: white;
    box-shadow: 0 4px 16px rgba(76, 175, 80, 0.3);
}

.mpl-search-area-btn .dashicons {
    font-size: 18px;
    width: 18px;
    height: 18px;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

.mpl-map-loading {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255,255,255,0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.mpl-spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #0073aa;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Results */
.mpl-results-container {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    overflow: hidden;
}

.mpl-results-header {
    padding: 20px;
    background: #f8f9fa;
    border-bottom: 2px solid #e9ecef;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.mpl-results-header h3 {
    margin: 0;
    font-size: 18px;
    color: #333;
}

.mpl-results-count {
    background: #0073aa;
    color: #fff;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
}

.mpl-results-list {
    max-height: 600px;
    overflow-y: auto;
}

/* Result Card */
.mpl-result-card {
    padding: 20px;
    border-bottom: 1px solid #e9ecef;
    cursor: pointer;
    transition: background 0.2s;
}

.mpl-result-card:hover {
    background: #f8f9fa;
}

.mpl-result-card.mpl-on-duty {
    border-left: 4px solid #2ea44f;
}

.mpl-result-card.mpl-open {
    border-left: 4px solid #ffa500;
}

.mpl-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 10px;
}

.mpl-card-header h4 {
    margin: 0;
    font-size: 16px;
    color: #333;
    flex: 1;
}

.mpl-distance {
    background: #e9ecef;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    color: #666;
}

.mpl-card-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 12px;
}

.mpl-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}

.mpl-badge-duty {
    background: #d4edda;
    color: #155724;
}

.mpl-badge-247 {
    background: #cce5ff;
    color: #004085;
}

.mpl-badge-open {
    background: #fff3cd;
    color: #856404;
}

.mpl-badge-closed {
    background: #f8d7da;
    color: #721c24;
}

.mpl-badge-osm {
    background: #e3f2fd;
    color: #1565c0;
}

.mpl-badge-para {
    background: #f3e5f5;
    color: #6a1b9a;
}

.mpl-card-details {
    margin-bottom: 12px;
}

.mpl-card-details p {
    margin: 6px 0;
    font-size: 13px;
    color: #666;
}

.mpl-card-details a {
    color: #0073aa;
    text-decoration: none;
}

.mpl-card-details a:hover {
    text-decoration: underline;
}

.mpl-card-actions {
    display: flex;
    gap: 8px;
    padding-top: 12px;
    border-top: 1px solid #e9ecef;
}

/* Info Window */
.mpl-info-window {
    padding: 5px;
    max-width: 250px;
}

.mpl-info-window h4 {
    margin: 0 0 10px 0;
    font-size: 16px;
    color: #333;
}

.mpl-info-window p {
    margin: 5px 0;
    font-size: 13px;
    color: #666;
}

.mpl-info-window .mpl-card-badges {
    margin-bottom: 10px;
}

/* No Results */
.mpl-no-results {
    padding: 40px 20px;
    text-align: center;
    color: #999;
}

.mpl-no-results p {
    margin: 0;
    font-size: 14px;
}

/* Responsive */
@media (max-width: 768px) {
    .mpl-search-row {
        flex-direction: column;
    }
    
    .mpl-search-actions {
        width: 100%;
    }
    
    .mpl-btn {
        flex: 1;
    }
    
    .mpl-content-container {
        grid-template-columns: 1fr;
    }
    
    #mpl-map {
        min-height: 400px;
    }
    
    .mpl-results-list {
        max-height: 400px;
    }
}
