/* ===================================================================
   🧼 ELIMINAR BLOQUEOS VISUALES AL CARGAR Y CONFIGURACIÓN SPA
   =================================================================== */
body { background: #000; color: #fff; }

/* Forzamos que el wrapper principal sea visible */
#main-wrapper { 
    display: block !important; 
    opacity: 1 !important; 
    visibility: visible !important; 
    position: relative;
    z-index: 10;
}

/* Backdrops: solo deben aparecer cuando se activan */
.backdrop-side, .backdrop-cart, .modal-blur-bg { 
    display: none; 
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.8);
    z-index: 900;
}

/* Modales ocultos por defecto */
.neon-modal, .user-profile-matrix { display: none; }

/* ===================================================================
   🤖 ESTILOS CYBERPUNK PARA EL CHATBOT IA FLOTANTE
   =================================================================== */
#pcr-ai-bot-container {
    position: fixed;
    bottom: 25px;
    left: 5px;
    z-index: 9999;
    font-family: 'Rajdhani', sans-serif;
}
.ai-launcher-btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: #000;
    border: 2px solid #00f3ff;
    color: #00f3ff;
    font-size: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 0 15px rgba(0, 243, 255, 0.4);
    transition: all 0.3s ease;
}
.ai-launcher-btn:hover {
    transform: scale(1.05) rotate(10deg);
    box-shadow: 0 0 25px rgba(0, 243, 255, 0.8);
    color: #fff;
    background: #00f3ff;
}
.ai-chat-window {
    display: none;
    width: 350px;
    height: 500px;
    background: rgba(10, 10, 15, 0.95);
    border: 2px solid #00f3ff;
    box-shadow: 0 0 30px rgba(0, 243, 255, 0.2);
    border-radius: 12px;
    flex-direction: column;
    overflow: hidden;
    position: absolute;
    bottom: 75px;
    left: 0; /* Alineado con el contenedor en la izquierda */
    backdrop-filter: blur(10px);
}
.ai-chat-header {
    background: linear-gradient(90deg, #001326 0%, #00f3ff 200%);
    padding: 12px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(0, 243, 255, 0.3);
}
.ai-chat-header h3 {
    margin: 0;
    font-family: 'Orbitron', sans-serif;
    font-size: 14px;
    color: #00f3ff;
    letter-spacing: 2px;
    font-weight: 700;
}
.ai-close-btn {
    background: none;
    border: none;
    color: #fff;
    font-size: 20px;
    cursor: pointer;
    opacity: 0.7;
}
.ai-close-btn:hover { opacity: 1; color: #ff0055; }
.ai-chat-messages {
    flex: 1;
    padding: 15px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: rgba(0, 0, 0, 0.3);
}
.ai-msg {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 14px;
    line-height: 1.4;
    word-wrap: break-word;
}
.ai-msg.user {
    background: rgba(0, 243, 255, 0.15);
    border: 1px solid #00f3ff;
    color: #fff;
    align-self: flex-end;
    border-bottom-right-radius: 1px;
}
.ai-msg.bot {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #e0e0e0;
    align-self: flex-start;
    border-bottom-left-radius: 1px;
}
.ai-chat-input-area {
    padding: 12px;
    background: #050508;
    border-top: 1px solid rgba(0, 243, 255, 0.2);
    display: flex;
    gap: 8px;
}
.ai-input-field {
    flex: 1;
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid rgba(0, 243, 255, 0.4);
    border-radius: 4px;
    color: #fff;
    padding: 8px 12px;
    font-family: 'Rajdhani', sans-serif;
    font-size: 15px;
}
.ai-input-field:focus {
    outline: none;
    border-color: #00f3ff;
    box-shadow: 0 0 10px rgba(0, 243, 255, 0.3);
}
.ai-send-btn {
    background: #000;
    border: 1px solid #00f3ff;
    color: #00f3ff;
    padding: 0 16px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
}
.ai-send-btn:hover {
    background: #00f3ff;
    color: #000;
    box-shadow: 0 0 10px rgba(0, 243, 255, 0.5);
}

/* ===================================================================
   🎠 ESTRUCTURA BASE INTERNA DEL CARRUSEL (ESCRITORIO)
   =================================================================== */
.pcr-carousel-container {
    position: relative;
    width: 100%;
    height: 450px;
    overflow: hidden;
    background: #000;
}
.pcr-slide {
    position: absolute;
    inset: 0;
    opacity: 0;
    transition: opacity 0.8s ease-in-out;
    display: flex;
    align-items: center;
}
.pcr-slide.active {
    opacity: 1;
    z-index: 2;
}
.pcr-img {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: translate(-50%, -50%);
    z-index: 1;
}
.pcr-content {
    position: relative;
    z-index: 3;
    padding: 0 60px;
    max-width: 800px;
}

/* ===================================================================
   🖥️ MEDIA QUERIES GENERALES (TABLETS / ORDENADORES MEDIANOS)
   =================================================================== */
@media (max-width: 1024px) {
    aside.menu-side, .cart-menu {
        width: 320px !important;
        --side-padding: 25px;
    }
    .profile-master-container {
        margin: 110px auto 40px auto;
        padding: 0 20px;
    }
    .profile-grid-system {
        gap: 20px !important;
    }
}

/* ===================================================================
   📱 SISTEMA RESPONSIVO UNIFICADO PARA MÓVILES (MAX-WIDTH: 767px)
   =================================================================== */
@media (max-width: 767px) {
    /* 1. Altura física fija para el chasis superior (1cm real en pantalla) */
    #main-wrapper {
        padding-top: 70px !important;
    }

    /* 2. Chatbot de IA acoplado limpiamente a la izquierda sin bailar */
    #pcr-ai-bot-container {
        bottom: 15px;
        left: 15px;
    }
    .ai-chat-window {
        width: calc(100vw - 30px);
        height: 420px;
        left: 0;
        bottom: 70px;
    }

    /* 3. Menús y Paneles Laterales */
    aside.menu-side {
        left: -100% !important;
        width: calc(100% - 30px) !important;
        margin: 15px;
        height: calc(100vh - 30px) !important;
        top: 15px !important;
    }
    aside.menu-side.active { left: 0 !important; }
    .cart-menu { width: 100% !important; right: -100% !important; }
    .cart-menu.active { right: 0 !important; }

    /* 4. Aislamiento estricto de la vista HOME y compresión del Carrusel */
    #home-view.view-section {
        margin: 0 !important;
        padding: 0 !important;
        width: 100% !important;
    }
    #home-view #pcr-ultra-carousel {
        margin: 0 !important;
        padding: 0 !important;
        height: 140px !important; /* Eliminamos espacios muertos por completo */
    }
    #home-view .pcr-carousel-container {
        height: 140px !important;
    }
    .pcr-img {
        object-fit: cover !important;
        object-position: center center !important;
    }
    .pcr-content {
        padding: 10px 20px !important;
        max-width: 100% !important;
        display: flex !important;
        flex-direction: column !important;
        justify-content: center !important;
        height: 100% !important;
    }
    .pcr-sub { font-size: 0.75rem !important; margin-bottom: 2px !important; }
    .pcr-content h2.glitch { font-size: 1.1rem !important; margin: 2px 0 6px 0 !important; }
    .pcr-text { display: none !important; } /* Ocultado estratégico */
    .pcr-btn { padding: 5px 14px !important; font-size: 0.7rem !important; width: fit-content !important; }

    /* 5. Categorías destacadas pegadas bajo el Carrusel */
    #home-view .destacados-container {
        margin-top: 10px !important;
        padding: 0 10px !important;
    }

    /* 6. SUCCIÓN MAGNÍTICA EXCLUSIVA DE LA CARTELERA DE LA TIENDA */
    #shop-view #grid-productos-shop.productos-grid {
        margin-top: 15px !important; /* Absorbe los 60px de vacío negro */
        margin-bottom: 30px !important;
        gap: 15px !important;
    }
    .products-grid {
        grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)) !important;
        width: 95% !important;
        margin: 15px auto !important;
    }

    /* 7. Autenticación y Footer */
    .auth-container { width: 100% !important; max-width: 400px !important; padding: 2rem 1.5rem !important; }
    .f-columns-grid { grid-template-columns: 1fr !important; gap: 30px !important; text-align: center; }
    .f-newsletter-box { padding: 15px; }
    .f-input-group { flex-direction: column; }
    .f-input, .f-btn-cyber { width: 100%; margin-bottom: 10px; border-radius: 6px !important; }
}

