/**
 * Riverside Pharmacy Locator - Public Styles
 * Matches Riverside Farm theme design system
 */

/* ============================================
   CSS Variables - Aligned with Theme
   ============================================ */
:root {
    --rpl-accent-color: #A69B73;
    --rpl-accent-dark: #8f8461;
    --rpl-accent-light: #bdb19b;
    
    --rpl-text-primary: #28333A;
    --rpl-text-secondary: #666666;
    --rpl-text-muted: #999999;
    
    --rpl-success: #22c55e;
    --rpl-warning: #f59e0b;
    --rpl-danger: #ef4444;
    --rpl-blue: #2288C9;
    --rpl-blue-dark: #1a6fa8;
    
    --rpl-border-color: #e0e0e0;
    --rpl-border-radius-sm: 6px;
    --rpl-border-radius-md: 8px;
    --rpl-border-radius-lg: 12px;
    --rpl-border-radius-xl: 16px;
    
    --rpl-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --rpl-shadow-md: 0 4px 12px rgba(0, 0, 0, 0.12);
    --rpl-shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.15);
    
    --rpl-transition-fast: 0.2s ease;
    --rpl-transition-base: 0.3s ease;
}

/* ============================================
   Main Container
   ============================================ */
.rpl-pharmacy-locator {
    font-family: "Poppins", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    margin: 0 auto;
    max-width: 100%;
    padding: 0px 0px;
}
body .leaflet-pane {
    z-index: 50;
}
/* ============================================
   Controls
   ============================================ */
.rpl-controls {
    display: none; /* Hidden per client request */
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 0 5px;
}

.rpl-find-me-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 12px 24px;
    background: var(--rpl-blue);
    color: #fff;
    border: 2px solid var(--rpl-blue);
    border-radius: 50px;
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--rpl-transition-base);
    box-shadow: 0 2px 8px rgba(34, 136, 201, 0.2);
}

.rpl-find-me-btn:hover:not(:disabled) {
    background: var(--rpl-blue-dark);
    border-color: var(--rpl-blue-dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(34, 136, 201, 0.3);
}

.rpl-find-me-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.rpl-legend {
    display: flex;
    gap: 20px;
    align-items: center;
}

.rpl-legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.875rem;
    color: var(--rpl-text-secondary);
    font-weight: 500;
}

.rpl-legend-marker {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid;
}

.rpl-legend-in-stock .rpl-legend-marker {
    background: var(--rpl-success);
    border-color: var(--rpl-success);
}

.rpl-legend-out-stock .rpl-legend-marker {
    background: transparent;
    border-color: var(--rpl-text-muted);
    opacity: 0.5;
}

/* ============================================
   Main Container (Map + List)
   ============================================ */
.rpl-container {
    display: grid !important;
    grid-template-columns: 400px 1fr !important;
    gap: 20px;
    min-height: 600px;
    width: 100%;
    position: relative;
}

/* ============================================
   Map
   ============================================ */
.rpl-map-wrapper {
    grid-column: 2 !important;
    grid-row: 1 !important;
    position: relative;
    background: #fff;
    border: 1px solid var(--rpl-border-color);
    border-radius: var(--rpl-border-radius-xl);
    overflow: hidden;
    box-shadow: var(--rpl-shadow-md);
    width: 100%;
    height: 70vh;
}

.rpl-map {
    width: 100%;
    height: 100%;
    min-height: 600px;
}

.rpl-map-loading {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.95);
    z-index: 1000;
}

.rpl-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid #f3f4f6;
    border-top-color: var(--rpl-accent-color);
    border-radius: 50%;
    animation: rpl-spin 0.8s linear infinite;
}

@keyframes rpl-spin {
    to {
        transform: rotate(360deg);
    }
}

.rpl-map-loading p {
    margin-top: 15px;
    color: var(--rpl-text-secondary);
    font-size: 0.9375rem;
}

