/**
 * Public Styles
 */

/* General */
.pr-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Map */
.pr-map-container {
    width: 100%;
    height: 500px;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.pr-map {
    width: 100%;
    height: 100%;
}

/* Pickup Points List */
.pr-points-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.pr-point-card {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 20px;
    transition: all 0.3s ease;
    cursor: pointer;
}

.pr-point-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    transform: translateY(-2px);
}

.pr-point-card.available {
    border-left: 4px solid #4caf50;
}

.pr-point-card.unavailable {
    border-left: 4px solid #9e9e9e;
    opacity: 0.6;
}

.pr-point-card h3 {
    margin: 0 0 10px 0;
    font-size: 18px;
    color: #333;
}

.pr-point-address {
    color: #666;
    font-size: 14px;
    margin-bottom: 10px;
}

.pr-point-distance {
    display: inline-block;
    background: #f0f0f0;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    margin-bottom: 10px;
}

.pr-point-rating {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-bottom: 10px;
}

.pr-stars {
    color: #ffc107;
}

.pr-point-hours {
    font-size: 13px;
    color: #666;
    margin-top: 10px;
}

/* Checkout Selector */
.pr-checkout-selector {
    margin-top: 20px;
    padding: 20px;
    background: #f9f9f9;
    border-radius: 8px;
}

.pr-checkout-map {
    height: 400px !important;
    min-height: 400px !important;
    width: 100% !important;
    margin-bottom: 20px;
    border-radius: 8px;
    overflow: hidden !important;
    background: #f0f0f0;
    position: relative !important;
    z-index: 1;
    display: block !important;
    visibility: visible !important;
}

/* Ensure Leaflet map renders correctly */
.pr-checkout-map .leaflet-container {
    height: 100% !important;
    width: 100% !important;
    position: relative !important;
}

/* Prevent WooCommerce from hiding the map */
.woocommerce-shipping-fields .pr-checkout-map,
.woocommerce-checkout .pr-checkout-map {
    opacity: 1 !important;
    visibility: visible !important;
    display: block !important;
}

/* Loading state */
.pr-checkout-map:not(:has(.leaflet-container))::before {
    content: 'Caricamento mappa...';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #666;
    font-size: 14px;
    z-index: 100;
}

.pr-points-list {
    max-height: 400px;
    overflow-y: auto;
}

.pr-point-item {
    padding: 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.pr-point-item:hover {
    border-color: #2271b1;
}

.pr-point-item.selected {
    border-color: #2271b1;
    background: #f0f6fc;
}

.pr-point-item.unavailable {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Slot Selector */
.pr-slot-selector {
    margin-top: 15px;
}

.pr-date-picker {
    margin-bottom: 15px;
}

.pr-slots-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 10px;
}

.pr-slot-button {
    padding: 10px;
    border: 2px solid #e0e0e0;
    border-radius: 4px;
    background: #fff;
    cursor: pointer;
    text-align: center;
    transition: all 0.2s ease;
}

.pr-slot-button:hover:not(.unavailable) {
    border-color: #2271b1;
    background: #f0f6fc;
}

.pr-slot-button.selected {
    border-color: #2271b1;
    background: #2271b1;
    color: #fff;
}

.pr-slot-button.unavailable {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Filters */
.pr-filters {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.pr-filter-group {
    flex: 1;
    min-width: 200px;
}

.pr-filter-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: #333;
}

.pr-filter-group input,
.pr-filter-group select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

/* Search */
.pr-search-box {
    position: relative;
    margin-bottom: 20px;
}

.pr-search-input {
    width: 100%;
    padding: 12px 45px 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 16px;
}

.pr-search-button {
    position: absolute;
    right: 5px;
    top: 50%;
    transform: translateY(-50%);
    padding: 8px 15px;
    background: #2271b1;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.pr-geolocation-button {
    margin-top: 10px;
    padding: 10px 15px;
    background: #fff;
    border: 2px solid #2271b1;
    color: #2271b1;
    border-radius: 4px;
    cursor: pointer;
}

/* Rating */
.pr-rating-form {
    margin-top: 20px;
    padding: 20px;
    background: #f9f9f9;
    border-radius: 8px;
}

.pr-rating-stars {
    display: flex;
    gap: 5px;
    font-size: 24px;
    margin-bottom: 15px;
}

.pr-rating-star {
    cursor: pointer;
    color: #ddd;
    transition: color 0.2s;
}

.pr-rating-star.active,
.pr-rating-star:hover {
    color: #ffc107;
}

/* Map marker animations */
.pr-marker-selected {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(34, 113, 177, 0.7);
    }
    70% {
        box-shadow: 0 0 0 15px rgba(34, 113, 177, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(34, 113, 177, 0);
    }
}

/* Custom marker for selected point */
.leaflet-marker-icon.marker-selected {
    z-index: 1000 !important;
}

/* Popup styling */
.pr-map-popup {
    text-align: center;
}

.pr-map-popup h4 {
    margin: 0 0 10px 0;
    color: #2271b1;
}

.pr-map-popup p {
    margin: 5px 0;
    font-size: 14px;
}

.pr-map-popup .pr-select-point-btn {
    margin-top: 10px;
    padding: 8px 16px;
    background: #2271b1;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
}

.pr-map-popup .pr-select-point-btn:hover {
    background: #1a5a8f;
}

/* Responsive */
@media (max-width: 768px) {
    .pr-points-grid {
        grid-template-columns: 1fr;
    }
    
    .pr-filters {
        flex-direction: column;
    }
    
    .pr-map-container {
        height: 300px;
    }
    
    .pr-checkout-map {
        height: 250px;
    }
}
