/**
 * Copyright since 2007 PrestaShop SA and Contributors
 * PrestaShop is an International Registered Trademark & Property of PrestaShop SA
 *
 * NOTICE OF LICENSE
 *
 * This source file is subject to the Academic Free License 3.0 (AFL-3.0)
 * that is bundled with this package in the file LICENSE.md.
 * It is also available through the world-wide-web at this URL:
 * https://opensource.org/licenses/AFL-3.0
 * If you did not receive a copy of the license and are unable to
 * obtain it through the world-wide-web, please send an email
 * to license@prestashop.com so we can send you a copy immediately.
 *
 * DISCLAIMER
 *
 * Do not edit or add to this file if you wish to upgrade PrestaShop to newer
 * versions in the future. If you wish to customize PrestaShop for your
 * needs please refer to https://devdocs.prestashop.com/ for more information.
 *
 * @author    Maciej Czajkowski
 * @copyright Maciej Czajkowski
 * @license   https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0)
 */

/* Map Container */
.stores-map-container {
    position: relative;
    width: 100%;
    margin-bottom: 2rem;
}

.stores-map {
    width: 100%;
    height: 500px;
    min-height: 400px;
    border-radius: 4px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Map Controls */
.map-controls {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.geolocate-btn {
    background-color: #fff;
    border: 1px solid #ddd;
    padding: 10px 15px;
    border-radius: 4px;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 14px;
    transition: all 0.3s ease;
}

.geolocate-btn:hover {
    background-color: #f8f9fa;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.geolocate-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.geolocate-btn .material-icons {
    font-size: 18px;
}

.map-filter {
    background-color: #fff;
    padding: 5px;
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.map-filter input {
    border: 1px solid #ddd;
    padding: 8px 12px;
    border-radius: 4px;
    width: 200px;
    font-size: 14px;
}

/* User Location Marker */
.user-location-marker {
    background: transparent !important;
    border: none !important;
}

.user-marker-pulse {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background-color: #4285F4;
    border: 3px solid #fff;
    box-shadow: 0 0 0 0 rgba(66, 133, 244, 0.7);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(66, 133, 244, 0.7);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(66, 133, 244, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(66, 133, 244, 0);
    }
}

/* Store Popup */
.store-popup {
    padding: 10px;
    min-width: 200px;
}

.store-popup h4 {
    margin: 0 0 10px 0;
    font-size: 16px;
    font-weight: bold;
}

.store-popup address {
    margin: 0 0 10px 0;
    font-style: normal;
    line-height: 1.5;
}

.store-popup p {
    margin: 5px 0;
    font-size: 14px;
}

.store-popup .material-icons {
    font-size: 16px;
    vertical-align: middle;
    margin-right: 5px;
}

/* Stores List Container */
.stores-list-container {
    width: 100%;
}

.stores-list-title {
    font-size: 24px;
    font-weight: bold;
    margin-bottom: 20px;
    text-align: center;
}

.stores-filter {
    margin-bottom: 20px;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.stores-filter input,
.stores-filter select {
    flex: 1;
    min-width: 200px;
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.stores-loading,
.stores-error {
    text-align: center;
    padding: 40px;
    font-size: 16px;
    color: #666;
}

.stores-error {
    color: #d32f2f;
}

.store-distance {
    margin-bottom: 10px;
    color: #007bff;
    font-size: 14px;
}

/* Stores Grid */
.stores-grid {
    display: grid;
    gap: 20px;
    margin-top: 20px;
}

.stores-grid[data-columns="1"] {
    grid-template-columns: 1fr;
}

.stores-grid[data-columns="2"] {
    grid-template-columns: repeat(2, 1fr);
}

.stores-grid[data-columns="3"] {
    grid-template-columns: repeat(3, 1fr);
}

.stores-grid[data-columns="4"] {
    grid-template-columns: repeat(4, 1fr);
}

@media (max-width: 992px) {
    .stores-grid[data-columns="3"],
    .stores-grid[data-columns="4"] {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .stores-grid[data-columns="2"],
    .stores-grid[data-columns="3"],
    .stores-grid[data-columns="4"] {
        grid-template-columns: 1fr;
    }

    .stores-map {
        height: 400px;
    }

    .map-controls {
        position: relative;
        top: auto;
        right: auto;
        margin-bottom: 10px;
    }

    .map-filter input {
        width: 100%;
    }
}

/* Store Item */
.store-item {
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 15px;
    transition: all 0.3s ease;
    background-color: #fff;
}

.store-item:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.store-item.highlighted {
    border-color: #007bff;
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.3);
    background-color: #f8f9ff;
}

.store-item-container {
    display: flex;
    flex-direction: column;
}

.store-picture {
    margin-bottom: 15px;
    border-radius: 4px;
    overflow: hidden;
}

.store-picture img {
    width: 100%;
    height: auto;
    display: block;
}

.store-description {
    flex: 1;
}

.store-description .card-title {
    font-size: 18px;
    font-weight: bold;
    margin-bottom: 10px;
    color: #333;
}

.store-description address {
    margin-bottom: 15px;
    font-style: normal;
    line-height: 1.6;
    color: #666;
}

.store-contact {
    margin-bottom: 15px;
}

.store-contact p {
    margin: 5px 0;
    font-size: 14px;
    color: #666;
}

.store-contact .material-icons {
    font-size: 18px;
    vertical-align: middle;
    margin-right: 5px;
    color: #007bff;
}

.store-hours {
    margin-bottom: 15px;
}

.store-hours strong {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    color: #333;
}

.store-hours table {
    width: 100%;
    font-size: 13px;
}

.store-hours th {
    text-align: left;
    padding: 4px 8px 4px 0;
    font-weight: normal;
    color: #666;
    width: 60px;
}

.store-hours td {
    padding: 4px 0;
    color: #333;
}

.store-hours td span {
    display: inline-block;
    margin-right: 8px;
}

.store-hours .closed {
    color: #999;
    font-style: italic;
}

.store-note {
    margin-bottom: 15px;
    padding: 10px;
    background-color: #f8f9fa;
    border-radius: 4px;
    font-size: 13px;
    color: #666;
}

.show-on-map-btn {
    margin-top: 10px;
    width: 100%;
}

/* Leaflet Popup Customization */
.leaflet-popup-content-wrapper {
    border-radius: 4px;
}

.leaflet-popup-content {
    margin: 10px;
}

/* Hide default PrestaShop stores list when module is active */
.page-stores .page-content.page-stores:not(.page-stores-map) {
    display: none !important;
}

/* Hide default stores list that might be rendered by PrestaShop core */
.page-stores #content.page-content:not(.page-stores-map):not(.ps-stores-map-wrapper) {
    display: none !important;
}

/* Ensure our module content is visible */
.ps-stores-map-wrapper {
    display: block;
}

/* Hide default stores list section if it exists */
.page-stores section#content.page-content.page-stores:not(.ps-stores-map-wrapper) {
    display: none !important;
}

/* Responsive adjustments */
@media (max-width: 576px) {
    .stores-map {
        height: 300px;
    }

    .map-controls {
        flex-direction: row;
        flex-wrap: wrap;
    }

    .geolocate-btn {
        font-size: 12px;
        padding: 8px 12px;
    }

    .map-filter {
        flex: 1;
        min-width: 150px;
    }
}