/* Custom Markers */
.rpl-custom-marker {
    background: none !important;
    border: none !important;
}

.rpl-marker {
    width: 38px !important;
    height: 59px !important;
    max-width: 38px !important;
    max-height: 59px !important;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--rpl-transition-base);
}

.rpl-marker img {
    width: 38px !important;
    height: 59px !important;
    max-width: 38px !important;
    max-height: 59px !important;
    object-fit: contain;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.45));
}

.rpl-marker.out-of-stock img {
    filter: grayscale(100%) drop-shadow(0 2px 4px rgba(0, 0, 0, 0.45));
}
.rpl-marker.out-of-stock{
    opacity: 0.65;
}
/* Leaflet Popup Customization */
.leaflet-popup-content-wrapper {
    border-radius: var(--rpl-border-radius-md) !important;
    box-shadow: var(--rpl-shadow-lg) !important;
}

.rpl-popup-content {
    padding: 5px;
}

.rpl-popup-content.out-of-stock {
    opacity: 0.8;
}

.rpl-popup-title {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--rpl-text-primary);
    margin: 0 0 10px;
}

.rpl-popup-stock {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.8125rem;
    font-weight: 600;
    margin-bottom: 12px;
}

.rpl-popup-stock.in-stock {
    background: #d1fae5;
    color: #065f46;
}

.rpl-popup-stock.out-of-stock {
    background: #fee2e2;
    color: #991b1b;
}

.rpl-popup-address p {
    margin: 0 0 10px;
    color: var(--rpl-text-secondary);
    line-height: 1.5;
}

.rpl-popup-phone,
.rpl-popup-hours {
    font-size: 0.875rem;
    margin: 5px 0;
}

.rpl-popup-phone a,
.rpl-popup-website,
.rpl-popup-directions {
    color: var(--rpl-blue);
    text-decoration: none;
    font-weight: 500;
    transition: color var(--rpl-transition-fast);
}

.rpl-popup-phone a:hover,
.rpl-popup-website:hover,
.rpl-popup-directions:hover {
    color: var(--rpl-blue-dark);
    text-decoration: underline;
}

.rpl-popup-distance {
    font-size: 0.875rem;
    color: var(--rpl-text-muted);
    margin: 8px 0 0;
}

/* ============================================
   Pharmacy List
   ============================================ */
.rpl-list-wrapper {
    grid-column: 1 !important;
    grid-row: 1 !important;
    display: flex;
    flex-direction: column;
    background: #fff;
    border: 1px solid var(--rpl-border-color);
    border-radius: var(--rpl-border-radius-xl);
    overflow: hidden;
    box-shadow: var(--rpl-shadow-md);
    height: 70vh; /* Match map height */
    width: 100%;
    position: relative;
}

.rpl-list-header {
    padding: 20px;
    background: #28333A;
    border-radius: 8px 8px 0 0;
}

.rpl-list-header h3 {
    font-size: 1.125rem;
    font-weight: 700;
    color: #ffffff;
    margin: 0 0 15px;
}

.rpl-list-header .rpl-search-input,
input.rpl-search-input {
    width: 100% !important;
    padding: 10px 15px !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
    border-radius: var(--rpl-border-radius-md) !important;
    font-size: 0.9375rem !important;
    transition: border-color var(--rpl-transition-fast), box-shadow var(--rpl-transition-fast) !important;
    background: rgba(255, 255, 255, 0.15) !important;
    background-color: rgba(255, 255, 255, 0.15) !important;
    color: #ffffff !important;
}

.rpl-list-header .rpl-search-input::placeholder,
input.rpl-search-input::placeholder {
    color: rgba(255, 255, 255, 0.6) !important;
}

