/* Variables de diseño moderno con enfoque responsivo */
:root {
    /* Modo Claro (por defecto) */
    --utility-bg: rgba(255, 255, 255, 0.96);
    --border-color: rgba(0, 0, 0, 0.08);
    --primary-text: #1a1a1a;
    --secondary-text: #4d4d4d;
    --accent-color: #2563eb;
    --whatsapp-green: #25D366;
    --icon-size: 1.25rem;
    --spacing-unit: 1.5rem;
    --transition-speed: 0.3s;
    --border-radius: 0.375rem;
    --box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
    --font-stack: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
    --select-bg: #ffffff;
    --select-text: #1a1a1a;
}

/* Modo Oscuro */
[data-theme="dark"] {
    --utility-bg: rgba(28, 28, 30, 0.96);
    --border-color: rgba(255, 255, 255, 0.12);
    --primary-text: #f5f5f7;
    --secondary-text: #aeaeb2;
    --accent-color: #0a84ff;
    --whatsapp-green: #25D366;
    --box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
    --select-bg: #2c2c30;
    --select-text: #f5f5f7;
}

/* Reset para mejor compatibilidad */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* Estilo principal mejorado con enfoque mobile-first */
.utility-bar {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    background-color: var(--utility-bg);
    padding: 0.75rem 1rem;
    font-family: var(--font-stack);
    border-bottom: 1px solid var(--border-color);
    font-size: 0.875rem;
    color: var(--primary-text);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    position: relative;
    z-index: 100;
    gap: 1rem;
    transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease;
}

/* Sección de contacto mejorada para móviles */
.utility-bar__contact {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    align-items: center;
    width: 100%;
}

.contact-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--secondary-text);
    text-decoration: none;
    transition: all var(--transition-speed) ease;
    padding: 0.25rem 0;
    font-weight: 500;
    width: 100%;
    justify-content: center;
}

.contact-link__text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.contact-divider {
    display: none;
}

.contact-link:hover {
    color: var(--accent-color);
}

.contact-link--whatsapp:hover {
    color: var(--whatsapp-green);
}

.contact-link::before {
    content: "";
    display: inline-block;
    width: var(--icon-size);
    height: var(--icon-size);
    background-size: contain;
    background-repeat: no-repeat;
    transition: transform 0.3s ease;
    flex-shrink: 0;
}

.contact-link:hover::before {
    transform: scale(1.1);
}

.contact-link--whatsapp::before {
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%2325D366"><path d="M17.472 14.382c-.297-.149-1.758-.867-2.03-.967-.273-.099-.471-.148-.67.15-.197.297-.767.966-.94 1.164-.173.199-.347.223-.644.075-.297-.15-1.255-.463-2.39-1.475-.883-.788-1.48-1.761-1.653-2.059-.173-.297-.018-.458.13-.606.134-.133.298-.347.446-.52.149-.174.198-.298.298-.497.099-.198.05-.371-.025-.52-.075-.149-.669-1.612-.916-2.207-.242-.579-.487-.5-.669-.51-.173-.008-.371-.01-.57-.01-.198 0-.52.074-.792.372-.272.297-1.04 1.016-1.04 2.479 0 1.462 1.065 2.875 1.213 3.074.149.198 2.096 3.2 5.077 4.487.709.306 1.262.489 1.694.625.712.227 1.36.195 1.871.118.571-.085 1.758-.719 2.006-1.413.248-.694.248-1.289.173-1.413-.074-.124-.272-.198-.57-.347m-6.29-3.43c.173.246.5.512.7.663.198.15.397.223.397.372 0 .149-.074.223-.173.347-.099.124-.397.372-.793.633-.396.26-.57.39-.77.39-.198 0-.347-.074-.545-.26-.198-.186-.744-.728-.992-.975-.248-.248-.496-.521-.05-.967.447-.446.892-.446 1.19-.148.298.297.62.694.744.832M12 0a12 12 0 0 0-9.615 19.365L0 24l4.635-2.385A12 12 0 1 0 12 0m0 22a10 10 0 1 1 0-20 10 10 0 0 1 0 20"/></svg>');
}

.contact-link--email::before {
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%234d4d4d"><path d="M20 4H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm0 4l-8 5-8-5V6l8 5 8-5v2z"/></svg>');
}

