/**
 * Frontend styles for Multistore Map
 * Compatible with Elementor and responsive design
 * Based on noleggio-auto plugin styling
 */

/* Import Montserrat Font */
@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@300;400;500;600;700;800;900&display=swap');

/* Variabili colori arancio standard */
:root {
    --primary-orange: #f3993d;
    --secondary-orange: #e8892a;
    --orange-gradient: linear-gradient(135deg, #f3993d 0%, #e8892a 100%);
}

/* Global Font Family - Montserrat per tutti gli elementi del plugin */
.multistore-map-container,
.multistore-map-container *,
.multistore-filters,
.multistore-filters *,
.locations-sidebar,
.locations-sidebar *,
.location-card,
.location-card *,
.map-info-window,
.map-info-window * {
    font-family: 'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif !important;
    box-sizing: border-box;
}

/* Container principale */
.multistore-map-container {
    max-width: 100%;
    margin: 0 auto;
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

/* Filtri */
.multistore-filters {
    background: linear-gradient(135deg, #f3993d 0%, #e8892a 100%);
    padding: 20px;
    color: white;
}

.filter-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 15px;
    flex-wrap: wrap;
    gap: 15px;
}

.filter-title {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: white;
}

.filter-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.filter-btn {
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 8px 16px;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
    font-size: 14px;
    backdrop-filter: blur(10px);
}

.filter-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateY(-2px);
}

.filter-btn.active {
    background: white;
    color: #f3993d;
    border-color: white;
    box-shadow: 0 4px 15px rgba(255, 255, 255, 0.3);
}

.search-container {
    position: relative;
    max-width: 400px;
    width: 100%;
}

.location-search {
    width: 100%;
    padding: 12px 50px 12px 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 25px;
    background: rgba(255, 255, 255, 0.9);
    color: #333;
    font-size: 14px;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
}

.location-search:focus {
    outline: none;
    border-color: white;
    background: white;
    box-shadow: 0 4px 15px rgba(255, 255, 255, 0.3);
}

.location-search::placeholder {
    color: #666;
}

.search-btn {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: #f3993d;
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
}

.search-btn:hover {
    background: #5a67d8;
    transform: translateY(-50%) scale(1.1);
}

/* Content area */
.multistore-content {
    display: flex;
    min-height: 500px;
}

/* Mappa */
.map-container {
    flex: 1;
    position: relative;
    background: #f8f9fa;
}

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

.map-loading {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 10;
    transition: opacity 0.3s ease;
}

.map-loading.hidden {
    opacity: 0;
    pointer-events: none;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #e3e3e3;
    border-top: 4px solid #f3993d;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 10px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

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

/* Sidebar locations */
.locations-sidebar {
    width: 350px;
    background: #f8f9fa;
    border-left: 1px solid #e9ecef;
    display: flex;
    flex-direction: column;
    max-height: 500px;
}

.sidebar-header {
    padding: 20px;
    background: white;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sidebar-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #333;
}

.locations-count {
    background: #f3993d;
    color: white;
    padding: 4px 12px;
    border-radius: 15px;
    font-size: 12px;
    font-weight: 500;
}

.locations-list {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
}

/* Location cards */
.location-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 15px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    cursor: pointer;
    border: 2px solid transparent;
}

.location-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    border-color: #f3993d;
}

.location-card.active {
    border-color: #f3993d;
    background: #f8f9ff;
}

.location-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 15px;
}

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

.location-type {
    padding: 4px 12px;
    border-radius: 15px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-left: 10px;
    flex-shrink: 0;
}

.location-type-store {
    background: #e3f2fd;
    color: #1976d2;
}

.location-type-agente {
    background: #f3e5f5;
    color: #7b1fa2;
}

.location-details {
    margin-bottom: 15px;
}

.location-details > div {
    display: flex;
    align-items: flex-start;
    margin-bottom: 8px;
    font-size: 13px;
    color: #666;
}

.location-details svg {
    margin-right: 8px;
    margin-top: 2px;
    flex-shrink: 0;
    color: #f3993d;
}

.location-details a {
    color: #f3993d;
    text-decoration: none;
    transition: color 0.3s ease;
}

.location-details a:hover {
    color: #5a67d8;
    text-decoration: underline;
}

.location-description p {
    margin: 0;
    line-height: 1.4;
    color: #555;
}

.location-hours h5 {
    margin: 0 0 5px 0;
    font-size: 12px;
    font-weight: 600;
    color: #333;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.hours-content {
    font-size: 12px;
    line-height: 1.4;
    color: #666;
    white-space: pre-line;
}

.location-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.btn-directions,
.btn-focus-map {
    background: #f3993d;
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
}

.btn-directions:hover,
.btn-focus-map:hover {
    background: #5a67d8;
    transform: translateY(-1px);
}

.btn-focus-map {
    background: #28a745;
}

.btn-focus-map:hover {
    background: #218838;
}

/* Info window mappa */
.map-info-window {
    max-width: 280px;
    padding: 0;
    font-family: 'Montserrat', sans-serif;
}

