/* ========================================
   VISTA EMPRESA - UX ENHANCEMENTS
   Mejoras de diseño y experiencia de usuario
   ======================================== */

/* ===== 1. STICKY HEADER MINIMIZADO ===== */
header.fixed-top {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1040;
}

header.fixed-top.header-scrolled {
    padding-top: 0.5rem !important;
    padding-bottom: 0.5rem !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

header.fixed-top.header-scrolled .navbar-brand img {
    max-width: 120px;
    transition: max-width 0.3s ease;
}

/* Indicador visual activo más prominente en navegación */
.navbar-nav .nav-link {
    position: relative;
    transition: all 0.3s ease;
}

.navbar-nav .nav-link.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 10%;
    right: 10%;
    height: 3px;
    background: linear-gradient(90deg, transparent, #007bff, transparent);
    border-radius: 2px;
    animation: nav-glow 2s ease-in-out infinite;
}

@keyframes nav-glow {
    0%, 100% { opacity: 0.8; transform: scaleX(1); }
    50% { opacity: 1; transform: scaleX(1.1); }
}

.navbar-nav .nav-link:hover {
    color: #fff !important;
    transform: translateY(-1px);
}

/* Breadcrumb visual discreto */
.breadcrumb-indicator {
    position: fixed;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(10px);
    color: white;
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 0.85rem;
    z-index: 1030;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.breadcrumb-indicator.show {
    opacity: 1;
}

/* ===== 2. WHATSAPP BUTTON MEJORADO ===== */
.btn-success.position-fixed {
    animation: whatsapp-pulse 2s ease-in-out infinite;
    box-shadow: 0 6px 20px rgba(37, 211, 102, 0.4);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-success.position-fixed:hover {
    transform: scale(1.1);
    box-shadow: 0 8px 30px rgba(37, 211, 102, 0.6);
}

.btn-success.position-fixed::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: rgba(37, 211, 102, 0.3);
    animation: whatsapp-ring 2s ease-in-out infinite;
}

@keyframes whatsapp-pulse {
    0%, 100% { box-shadow: 0 6px 20px rgba(37, 211, 102, 0.4); }
    50% { box-shadow: 0 8px 30px rgba(37, 211, 102, 0.6); }
}

@keyframes whatsapp-ring {
    0% { transform: scale(1); opacity: 1; }
    100% { transform: scale(1.4); opacity: 0; }
}

/* ===== 3. HERO SECTION MEJORADO ===== */
.hero {
    position: relative;
    overflow: hidden;
}

/* Fondo con imagen desenfocada - llena todo el espacio */
.hero-blur-bg::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: var(--banner-url);
    background-position: center;
    background-repeat: no-repeat;
    background-size: cover;
    filter: blur(10px);
    z-index: 0;
    transform: scale(1.1); /* Evita bordes blancos del blur */
}

/* Imagen nítida encima del blur - centrada y completa */
.hero-blur-bg::after {
    content: '';
    position: absolute;
    top: var(--hero-safe-top);
    left: 2%;
    width: 96%;
    height: calc(100% - var(--hero-safe-top) - var(--hero-safe-bottom));
    background-image: var(--banner-url);
    background-position: center;
    background-repeat: no-repeat;
    background-size: contain;
    background-attachment: fixed;
    z-index: 1;
}

/* Contenido del hero sobre las imágenes */
.hero-blur-bg > * {
    position: relative;
    z-index: 2;
}

/* Responsive hero height */
@media (max-width: 768px) {
    .hero {
        height: 55vh !important;
        min-height: 400px !important;
    }
    
    /* Más margen en móvil para mostrar mejor la imagen */
    .hero-blur-bg::after {
        top: var(--hero-safe-top);
        left: 2%;
        width: 96%;
        height: calc(100% - var(--hero-safe-top) - var(--hero-safe-bottom));
    }
}

@media (max-width: 576px) {
    .hero {
        height: 50vh !important;
        min-height: 350px !important;
    }
    
    .hero-blur-bg::after {
        top: var(--hero-safe-top);
        left: 2%;
        width: 96%;
        height: calc(100% - var(--hero-safe-top) - var(--hero-safe-bottom));
    }
}

/* Scroll down indicator */
.scroll-indicator {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    animation: scroll-bounce 2s ease-in-out infinite;
}

.scroll-indicator i {
    font-size: 2rem;
    color: rgba(255, 255, 255, 0.8);
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

@keyframes scroll-bounce {
    0%, 100% { transform: translate(-50%, 0); }
    50% { transform: translate(-50%, 10px); }
}

/* ===== 4. IMAGEN DE PERFIL INTEGRADA EN HERO ===== */
.profile-image-container {
    position: relative;
    margin-top: -60px;
    z-index: 15;
    padding: 0 !important;
}

.profile-image-wrapper {
    width: 160px;
    height: 160px;
    margin: 0 auto;
    position: relative;
}

.profile-image-wrapper::before {
    content: '';
    position: absolute;
    inset: -6px;
    border-radius: 50%;
    background: linear-gradient(135deg, #007bff, #6610f2, #007bff);
    animation: profile-rotate 3s linear infinite;
    z-index: -1;
}

.profile-image {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 5px solid white;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    object-fit: cover;
    animation: profile-float 3s ease-in-out infinite;
}

@keyframes profile-rotate {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes profile-float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

/* ===== 5. SECCIÓN DE PRODUCTOS MEJORADA ===== */
/* Cards elevadas con hover effect */
#productos .card-unified {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

#productos .card-unified:hover {
    transform: translateY(-8px) scale(1.03);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
}

/* Tabs con contador */
.productos-tabs .nav-link {
    position: relative;
    padding-right: 35px;
}

.productos-tabs .nav-link .badge {
    position: absolute;
    top: 50%;
    right: 10px;
    transform: translateY(-50%);
    font-size: 0.75rem;
    padding: 4px 8px;
}

/* Spacing mejorado */
#productos .tab-content {
    padding-top: 32px;
}

/* ===== 6. SECCIÓN DE NOTICIAS MEJORADA ===== */
/* Timeline alternativa (opcional, se activa con clase) */
.noticias-timeline .card-unified {
    opacity: 0;
    animation: timeline-fade-in 0.6s ease forwards;
}

.noticias-timeline .card-unified:nth-child(even) {
    animation-delay: 0.1s;
}

.noticias-timeline .card-unified:nth-child(odd) {
    animation-delay: 0.2s;
}

@keyframes timeline-fade-in {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Fecha más visible */
.noticia-date-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    z-index: 5;
    backdrop-filter: blur(10px);
}

/* Loading skeleton mejorado */
.skeleton-card {
    animation: skeleton-shimmer 1.5s ease-in-out infinite;
    background: linear-gradient(
        90deg,
        #f0f0f0 25%,
        #e0e0e0 50%,
        #f0f0f0 75%
    );
    background-size: 200% 100%;
}

@keyframes skeleton-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Read more gradient */
.card-compact__description {
    position: relative;
    max-height: 4.5em;
    overflow: hidden;
}

/* Degradé solo para textos largos (+200 caracteres) */
.card-compact__description--long::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 1.5em;
    background: linear-gradient(to bottom, transparent, white);
}

/* ===== 7. SECCIÓN DE UBICACIÓN MEJORADA ===== */
/* Botón "Cómo llegar" destacado */
.btn-directions {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 600;
    transition: all 0.3s ease;
}

.btn-directions:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

/* Casa Matriz badge más prominente */
.casa-matriz-badge {
    background: linear-gradient(135deg, #007bff, #0056b3);
    color: white;
    padding: 8px 16px;
    border-radius: 8px;
    font-weight: 700;
    font-size: 0.9rem;
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.3);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Hover effect en sucursales */
.sucursal-card {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sucursal-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.12);
}

/* ===== 8. SECCIÓN DE CONTACTO OPTIMIZADA ===== */
/* WhatsApp CTA prominente */
.contact-panel--direct .btn-whatsapp {
    background: linear-gradient(135deg, #25d366, #128c7e);
    font-size: 1.1rem;
    padding: 14px 24px;
    font-weight: 700;
    box-shadow: 0 6px 20px rgba(37, 211, 102, 0.3);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.contact-panel--direct .btn-whatsapp:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 10px 30px rgba(37, 211, 102, 0.5);
}

/* Micro-animaciones en hover */
.contact-chip {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.contact-chip:hover {
    transform: translateY(-4px) scale(1.1);
    animation: chip-bounce 0.6s ease;
}

@keyframes chip-bounce {
    0%, 100% { transform: translateY(-4px) scale(1.1); }
    50% { transform: translateY(-6px) scale(1.15); }
}

/* QR code siempre visible pero pequeño */
#qrContainer {
    display: block !important;
    margin-top: 16px;
}

.qr-wrapper {
    background: white;
    padding: 16px;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 0 auto;
    width: fit-content;
}

#qrCode {
    display: flex;
    justify-content: center;
    align-items: center;
}

#qrCode img,
#qrCode canvas {
    display: block;
    margin: 0 auto;
    border-radius: 8px;
}