/* Versión modo oscuro para email icon */
[data-theme="dark"] .contact-link--email::before {
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%23aeaeb2"><path d="M20 4H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm0 4l-8 5-8-5V6l8 5 8-5v2z"/></svg>');
}

.contact-link:hover.contact-link--email::before {
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%232563eb"><path d="M20 4H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm0 4l-8 5-8-5V6l8 5 8-5v2z"/></svg>');
}

[data-theme="dark"] .contact-link:hover.contact-link--email::before {
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%230a84ff"><path d="M20 4H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm0 4l-8 5-8-5V6l8 5 8-5v2z"/></svg>');
}

/* Sección de ajustes para móviles */
.utility-bar__settings {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    align-items: center;
    width: 100%;
}

.custom-select-wrapper {
    width: 100%;
    max-width: 200px;
}

.custom-select {
    width: 100%;
    padding: 0.5rem 2rem 0.5rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    background-color: var(--select-bg);
    font-size: 0.875rem;
    color: var(--select-text);
    cursor: pointer;
    appearance: none;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%234d4d4d"><path d="M7 10l5 5 5-5z"/></svg>');
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 1rem;
    transition: all var(--transition-speed) ease;
    box-shadow: var(--box-shadow);
    font-weight: 500;
}

[data-theme="dark"] .custom-select {
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%23aeaeb2"><path d="M7 10l5 5 5-5z"/></svg>');
}

.custom-select:hover {
    border-color: rgba(0, 0, 0, 0.15);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

[data-theme="dark"] .custom-select:hover {
    border-color: rgba(255, 255, 255, 0.25);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.custom-select:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2);
}

[data-theme="dark"] .custom-select:focus {
    box-shadow: 0 0 0 2px rgba(10, 132, 255, 0.3);
}

/* Efecto de carga sutil */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}

.utility-bar {
    animation: fadeIn 0.6s ease forwards;
}

/* Media Queries para adaptarse a diferentes tamaños */

@media (min-width: 37.5em) {
    .utility-bar {
        flex-direction: row;
        padding: 0.75rem 1.5rem;
        gap: 1.5rem;
    }
    
    .utility-bar__contact {
        flex-direction: row;
        gap: 1rem;
        width: auto;
    }
    
    .utility-bar__settings {
        flex-direction: row;
        width: auto;
        gap: 1rem;
    }
    
    .contact-link {
        width: auto;
        justify-content: flex-start;
        padding: 0.5rem 0;
    }
    
    .contact-divider {
        display: inline-block;
        width: 1px;
        height: 1.25rem;
        background-color: var(--border-color);
    }
    
    .custom-select-wrapper {
        width: auto;
    }
    
    .custom-select {
        min-width: 120px;
    }
}

@media (min-width: 48em) {
    .utility-bar {
        padding: 0.75rem 2rem;
    }
    
    .utility-bar__contact {
        gap: 1.5rem;
    }
    
    .contact-link {
        position: relative;
    }
    
    .contact-link::after {
        content: '';
        position: absolute;
        bottom: 0;
        left: 0;
        width: 100%;
        height: 2px;
        background-color: var(--accent-color);
        transform: scaleX(0);
        transform-origin: right;
        transition: transform var(--transition-speed) ease;
    }
    
    .contact-link:hover::after {
        transform: scaleX(1);
        transform-origin: left;
    }
    
    .contact-link--whatsapp:hover::after {
        background-color: var(--whatsapp-green);
    }
}

@media (min-width: 64em) {
    .utility-bar {
        padding: 0.75rem 3rem;
    }
}

@media (min-width: 90em) {
    .utility-bar {
        padding: 0.75rem 4rem;
    }
}

/* Ajustes para dispositivos con pantalla táctil */
@media (hover: none) {
    .contact-link:hover {
        color: var(--secondary-text);
        transform: none;
    }
    
    .contact-link--whatsapp:hover {
        color: var(--whatsapp-green);
    }
    
    .contact-link:hover::before {
        transform: none;
    }
    
    .custom-select:hover {
        border-color: var(--border-color);
        box-shadow: var(--box-shadow);
    }
}

/* Soporte para navegadores antiguos */
@supports not (backdrop-filter: blur(8px)) {
    .utility-bar {
        background-color: var(--utility-bg);
    }
}