.info-header {
    background: linear-gradient(135deg, #f3993d 0%, #e8892a 100%);
    color: white;
    padding: 15px;
    margin: -8px -8px 0 -8px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.info-header h4 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    flex: 1;
}

.info-type {
    padding: 3px 8px;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    margin-left: 10px;
    background: rgba(255, 255, 255, 0.2);
}

.info-content {
    padding: 15px;
}

.info-address {
    margin: 0 0 10px 0;
    font-size: 13px;
    color: #666;
    line-height: 1.4;
}

.info-phone,
.info-email {
    margin: 5px 0;
    font-size: 12px;
    color: #555;
}

.info-phone a,
.info-email a {
    color: #f3993d;
    text-decoration: none;
}

.info-phone a:hover,
.info-email a:hover {
    text-decoration: underline;
}

.info-actions {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #eee;
}

.btn-directions-small {
    background: #f3993d;
    color: white;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
    text-decoration: none;
    display: inline-block;
    transition: background 0.3s ease;
}

.btn-directions-small:hover {
    background: #5a67d8;
}

/* Mobile sidebar toggle */
.mobile-sidebar-toggle {
    display: none;
    background: #f3993d;
    color: white;
    border: none;
    padding: 12px 20px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: background 0.3s ease;
}

.mobile-sidebar-toggle:hover {
    background: #5a67d8;
}

.mobile-sidebar-toggle svg {
    transition: transform 0.3s ease;
}

.locations-sidebar.open .mobile-sidebar-toggle svg {
    transform: rotate(180deg);
}

/* Responsive Design */
@media (max-width: 1024px) {
    .locations-sidebar {
        width: 300px;
    }
    
    .location-card {
        padding: 15px;
    }
    
    .filter-container {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .search-container {
        max-width: 100%;
    }
}

@media (max-width: 768px) {
    .multistore-content {
        flex-direction: column;
    }
    
    .locations-sidebar {
        width: 100%;
        order: 2;
        max-height: none;
        border-left: none;
        border-top: 1px solid #e9ecef;
    }
    
    .mobile-sidebar-toggle {
        display: flex;
    }
    
    .locations-list {
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease;
        padding: 0 10px;
    }
    
    .locations-sidebar.open .locations-list {
        max-height: 400px;
        padding: 10px;
    }
    
    .map-container {
        order: 1;
        min-height: 300px;
    }
    
    .filter-container {
        flex-direction: column;
        align-items: stretch;
    }
    
    .filter-buttons {
        justify-content: center;
    }
    
    .multistore-filters {
        padding: 15px;
    }
    
    .location-card {
        margin-bottom: 10px;
    }
    
    .location-actions {
        justify-content: space-between;
    }
    
    .btn-directions,
    .btn-focus-map {
        flex: 1;
        justify-content: center;
        min-width: 0;
    }
}

@media (max-width: 480px) {
    .multistore-map-container {
        border-radius: 8px;
    }
    
    .location-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .location-type {
        margin-left: 0;
    }
    
    .filter-btn {
        flex: 1;
        text-align: center;
        min-width: 0;
    }
    
    .sidebar-header {
        padding: 15px;
    }
    
    .location-card {
        padding: 12px;
    }
    
    .info-header {
        flex-direction: column;
        gap: 8px;
        align-items: flex-start;
    }
    
    .info-type {
        margin-left: 0;
    }
}

/* Stili per varianti dello shortcode */
.multistore-map-container[data-stile="compact"] {
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
}

.multistore-map-container[data-stile="compact"] .multistore-filters {
    padding: 15px;
}

.multistore-map-container[data-stile="compact"] .location-card {
    padding: 15px;
    margin-bottom: 10px;
}

.multistore-map-container[data-stile="minimal"] {
    box-shadow: none;
    border: 1px solid #e9ecef;
}

.multistore-map-container[data-stile="minimal"] .multistore-filters {
    background: #f8f9fa;
    color: #333;
    border-bottom: 1px solid #e9ecef;
}

.multistore-map-container[data-stile="minimal"] .filter-btn {
    background: white;
    color: #333;
    border-color: #dee2e6;
}

.multistore-map-container[data-stile="minimal"] .filter-btn.active {
    background: #f3993d;
    color: white;
    border-color: #f3993d;
}

/* Accessibilità */
.filter-btn:focus,
.search-btn:focus,
.btn-directions:focus,
.btn-focus-map:focus,
.mobile-sidebar-toggle:focus {
    outline: 2px solid #f3993d;
    outline-offset: 2px;
}

.location-search:focus {
    outline: 2px solid #f3993d;
    outline-offset: -2px;
}

/* Animazioni */
.location-card {
    animation: fadeInUp 0.3s ease forwards;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Print styles */
@media print {
    .multistore-filters,
    .location-actions,
    .mobile-sidebar-toggle {
        display: none !important;
    }
    
    .multistore-content {
        flex-direction: column;
    }
    
    .locations-sidebar {
        width: 100%;
        border: none;
    }
    
    .location-card {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ddd;
    }
}