#qrContainer {
    text-align: center;
}

#btnQR {
    display: none !important;
}

#qrContainer {
    display: block !important;
}

/* Spacing mejorado entre panels */
.contact-hub__grid {
    gap: 32px;
}

/* ===== 9. MEJORAS GLOBALES ===== */
/* Smooth scroll mejorado */
html {
    scroll-behavior: smooth;
    scroll-padding-top: 100px;
}

/* Typography hierarchy mejorada */
h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    line-height: 1.3;
}

h2 {
    font-size: 2.5rem;
    margin-bottom: 1.5rem;
}

@media (max-width: 768px) {
    h2 {
        font-size: 1.8rem;
    }
}

/* Section dividers más sutiles */
.section-divider {
    height: 1px;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(0, 0, 0, 0.08),
        transparent
    );
    margin: 40px auto;
}

/* Spacing consistency */
section[id] {
    padding: 60px 0;
}

@media (max-width: 768px) {
    section[id] {
        padding: 40px 0;
    }
}

/* Empty states mejorados */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #6c757d;
}

.empty-state i {
    font-size: 4rem;
    color: #dee2e6;
    margin-bottom: 20px;
}

.empty-state h3 {
    font-size: 1.5rem;
    color: #495057;
    margin-bottom: 12px;
}