/* ===================================================================
   📱 AJUSTES CRÍTICOS PARA SMARTPHONES EXTREMOS (MAX-WIDTH: 480px)
   =================================================================== */
@media (max-width: 480px) {
    /* Truncamos el carrusel a su escala proporcional móvil ideal */
    #home-view #pcr-ultra-carousel,
    #home-view .pcr-carousel-container {
        height: 125px !important;
    }
    .pcr-content h2.glitch { font-size: 0.95rem !important; }
    
    /* Ajustes en la IA */
    .ai-launcher-btn { width: 50px; height: 50px; font-size: 20px; }
    .ai-chat-window { width: calc(100vw - 20px); height: 80vh; bottom: 65px; }
    .tarjeta-producto-chat { max-width: 100% !important; }

    /* Rejilla a una sola columna estricta en la tienda */
    #shop-view #grid-productos-shop.productos-grid {
        grid-template-columns: 1fr !important;
        padding: 0 10px !important;
        margin-top: 10px !important;
        gap: 12px !important;
    }
    .product-card { clip-path: polygon(0 0, 100% 0, 100% 95%, 95% 100., 0 100%) !important; }
    .card-image-showcase { height: 240px !important; }

    /* Checkout y Perfil */
    .panel-resumen-flex { flex: 1 1 100% !important; margin-bottom: 15px; }
    .checkout-grid-system { grid-template-columns: 1fr !important; }
    .panel-control-box { width: 98% !important; padding: 1rem !important; }
    .profile-card-matrix { grid-template-columns: 1fr !important; padding: 25px 20px !important; }
    .btn-anillo-master { bottom: 20px; left: 15px; width: 50px; height: 50px; }
}