/**
 * ==========================================================================
 * LOCATION SELECTOR UI - STYLES
 * ==========================================================================
 * 
 * Estilos para el componente Location Selector
 * Mobile-first responsive design
 * 
 * @version 2.0.0
 * @since 2024-11-04
 */

/* ==========================================================================
   VARIABLES
   ========================================================================== */
:root {
    --location-selector-bg: #ffffff;
    --location-selector-border: #e0e0e0;
    --location-selector-hover: #f5f5f5;
    --location-selector-active: #0066cc;
    --location-selector-text: #333333;
    --location-selector-shadow: rgba(0, 0, 0, 0.1);
    --location-selector-z-index: 1000;
}

/* ==========================================================================
   CONTAINER
   ========================================================================== */
.location-selector-wrapper {
    display: inline-block;
    position: relative;
    margin: 0;
    padding: 0;
}

/* ==========================================================================
   MAIN COMPONENT
   ========================================================================== */
.bagsandgo-location-selector {
    position: relative;
    display: inline-block;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
}

/* ==========================================================================
   BUTTON
   ========================================================================== */
.location-selector-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--location-selector-bg);
    border: 1px solid var(--location-selector-border);
    border-radius: 6px;
    color: var(--location-selector-text);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    user-select: none;
    -webkit-user-select: none;
}

.location-selector-btn:hover {
    background: var(--location-selector-hover);
    border-color: var(--location-selector-active);
}

.location-selector-btn:focus {
    outline: none;
    border-color: var(--location-selector-active);
    box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.1);
}

.location-selector-btn:active {
    transform: scale(0.98);
}

/* Button elements */
.location-selector-btn .location-emoji {
    font-size: 18px;
    line-height: 1;
}

.location-selector-btn .location-name {
    font-weight: 500;
    color: var(--location-selector-text);
}

.location-selector-btn .location-chevron {
    margin-left: 4px;
    transition: transform 0.2s ease;
    color: var(--location-selector-text);
    opacity: 0.6;
}

/* Chevron rotation when open */
.bagsandgo-location-selector.open .location-selector-btn .location-chevron {
    transform: rotate(180deg);
}

/* ==========================================================================
   DROPDOWN
   ========================================================================== */
.location-selector-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    min-width: 180px;
    background: var(--location-selector-bg);
    border: 1px solid var(--location-selector-border);
    border-radius: 8px;
    box-shadow: 0 4px 12px var(--location-selector-shadow);
    z-index: var(--location-selector-z-index);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: all 0.2s ease;
    overflow: hidden;
}

/* Dropdown open state */
.bagsandgo-location-selector.open .location-selector-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* ==========================================================================
   OPTIONS
   ========================================================================== */
.location-option {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 12px 16px;
    background: transparent;
    border: none;
    color: var(--location-selector-text);
    font-size: 14px;
    font-weight: 400;
    text-align: left;
    cursor: pointer;
    transition: background 0.15s ease;
}

.location-option:hover {
    background: var(--location-selector-hover);
}

.location-option:focus {
    outline: none;
    background: var(--location-selector-hover);
}

.location-option:active {
    background: rgba(0, 102, 204, 0.1);
}

/* Option elements */
.location-option .location-emoji {
    font-size: 20px;
    line-height: 1;
}

.location-option .location-name {
    flex: 1;
    font-weight: 400;
}

.location-option .location-check {
    margin-left: auto;
    color: var(--location-selector-active);
    font-size: 16px;
    font-weight: 600;
}

/* Active option */
.location-option.active {
    background: rgba(0, 102, 204, 0.05);
}

.location-option.active .location-name {
    font-weight: 500;
    color: var(--location-selector-active);
}

/* ==========================================================================
   MOBILE RESPONSIVE
   ========================================================================== */
@media (max-width: 768px) {
    /* Button más pequeño en mobile */
    .location-selector-btn {
        padding: 6px 10px;
        font-size: 13px;
    }
    
    .location-selector-btn .location-emoji {
        font-size: 16px;
    }
    
    /* Ocultar nombre en mobile si es necesario */
    .location-selector-btn .location-name {
        display: none;
    }
    
    /* Mostrar solo en mobile con nombre corto */
    @media (min-width: 480px) {
        .location-selector-btn .location-name {
            display: inline-block;
        }
    }
    
    /* Dropdown full width en mobile pequeño */
    .location-selector-dropdown {
        left: auto;
        right: 0;
        min-width: 160px;
    }
    
    /* Options más compactas en mobile */
    .location-option {
        padding: 10px 14px;
        font-size: 13px;
    }
    
    .location-option .location-emoji {
        font-size: 18px;
    }
}

/* ==========================================================================
   DARK MODE SUPPORT (opcional)
   ========================================================================== */
@media (prefers-color-scheme: dark) {
    :root {
        --location-selector-bg: #2d2d2d;
        --location-selector-border: #404040;
        --location-selector-hover: #3a3a3a;
        --location-selector-active: #4d9fff;
        --location-selector-text: #e0e0e0;
        --location-selector-shadow: rgba(0, 0, 0, 0.3);
    }
}

/* Force dark mode class */
.dark-mode .bagsandgo-location-selector,
body.dark .bagsandgo-location-selector {
    --location-selector-bg: #2d2d2d;
    --location-selector-border: #404040;
    --location-selector-hover: #3a3a3a;
    --location-selector-active: #4d9fff;
    --location-selector-text: #e0e0e0;
    --location-selector-shadow: rgba(0, 0, 0, 0.3);
}

/* ==========================================================================
   ACCESSIBILITY
   ========================================================================== */

/* Focus visible para keyboard navigation */
.location-selector-btn:focus-visible {
    outline: 2px solid var(--location-selector-active);
    outline-offset: 2px;
}

.location-option:focus-visible {
    outline: 2px solid var(--location-selector-active);
    outline-offset: -2px;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .location-selector-btn,
    .location-selector-dropdown,
    .location-option,
    .location-chevron {
        transition: none;
    }
}

/* ==========================================================================
   PRINT
   ========================================================================== */
@media print {
    .bagsandgo-location-selector {
        display: none;
    }
}

/* ==========================================================================
   INTEGRATION HELPERS
   ========================================================================== */

/* En header */
header .location-selector-wrapper,
.site-header .location-selector-wrapper,
#masthead .location-selector-wrapper {
    margin-left: auto;
    padding: 10px 0;
}

/* En navigation */
nav .location-selector-wrapper,
.main-navigation .location-selector-wrapper {
    display: inline-block;
    vertical-align: middle;
}

/* Alineación derecha en header */
.header-right .location-selector-wrapper,
.header-actions .location-selector-wrapper {
    margin-left: 15px;
}

/* ==========================================================================
   ANIMATION VARIANTS (opcional)
   ========================================================================== */

/* Fade in animation */
@keyframes locationSelectorFadeIn {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.bagsandgo-location-selector.open .location-selector-dropdown {
    animation: locationSelectorFadeIn 0.2s ease;
}

/* ==========================================================================
   Z-INDEX MANAGEMENT
   ========================================================================== */

/* Asegurar que el dropdown esté sobre otros elementos */
.location-selector-dropdown {
    z-index: 9999;
}

/* Si hay un header sticky, ajustar */
.is-sticky .location-selector-dropdown,
.sticky-header .location-selector-dropdown {
    z-index: 10001;
}