.rpl-list-header .rpl-search-input:focus,
input.rpl-search-input:focus {
    outline: none !important;
    border-color: var(--rpl-accent-color) !important;
    background: rgba(255, 255, 255, 0.15) !important;
    background-color: rgba(255, 255, 255, 0.15) !important;
    box-shadow: 0 0 0 3px rgba(166, 155, 115, 0.2) !important;
}

/* Stock Filter Section */
.rpl-stock-filter-section,
.rpl-view-products-section {
    padding: 16px;
    background-color: #35434c;
    border-radius: 0;
    margin-bottom: 16px;
}
.rpl-view-products-section{
    padding: 7px 25px;
}
.rpl-stock-filter-section h3{
    font-size: 16px;
}
.rpl-product-info {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
}

.rpl-product-thumbnail {
    flex-shrink: 0;
    width: 50px;
    height: 50px;
    border-radius: 6px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.1);
}

.rpl-product-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.rpl-stock-filter-label {
    display: block;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.75);
    letter-spacing: 0.3px;
}

.rpl-pharmacy-count {
    color: rgba(255, 255, 255, 0.95);
    font-weight: 600;
    font-size: 13px;
}

.rpl-stock-filter-label strong {
    color: rgba(255, 255, 255, 0.95);
    font-weight: 600;
}

/* Stock Filters */
.rpl-stock-filters {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.rpl-stock-filter {
    flex: 1;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 500;
    color: #ffffff;
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: var(--font-body);
}

.rpl-stock-filter:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.4);
}

.rpl-stock-filter.active {
    background: rgba(255, 255, 255, 0.95);
    color: #28333A;
    border-color: rgba(255, 255, 255, 0.95);
}

.rpl-stock-filter.active:hover {
    background: rgba(255, 255, 255, 1);
    border-color: rgba(255, 255, 255, 1);
}

/* Reset Link */
.rpl-reset-link {
    display: inline-block;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.75);
    text-decoration: none;
    transition: color 0.2s ease;
    vertical-align: middle;
}

.rpl-reset-link:hover {
    color: rgba(255, 255, 255, 1);
    text-decoration: underline;
}

/* No Results Message */
.rpl-no-results {
    padding: 40px 20px;
    text-align: center;
    color: var(--rpl-text-secondary);
}

.rpl-no-results p {
    margin: 0;
    font-size: 15px;
}

.rpl-pharmacy-list {
    flex: 1;
    overflow-y: auto;
    padding: 0;
    max-height: calc(70vh - 120px); /* Map height minus header height */
}

/* Pharmacy Item */
.rpl-pharmacy-item {
    padding: 20px;
    border-bottom: 1px solid var(--rpl-border-color);
    cursor: pointer;
    transition: background var(--rpl-transition-fast);
}

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

.rpl-pharmacy-item:hover {
    background: #f9fafb;
}

.rpl-pharmacy-item.highlighted {
    background: #f0f9ff;
    border-left: 4px solid var(--rpl-blue);
}

.rpl-pharmacy-item.out-of-stock {
    opacity: 0.7;
}

.rpl-pharmacy-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 10px;
}

.rpl-pharmacy-name {
    font-size: 1rem;
    font-weight: 700;
    color: var(--rpl-text-primary);
    margin: 0;
}

.rpl-distance {
    font-size: 0.8125rem;
    color: var(--rpl-text-muted);
    background: #f3f4f6;
    padding: 4px 10px;
    border-radius: 12px;
    font-weight: 600;
}

.rpl-pharmacy-stock {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 10px;
}

.rpl-pharmacy-stock.in-stock {
    background: #d1fae5;
    color: #065f46;
}

.rpl-pharmacy-stock.out-of-stock {
    background: #fee2e2;
    color: #991b1b;
}

.rpl-pharmacy-address {
    font-size: 0.875rem;
    color: var(--rpl-text-secondary);
    line-height: 1.6;
    margin: 0 0 8px;
}

.rpl-pharmacy-phone {
    font-size: 0.875rem;
    margin: 0 0 8px;
}