.empty-state p {
    font-size: 1rem;
    max-width: 400px;
    margin: 0 auto;
}

/* Accessibility - Focus indicators */
*:focus-visible {
    outline: 3px solid rgba(0, 123, 255, 0.5);
    outline-offset: 2px;
    border-radius: 4px;
}

button:focus-visible,
a:focus-visible {
    outline: 3px solid rgba(0, 123, 255, 0.6);
}

/* Skip to content link mejorado */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: #007bff;
    color: white;
    padding: 8px 16px;
    z-index: 10000;
    border-radius: 0 0 8px 0;
    font-weight: 600;
}

.skip-link:focus {
    top: 0;
}

/* ===== 10. RESPONSIVE ENHANCEMENTS ===== */
/* Menú slide-in más suave */
.navbar-collapse {
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

@media (max-width: 991px) {
    .navbar-collapse {
        background: rgba(33, 37, 41, 0.98);
        backdrop-filter: blur(10px);
        margin-top: 16px;
        border-radius: 12px;
        padding: 16px;
    }
    
    .navbar-nav .nav-link {
        padding: 12px 16px;
        border-radius: 8px;
        margin: 4px 0;
    }
    
    .navbar-nav .nav-link:hover {
        background: rgba(255, 255, 255, 0.1);
    }
}

/* Cards más pequeñas en móvil */
@media (max-width: 576px) {
    .card-compact__media {
        height: 180px;
    }
    
    .card-compact__title {
        font-size: 1rem;
    }
    
    .card-compact__description {
        font-size: 0.85rem;
    }
}

/* En móvil mantenemos tabs visibles (scroll horizontal) */
@media (max-width: 576px) {
    .productos-tabs {
        display: none;
    }

    #productos .tab-content {
        display: none;
    }

    .productos-accordion {
        display: block !important;
    }

    .productos-accordion .accordion-item {
        border: 1px solid rgba(0, 0, 0, 0.08);
        border-radius: 12px;
        overflow: hidden;
        margin-bottom: 10px;
    }

    .productos-accordion .accordion-button {
        padding: 0.8rem 1rem;
        font-size: 0.95rem;
        font-weight: 600;
        line-height: 1.2;
        gap: 0.35rem;
    }

    .productos-accordion .accordion-button .badge {
        font-size: 0.72rem;
    }

    .productos-accordion .accordion-body {
        padding: 0.9rem;
    }

    .productos-accordion .accordion-body .card-compact__media {
        height: 170px;
    }
}

@media (min-width: 577px) {
    .productos-accordion {
        display: none !important;
    }

    #productos .tab-content {
        display: block;
    }
}

/* Tap to call/email más visible en móvil */
@media (max-width: 768px) {
    .btn-phone,
    .btn-email {
        font-size: 1.1rem;
        padding: 14px;
    }
    
    .contact-item a[href^="tel"],
    .contact-item a[href^="mailto"] {
        color: #007bff;
        font-weight: 600;
        text-decoration: underline;
    }
}

/* ===== 11. ANIMACIONES ADICIONALES ===== */
/* Fade in sections */
.fade-in-section {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.fade-in-section.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Loading states generales */
.loading-overlay {
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ===== 12. TRANSICIONES SUAVES ===== */
* {
    transition-property: transform, opacity, box-shadow, background-color, color;
    transition-duration: 0.3s;
    transition-timing-function: ease;
}

/* Prevenir transiciones en elementos que no las necesitan */
img,
svg,
video {
    transition: none;
}
