/* Public styles for Store Map plugin */

.store-map-container {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    overflow: hidden;
    background: #fff;
    margin-bottom: 20px;
}

/* Map header sections */
.store-map-header {
    margin-bottom: 20px;
}

/* Title and search row */
.store-map-title-row {
    display: flex;
    gap: 20px;
    align-items: center;
    margin-bottom: 15px;
}

.store-map-title {
    flex: 1;
    margin: 0;
    padding: 0;
}

.store-map-title h3 {
    margin: 0;
    font-size: 24px;
    color: #333;
    font-weight: 600;
}

/* Search Section */
.store-map-search {
    display: flex;
    gap: 5px;
    flex: 1;
    min-width: 200px;
    margin: 0;
}

.store-map-search-input {
    flex: 1 1 auto;
    min-width: 0;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px 0 0 4px;
    border-right: none;
    font-size: 14px;
}

.store-map-search-btn,
.store-map-location-btn {
    flex: 0 0 auto;
    padding: 8px 12px;
    background: #082EB7;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s;
    white-space: nowrap;
}

.store-map-search-btn:hover {
    background: #2E76E7;
}

.store-map-location-btn {
    background: #FFC001;
    position: relative;
}

.store-map-location-btn:hover {
    background: #FFD101;
}

.store-map-location-btn.loading {
    background: #FFD101;
    cursor: not-allowed;
}

.store-map-location-btn.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 16px;
    height: 16px;
    margin: -8px 0 0 -8px;
    border: 2px solid transparent;
    border-top: 2px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.store-map-location-btn.active {
    background: #FFC001;
    box-shadow: 0 0 10px rgba(214, 54, 56, 0.3);
}

.store-map-location-btn.active:hover {
    background: #FFD101;
}

/* Filters Section */
.store-map-filters {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    padding: 0;
    margin: 0;
}

.store-map-filter-item {
    flex: 1;
    min-width: 200px;
}

.store-map-filter {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    min-width: 150px;
}

.store-map-filter-row {
    display: flex;
    gap: 15px;
    align-items: end;
    flex-wrap: wrap;
}

.store-map-filter-group {
    display: flex;
    flex-direction: column;
    min-width: 150px;
    flex: 1;
}

.store-map-filter-group label {
    margin-bottom: 5px;
    font-weight: 600;
    color: #333;
    font-size: 14px;
}

.store-map-filter-group input,
.store-map-filter-group select {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    background: #fff;
    transition: border-color 0.3s;
}

.store-map-filter-group input:focus,
.store-map-filter-group select:focus {
    outline: none;
    border-color: #2271b1;
    box-shadow: 0 0 0 2px rgba(34, 113, 177, 0.1);
}

.store-map-btn-secondary {
    padding: 8px 16px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    color: #333;
    transition: all 0.3s;
}

.store-map-btn-secondary:hover {
    background: #f0f0f0;
    border-color: #bbb;
}

.store-map-reset-btn {
    padding: 8px 12px;
    background: #082EB7;
    border: 1px solid #082EB7;
    border-radius: 4px;
    color: white;
    cursor: pointer;
    width: 100%;
}

.store-map-reset-btn:hover {
    background: #2E76E7;
    border-color: #2E76E7;
}

.store-map-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #666;
}

/* Content Section */
.no-stores {
    padding: 20px;
    text-align: center;
    color: #666;
}

.store-map-content {
    display: flex;
    height: 500px;
    min-height: 400px;
}

/* Map Container */
.store-map-map-container {
    position: relative;
}

.store-google-map {
    width: 100%;
    height: 100%;
}

/* Store List */
.store-map-list-container {
    width: 40%;
    border-left: 1px solid #e1e1e1;
    display: flex;
    flex-direction: column;
    background: #fff;
}

.store-map-list-header {
    padding: 20px;
    border-bottom: 1px solid #ddd;
    background: #f8f9fa;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.store-map-list-header h3 {
    margin: 0;
    font-size: 18px;
    color: #333;
}