.rpl-pharmacy-phone a {
    color: var(--rpl-blue);
    text-decoration: none;
    font-weight: 500;
    transition: color var(--rpl-transition-fast);
}

.rpl-pharmacy-phone a:hover {
    color: var(--rpl-blue-dark);
    text-decoration: underline;
}

.rpl-pharmacy-website {
    font-size: 0.875rem;
    margin: 0 0 15px;
}

.rpl-pharmacy-website a {
    color: var(--rpl-blue);
    text-decoration: none;
    font-weight: 600;
    transition: color var(--rpl-transition-fast);
}

.rpl-pharmacy-website a:hover {
    color: var(--rpl-blue-dark);
    text-decoration: underline;
}

.rpl-pharmacy-actions {
    display: flex;
    gap: 10px;
    margin-top: 12px;
}

.rpl-view-on-map,
.rpl-get-directions {
    flex: 1;
    padding: 8px 16px;
    border: 1px solid var(--rpl-border-color);
    border-radius: var(--rpl-border-radius-md);
    font-size: 0.875rem;
    font-weight: 500;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    transition: all var(--rpl-transition-fast);
    background: #fff;
    color: var(--rpl-text-primary);
}

.rpl-view-on-map:hover,
.rpl-get-directions:hover {
    background: #f9fafb;
    border-color: var(--rpl-accent-color);
    color: var(--rpl-accent-color);
    text-decoration: none;
}

.rpl-pharmacy-info-toggle {
    margin-top: 12px;
}

.rpl-toggle-info {
    background: none;
    border: none;
    color: var(--rpl-accent-color);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    padding: 0;
    text-decoration: underline;
}

.rpl-toggle-info:hover {
    color: var(--rpl-accent-dark);
}

.rpl-pharmacy-additional-info {
    margin-top: 12px;
    padding: 12px;
    background: #f9fafb;
    border-radius: var(--rpl-border-radius-sm);
    font-size: 0.875rem;
    line-height: 1.6;
    color: var(--rpl-text-secondary);
}

/* Empty/Error States */
.rpl-no-results,
.rpl-error {
    text-align: center;
    padding: 40px 20px;
    color: var(--rpl-text-secondary);
}

.rpl-error {
    color: var(--rpl-danger);
}

/* ============================================
   Responsive Design
   ============================================ */
@media (max-width: 1024px) {
    .rpl-container {
        grid-template-columns: 1fr !important;
        display: flex !important;
        flex-direction: column;
    }
    
    .rpl-map-wrapper,
    .rpl-list-wrapper {
        grid-column: auto !important;
        grid-row: auto !important;
        width: 100% !important;
        max-width: 100%;
    }
    
    .rpl-list-wrapper {
        order: 1;
        height: auto;
        min-height: 400px;
        max-height: 500px;
    }
    
    .rpl-map-wrapper {
        order: 2;
        height: 400px;
        min-height: 400px;
    }
}

@media (max-width: 768px) {
    .rpl-pharmacy-locator {
        padding: 20px 0px;
    }
    
    .rpl-controls {
        flex-direction: column;
        gap: 15px;
        align-items: stretch;
    }
    
    .rpl-find-me-btn {
        width: 100%;
        justify-content: center;
    }
    
    .rpl-legend {
        justify-content: center;
    }
    
    .rpl-map {
        min-height: 400px;
    }
    
    .rpl-list-wrapper {
        max-height: none !important;
        height: auto !important;
    }
    
    .rpl-pharmacy-list {
        min-height: 500px !important;
    }
    
    .rpl-pharmacy-actions {
        flex-direction: column;
    }
    
    .rpl-view-on-map,
    .rpl-get-directions {
        flex: auto;
    }
}

@media (max-width: 480px) {
    .rpl-pharmacy-name {
        font-size: 0.9375rem;
    }
    
    .rpl-legend {
        flex-direction: column;
        gap: 10px;
    }
}
