/**
 * STORE-MAPS.CSS - Map Components and Location Features
 * Interactive maps, location displays, and geographical functionality
 * 
 * @package StileSalentino
 * @version 2.1.0
 */

/* =============================================================
   MAP CONTAINER SYSTEM
   ============================================================= */

.store-map {
    position: relative;
    background: var(--map-bg, #f3f4f6);
    border-radius: var(--map-border-radius, 12px);
    overflow: hidden;
    border: var(--map-border-width, 1px) solid var(--map-border-color, #e5e7eb);
    box-shadow: var(--map-shadow, 0 4px 6px rgba(0, 0, 0, 0.1));
    margin-bottom: var(--space-lg, 24px);
}

.store-map__container {
    position: relative;
    width: 100%;
    height: 300px;
    background: var(--map-container-bg, #f8fafc);
    display: flex;
    align-items: center;
    justify-content: center;
}

.store-map--single .store-map__container {
    height: var(--single-map-height, 400px);
}

.store-map--full .store-map__container {
    height: var(--full-map-height, 500px);
}

.store-map--compact .store-map__container {
    height: var(--compact-map-height, 200px);
}

/* Map Loading State */
.store-map__loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-md, 16px);
    color: var(--text-muted, #9ca3af);
    font-size: var(--font-size-sm, 0.875rem);
}

.store-map__loading::before {
    content: '';
    width: 32px;
    height: 32px;
    border: 3px solid var(--color-border, #e5e7eb);
    border-top: 3px solid var(--color-primary, #2563eb);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* No Location State */
.store-map--no-location {
    background: var(--color-background, #f9fafb);
    border: 2px dashed var(--color-border, #e5e7eb);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
}

.store-map__message {
    color: var(--text-muted, #9ca3af);
    text-align: center;
    font-style: italic;
    margin: 0;
}

/* =============================================================
   MAP CONTROLS
   ============================================================= */

.store-map__controls {
    position: absolute;
    top: var(--space-md, 16px);
    right: var(--space-md, 16px);
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: var(--space-xs, 4px);
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(8px);
    border-radius: var(--radius-md, 8px);
    padding: var(--space-xs, 4px);
    box-shadow: var(--shadow-md, 0 4px 6px rgba(0, 0, 0, 0.1));
}

.store-map__control {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm, 4px);
    color: var(--text-secondary, #6b7280);
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 14px;
    font-weight: 600;
}

.store-map__control:hover {
    background: var(--color-primary, #2563eb);
    color: white;
}

.store-map__control:active {
    transform: scale(0.95);
}

/* =============================================================
   MAP INFO PANELS
   ============================================================= */

.store-map__info {
    padding: var(--space-lg, 20px);
    background: var(--map-info-bg, #ffffff);
    border-top: 1px solid var(--color-border, #e5e7eb);
}

.store-map__address {
    margin: 0 0 var(--space-md, 16px);
    font-size: var(--font-size-sm, 0.875rem);
    line-height: 1.5;
    color: var(--text-secondary, #6b7280);
}

.store-map__address strong {
    display: block;
    color: var(--text-primary, #111827);
    font-weight: 600;
    margin-bottom: var(--space-xs, 4px);
}

.store-map__actions {
    display: flex;
    gap: var(--space-sm, 12px);
    flex-wrap: wrap;
}

/* =============================================================
   MULTIPLE STORES MAP
   ============================================================= */

.stores-map {
    position: relative;
    height: var(--stores-map-height, 500px);
    background: var(--stores-map-bg, #f8fafc);
    border-radius: var(--map-border-radius, 12px);
    overflow: hidden;
    margin-bottom: var(--space-xl, 32px);
}

.stores-map__container {
    width: 100%;
    height: 100%;
    position: relative;
}

.stores-map__sidebar {
    position: absolute;
    top: 0;
    left: 0;
    width: var(--map-sidebar-width, 350px);
    height: 100%;
    background: white;
    border-right: 1px solid var(--color-border, #e5e7eb);
    z-index: 50;
    overflow-y: auto;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
}

.stores-map__sidebar--open {
    transform: translateX(0);
}

.stores-map__sidebar-toggle {
    position: absolute;
    top: var(--space-md, 16px);
    left: var(--space-md, 16px);
    z-index: 60;
    background: white;
    border: 1px solid var(--color-border, #e5e7eb);
    border-radius: var(--radius-md, 6px);
    padding: var(--space-sm, 8px);
    cursor: pointer;
    box-shadow: var(--shadow-sm, 0 1px 3px rgba(0, 0, 0, 0.1));
    transition: all 0.2s ease;
}

.stores-map__sidebar-toggle:hover {
    background: var(--color-background, #f9fafb);
    transform: translateY(-1px);
}

/* =============================================================
   MAP STORE LIST
   ============================================================= */

.map-store-list {
    padding: var(--space-md, 16px);
}

.map-store-list__header {
    padding: var(--space-md, 16px);
    border-bottom: 1px solid var(--color-border, #e5e7eb);
    margin-bottom: var(--space-md, 16px);
}

.map-store-list__title {
    font-size: var(--font-size-lg, 1.125rem);
    font-weight: 600;
    margin: 0 0 var(--space-xs, 4px);
    color: var(--text-primary, #111827);
}

.map-store-list__count {
    font-size: var(--font-size-sm, 0.875rem);
    color: var(--text-muted, #9ca3af);
}

.map-store-item {
    display: flex;
    align-items: center;
    gap: var(--space-sm, 12px);
    padding: var(--space-sm, 12px);
    border-radius: var(--radius-md, 8px);
    cursor: pointer;
    transition: all 0.2s ease;
    margin-bottom: var(--space-xs, 4px);
}

.map-store-item:hover {
    background: var(--color-background, #f9fafb);
}

.map-store-item--active {
    background: var(--color-primary, #2563eb);
    color: white;
}

.map-store-item__marker {
    width: 24px;
    height: 24px;
    background: var(--color-primary, #2563eb);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--font-size-xs, 0.75rem);
    font-weight: 600;
    flex-shrink: 0;
}

.map-store-item--active .map-store-item__marker {
    background: white;
    color: var(--color-primary, #2563eb);
}

.map-store-item__content {
    flex: 1;
    min-width: 0;
}

.map-store-item__name {
    font-weight: 600;
    font-size: var(--font-size-sm, 0.875rem);
    margin: 0 0 var(--space-xs, 2px);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.map-store-item__address {
    font-size: var(--font-size-xs, 0.75rem);
    opacity: 0.8;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.map-store-item__distance {
    font-size: var(--font-size-xs, 0.75rem);
    color: var(--text-muted, #9ca3af);
    flex-shrink: 0;
}

.map-store-item--active .map-store-item__distance {
    color: rgba(255, 255, 255, 0.8);
}

/* =============================================================
   MAP POPUP/TOOLTIP STYLES
   ============================================================= */

.map-popup {
    min-width: 250px;
    max-width: 300px;
    font-size: var(--font-size-sm, 0.875rem);
}

.map-popup__header {
    padding: var(--space-sm, 12px) var(--space-sm, 12px) 0;
    border-bottom: 1px solid var(--color-border, #e5e7eb);
    margin-bottom: var(--space-sm, 12px);
}

.map-popup__title {
    font-weight: 600;
    color: var(--text-primary, #111827);
    margin: 0 0 var(--space-xs, 4px);
    font-size: var(--font-size-base, 1rem);
}

.map-popup__category {
    font-size: var(--font-size-xs, 0.75rem);
    color: var(--text-muted, #9ca3af);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.map-popup__content {
    padding: 0 var(--space-sm, 12px) var(--space-sm, 12px);
}

.map-popup__address {
    display: flex;
    align-items: flex-start;
    gap: var(--space-xs, 6px);
    margin-bottom: var(--space-sm, 10px);
    color: var(--text-secondary, #6b7280);
}

.map-popup__address-icon {
    width: 14px;
    height: 14px;
    color: var(--color-primary, #2563eb);
    flex-shrink: 0;
    margin-top: 2px;
}

.map-popup__rating {
    display: flex;
    align-items: center;
    gap: var(--space-xs, 4px);
    margin-bottom: var(--space-sm, 10px);
}

.map-popup__rating-stars {
    color: var(--color-warning, #f59e0b);
}

.map-popup__rating-value {
    color: var(--text-secondary, #6b7280);
    font-weight: 500;
}

.map-popup__actions {
    display: flex;
    gap: var(--space-xs, 6px);
    margin-top: var(--space-sm, 12px);
}

.map-popup__action {
    flex: 1;
    padding: var(--space-xs, 6px) var(--space-sm, 10px);
    font-size: var(--font-size-xs, 0.75rem);
    border-radius: var(--radius-sm, 4px);
}

/* =============================================================
   LOCATION PICKER COMPONENT
   ============================================================= */

.location-picker {
    position: relative;
    margin-bottom: var(--space-lg, 24px);
}

.location-picker__input {
    width: 100%;
    padding: var(--space-sm, 12px) var(--space-lg, 48px) var(--space-sm, 12px) var(--space-sm, 12px);
    border: 1px solid var(--color-border, #d1d5db);
    border-radius: var(--radius-md, 8px);
    font-size: var(--font-size-sm, 0.875rem);
    background: white;
}

.location-picker__icon {
    position: absolute;
    right: var(--space-sm, 12px);
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    color: var(--color-primary, #2563eb);
    cursor: pointer;
}

.location-picker__current {
    position: absolute;
    right: var(--space-lg, 40px);
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--color-primary, #2563eb);
    cursor: pointer;
    font-size: var(--font-size-xs, 0.75rem);
    padding: var(--space-xs, 4px);
}

.location-picker__current:hover {
    text-decoration: underline;
}

/* =============================================================
   STORE HOURS WITH MAP INTEGRATION
   ============================================================= */

.store-hours {
    background: white;
    border-radius: var(--radius-md, 8px);
    padding: var(--space-lg, 20px);
    border: 1px solid var(--color-border, #e5e7eb);
    margin-bottom: var(--space-lg, 24px);
}

.store-hours__today {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-sm, 12px);
    background: var(--color-background, #f9fafb);
    border-radius: var(--radius-sm, 6px);
    margin-bottom: var(--space-md, 16px);
    border-left: 4px solid var(--color-primary, #2563eb);
}

.store-hours__today-label {
    font-weight: 600;
    color: var(--text-primary, #111827);
}

.store-hours__today-time {
    color: var(--color-primary, #2563eb);
    font-weight: 500;
}

.store-hours__table {
    width: 100%;
    border-collapse: collapse;
}

.store-hours__row {
    border-bottom: 1px solid var(--color-border, #f3f4f6);
}

.store-hours__row:last-child {
    border-bottom: none;
}

.store-hours__row--today {
    background: rgba(37, 99, 235, 0.05);
    font-weight: 600;
}

.store-hours__day,
.store-hours__time {
    padding: var(--space-sm, 10px) var(--space-xs, 6px);
    font-size: var(--font-size-sm, 0.875rem);
}

.store-hours__day {
    font-weight: 500;
    color: var(--text-primary, #374151);
    text-transform: capitalize;
}

.store-hours__time {
    color: var(--text-secondary, #6b7280);
    text-align: right;
}

/* =============================================================
   DIRECTIONS COMPONENT
   ============================================================= */

.directions-panel {
    background: white;
    border-radius: var(--radius-lg, 12px);
    border: 1px solid var(--color-border, #e5e7eb);
    overflow: hidden;
    margin-bottom: var(--space-lg, 24px);
}

.directions-panel__header {
    padding: var(--space-lg, 20px);
    border-bottom: 1px solid var(--color-border, #e5e7eb);
    background: var(--color-background, #f9fafb);
}

.directions-panel__title {
    font-size: var(--font-size-lg, 1.125rem);
    font-weight: 600;
    margin: 0;
    color: var(--text-primary, #111827);
}

.directions-panel__content {
    padding: var(--space-lg, 20px);
}

.directions-form {
    display: flex;
    gap: var(--space-sm, 12px);
    margin-bottom: var(--space-lg, 20px);
}

.directions-form__input {
    flex: 1;
    padding: var(--space-sm, 12px);
    border: 1px solid var(--color-border, #d1d5db);
    border-radius: var(--radius-md, 6px);
    font-size: var(--font-size-sm, 0.875rem);
}

.directions-form__button {
    padding: var(--space-sm, 12px) var(--space-lg, 20px);
    white-space: nowrap;
}

.directions-options {
    display: flex;
    gap: var(--space-sm, 12px);
    margin-bottom: var(--space-lg, 20px);
}

.directions-option {
    flex: 1;
    padding: var(--space-sm, 10px);
    background: var(--color-background, #f9fafb);
    border: 1px solid var(--color-border, #e5e7eb);
    border-radius: var(--radius-md, 6px);
    cursor: pointer;
    text-align: center;
    transition: all 0.2s ease;
    font-size: var(--font-size-sm, 0.875rem);
}

.directions-option:hover,
.directions-option--active {
    background: var(--color-primary, #2563eb);
    color: white;
    border-color: var(--color-primary, #2563eb);
}

.directions-option__icon {
    display: block;
    margin: 0 auto var(--space-xs, 4px);
    width: 20px;
    height: 20px;
}

/* =============================================================
   RESPONSIVE MAP COMPONENTS
   ============================================================= */

@media (max-width: 768px) {
    .store-map__controls {
        position: static;
        background: white;
        margin-top: var(--space-md, 16px);
        flex-direction: row;
        justify-content: center;
        padding: var(--space-sm, 12px);
    }
    
    .stores-map__sidebar {
        width: 100%;
        position: relative;
        transform: none;
        height: auto;
        max-height: 300px;
        border-right: none;
        border-bottom: 1px solid var(--color-border, #e5e7eb);
    }
    
    .stores-map__sidebar-toggle {
        position: static;
        margin-bottom: var(--space-md, 16px);
        width: 100%;
        text-align: center;
    }
    
    .stores-map {
        height: auto;
        flex-direction: column;
    }
    
    .stores-map__container {
        height: var(--stores-map-mobile-height, 300px);
        order: 2;
    }
    
    .map-popup {
        min-width: 200px;
        max-width: 250px;
    }
    
    .directions-form {
        flex-direction: column;
    }
    
    .directions-options {
        grid-template-columns: repeat(2, 1fr);
        display: grid;
    }
    
    .store-map__info {
        padding: var(--space-md, 16px);
    }
    
    .store-map__actions {
        flex-direction: column;
        gap: var(--space-sm, 8px);
    }
    
    .store-map__actions .btn {
        width: 100%;
        justify-content: center;
    }
}

/* =============================================================
   ACCESSIBILITY ENHANCEMENTS
   ============================================================= */

.store-map__container[role="application"] {
    outline: none;
}

.store-map__container:focus-visible {
    outline: 2px solid var(--focus-color, #2563eb);
    outline-offset: 2px;
}

.map-store-item[role="button"] {
    outline: none;
}

.map-store-item:focus-visible {
    outline: 2px solid var(--focus-color, #2563eb);
    outline-offset: -2px;
}

/* Screen reader announcements for map interactions */
.map-sr-announcement {
    position: absolute;
    left: -10000px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

/* =============================================================
   PRINT STYLES
   ============================================================= */

@media print {
    .store-map,
    .stores-map,
    .directions-panel {
        background: white !important;
        border: 1px solid #ccc !important;
        box-shadow: none !important;
    }
    
    .store-map__container {
        background: #f5f5f5 !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }
    
    .store-map__container::after {
        content: "Map not available in print" !important;
        color: #666 !important;
        font-style: italic !important;
    }
    
    .store-map__controls,
    .stores-map__sidebar-toggle,
    .directions-form,
    .directions-options {
        display: none !important;
    }
    
    .store-map__info,
    .store-map__address {
        background: white !important;
        color: black !important;
    }
}