.store-map-results-count {
    background: #2271b1;
    color: white;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.store-map-list {
    flex: 1;
    overflow-y: auto;
}

/* Store Item */
.store-item {
    background: #fff;
    padding: 15px;
    cursor: pointer;
    transition: all 0.3s;
    border-bottom: 1px solid #eee;
}

.store-item:hover {
    border-color: #aaa;
    background: #f8f9fa;
}

.store-item.active {
    border-color: #aaa;
}

.store-item-content {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 15px;
}

.store-item-info {
    flex: 1;
    min-width: 0;
}

.store-item-title-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    gap: 10px;
}

.store-item-title {
    font-weight: 600;
    font-size: 16px;
    color: #333;
    margin: 0;
    flex: 1;
    line-height: 1.3;
}

.store-item-details {
    margin-top: 8px;
}

.store-item-details p {
    margin: 4px 0;
    font-size: 14px;
    line-height: 1.4;
}

.store-item-address {
    color: #666;
    margin-bottom: 6px;
}

.store-item-hours {
    color: #666;
    margin-bottom: 8px;
}

.store-item-type {
    margin-top: 8px;
}

.store-item-image {
    flex-shrink: 0;
    width: 80px;
    height: 80px;
    align-self: flex-start;
}

.store-item-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid #ddd;
}

.store-item p {
    margin: 0 0 8px;
    color: #666;
}

.store-item-distance {
    background: #e8f4fd;
    color: #0073aa;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    margin-left: 10px;
}

.store-item-distance.nearby {
    background: #d4edda;
    color: #155724;
}

.store-item-distance.far {
    background: #fff3cd;
    color: #856404;
}

.store-item p {
    margin: 0;
    color: #666;
    font-size: 14px;
}

.store-type-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
    color: white;
    margin-top: 5px;
}

.store-item-actions {
    display: flex;
    gap: 5px;
}

.store-map-btn-link {
    background: none;
    border: none;
    color: #2271b1;
    text-decoration: underline;
    cursor: pointer;
    font-size: 12px;
    padding: 0;
}

.store-map-btn-link:hover {
    color: #135e96;
}

/* Loading State */
.store-map-loading {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 200px;
    color: #666;
}

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


/* Custom Map Controls */

.store-map-controls {
    margin-bottom: 15px;
    padding: 15px;
    border-radius: 4px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

/* Info Window Styles */
.store-info-window {
    max-width: 280px;
    padding: 10px;
}

.store-info-title {
    font-weight: 600;
    font-size: 16px;
    margin-bottom: 8px;
    color: #333;
}

.store-info-address {
    color: #666;
    font-size: 14px;
    margin-bottom: 8px;
    line-height: 1.4;
}

.store-info-hours {
    color: #666;
    font-size: 12px;
    margin-bottom: 10px;
    white-space: pre-line;
}

.store-info-actions {
    text-align: center;
}

.store-info-btn {
    background: #2271b1;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    text-decoration: none;
    display: inline-block;
    font-size: 12px;
    margin: 0 5px;
    cursor: pointer;
}

.store-info-btn:hover {
    background: #135e96;
    color: white;
    text-decoration: none;
}

/* Dynamic Layout Classes */
.store-map-container.dynamic-height {
    /* Height will be set via data attribute or inline for specific instances */
}

.store-map-wrapper {
    flex: 1;
}

.elementor .store-map-wrapper img {
    max-width: none;
}

.store-map-wrapper.full-width {
    flex: 1 0 100%;
}

.store-map.dynamic-height {
    width: 100%;
    /* Height will be set via data attribute or inline for specific instances */
}

.store-map-sidebar {
    flex: 0 0 320px;
    overflow-y: auto;
    background: white;
    /* Max-height will be set dynamically to match map height */
}

.store-map-map-container.with-list {
    width: 60%;
}

.store-map-map-container.full-width {
    width: 100%;
}

.store-map-error {
    padding: 15px;
    background: #fff2cd;
    border: 1px solid #f0ad4e;
    border-radius: 4px;
    color: #8a6d3b;
}

/* Responsive Design */
@media (max-width: 767px) {
    .store-map-container {
        padding: 0.5rem;
    }

    .store-map-title-row {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .store-map-filters {
        justify-content: stretch;
    }

    .store-map-sidebar {
        flex: none !important;
        max-height: 300px !important;
    }

    .store-map-controls {
        flex-direction: column;
        align-items: stretch;
    }

    .store-map-filter {
        min-width: auto;
        flex: 1;
    }

    .store-map-filter-row {
        flex-direction: column;
        gap: 10px;
    }

    .store-map-filter-group {
        min-width: unset;
    }

    .store-map-content {
        flex-direction: column;
        height: auto;
    }

    .store-map-map-container {
        width: 100% !important;
        height: 350px;
        order: 1;
    }

    .store-map-list-container {
        width: 100% !important;
        border-left: none;
        border-top: 1px solid #e1e1e1;
        max-height: 350px;
        order: 2;
    }

    /* Mobile-specific map adjustments */
    .store-google-map {
        min-height: 300px;
    }

    /* Improve touch targets */
    .store-map-filter-group input,
    .store-map-filter-group select,
    .store-map-btn-secondary {
        min-height: 44px;
        font-size: 16px;
        /* Prevents iOS zoom */
    }

    /* Mobile list improvements */
    .store-map-list {
        padding: 5px;
    }

    .store-item {
        margin-bottom: 8px;
        padding: 15px;
        border-radius: 6px;
        border-bottom: 1px solid #eee;
        cursor: pointer;
    }

    .store-item-content {
        gap: 10px;
    }

    .store-item-image {
        width: 60px;
        height: 60px;
    }

    .store-item-title {
        font-size: 15px;
    }

    .store-item-title-row {
        margin-bottom: 8px;
        flex-wrap: wrap;
        gap: 5px;
    }

    display: inline-flex;
    align-items: center;
    justify-content: center;
}
}

@media (max-width: 480px) {
    .store-map-container {
        border-radius: 0;
        border-left: none;
        border-right: none;
    }

    .store-map-filters {
        padding: 15px;
    }

    .store-map-filter-group {
        margin-bottom: 10px;
    }

    .store-item {
        padding: 12px;
    }

    .store-item-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }

    .store-item-type {
        margin-left: 0;
    }

    .store-item-meta {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .store-item-actions {
        display: flex;
        gap: 10px;
        width: 100%;
    }

    .store-map-btn-link {
        flex: 1;
        text-align: center;
        background: #f0f0f0;
        border: 1px solid #ddd;
        border-radius: 4px;
        text-decoration: none;
        color: #333;
        font-weight: 500;
    }

    .store-map-btn-link:hover {
        background: #e0e0e0;
        color: #333;
    }

    /* Map controls for small screens */
    .store-map-map-container {
        height: 300px;
    }
}

/* Touch device optimizations */
.touch-device .store-item {
    cursor: default;
}

.touch-device .store-map-btn-link {
    cursor: default;
}

/* Mobile scroll optimizations */
.mobile-scroll {
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
}

/* Landscape orientation adjustments */
@media screen and (max-height: 500px) and (orientation: landscape) {
    .store-map-content {
        flex-direction: row;
        height: 300px;
    }

    .store-map-map-container {
        width: 60% !important;
        height: 100%;
        order: 1;
    }

    .store-map-list-container {
        width: 40% !important;
        border-left: 1px solid #e1e1e1;
        border-top: none;
        max-height: none;
        order: 2;
    }
}

/* Store Type Icons Customization */
.store-type-badge img {
    display: inline-block;
    vertical-align: middle;
    margin-right: 6px;
    border-radius: 2px;
}

.store-info-window img {
    display: inline-block;
    vertical-align: middle;
    margin-right: 4px;
    border-radius: 2px;
}

/* Asegurar que los SVG inline también se alineen correctamente */
.store-type-badge svg,
.store-info-window svg {
    display: inline-block;
    vertical-align: middle;
    margin-right: 6px;
}

/* Espaciado adicional para badges con íconos */
.store-type-badge:has(img),
.store-type-badge:has(svg) {
    padding-left: 8px;
}

/* Store Types Legend */
.store-map-legend {
    margin-top: 15px;
}

.store-map-legend-items {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 20px;
    max-width: 100%;
}

.store-map-legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1em;
    color: #333;
    white-space: nowrap;
}

.store-map-legend-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
}

.store-map-legend-icon img {
    width: 32px;
    height: 32px;
    object-fit: cover;
    border-radius: 3px;
}

.store-map-legend-icon svg {
    width: 20px;
    height: 20px;
}

/* Círculos coloreados para tipos sin imagen personalizada */
.store-map-legend-icon div {
    margin: 0 auto;
}

.store-map-legend-text {
    font-weight: 500;
}

/* Responsive legend */
@media (max-width: 768px) {
    .store-map-legend-items {
        gap: 15px;
    }

    .store-map-legend-item {
        font-size: .85em;
        gap: 6px;
    }

    .store-map-legend-icon {
        width: 24px;
        height: 24px;
    }

    .store-map-legend-icon img,
    .store-map-legend-icon svg {
        width: 20px;
        height: 20px;
    }
}

/* Store Map Marker Popup Styles */
.store-map-marker {
    margin: -16px -16px -12px -16px;
    max-width: 300px;
    min-width: 200px;
    position: relative;
    border-radius: 10px;
    box-shadow: rgba(0, 0, 0, 0.3) 0px 1px 4px -1px;
    overflow: hidden;
    z-index: 100000;
}

.store-map-marker-close {
    position: absolute;
    top: 12px;
    right: 12px;
    opacity: 0.4;
    background: #fff;
    border-radius: 50%;
    height: 24px;
    width: 24px;
    text-align: center;
    cursor: pointer;
    z-index: 100000;
    transition: opacity 0.3s;
    box-shadow: 0 0 6px 0 rgba(0, 0, 0, 0.3);
}

.store-map-marker-close svg {
    fill: #000;
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
}

.store-map-marker-close:hover {
    opacity: 1;
}

.store-map-marker-header {
    position: relative;
}

.store-map-marker-image {
    position: relative;
    height: 150px;
    overflow: hidden;
    margin-bottom: 0;
    background: #fff;
}

.store-map-marker-image img {
    width: 100%;
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    transform: translateY(-50%);
}

.store-map-marker-title {
    color: #fff;
    font-size: 15px;
    line-height: 1.3;
    position: relative;
    padding-right: 28px;
}

.store-map-marker-title-wrapper {
    background: rgb(8, 46, 183);
    padding: 16px;
    display: flex;
    justify-content: space-between;
}

.store-map-marker-title-wrapper-padding {
    padding: 24px 16px;
}

.store-map-marker-directions {
    position: relative;
    max-width: 80px;
    min-width: 40px;
    text-align: center;
}

.store-map-marker-directions-button {
    text-decoration: none !important;
}

.store-map-marker-directions-label {
    padding-bottom: 8px;
    color: #fff;
    font-size: 13px;
}

.store-map-marker-directions-icon {
    width: 48px;
    height: 48px;
    border-radius: 100%;
    background-color: #fff;
    position: absolute;
    bottom: -48px;
    right: 50%;
    transform: translate(50%, 0);
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 1px 6px 0 rgba(0, 0, 0, 0.3);
}

.store-map-marker-directions-icon svg {
    fill: rgb(8, 46, 183);
}

.store-map-marker-content {
    padding: 16px;
    padding-top: 28px;
    background: #fff;
    color: #222;
    font-size: 13px;
}

.store-map-marker-info-item {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
}

.store-map-marker-info-item-icon-wrapper {
    display: flex;
    align-items: center;
    flex: 0 0 12px;
    margin-right: 12px;
}

.store-map-marker-info-item-icon {
    fill: rgb(8, 46, 183);
}

.store-map-marker-info-item-text a {
    color: #000;
    text-decoration: none !important;
}

.store-map-marker-info-item-text a:hover,
.store-map-marker-info-item-text a:active {
    color: #000 !important;
}

.store-map-marker-description {
    color: #222;
    font-size: 13px;
    border-top: 1px solid #e6e6e6;
    margin-top: 12px;
    padding-top: 12px;
}

.store-map-marker-description hr {
    background: #e6e6e6;
    border: none;
    height: 1px;
    margin: 8px 0;
}

/* Fix Google Maps InfoWindow overflow for our markers */
.store-map .gm-style-iw>div {
    overflow: visible !important;
}

.store-map .gm-style-iw-d,
.store-map .gm-style-iw-c {
    max-height: initial !important;
}

.store-map .gm-ui-hover-effect {
    display: none !important;
}

.store-map .gm-style .gm-style-iw {
    font-weight: 400;
}