:root {
    /* MODO CLARO (Default) */
    --primary: #10b981;
    --bg: #f8fafc;
    --surface: #ffffff;
    --card: #ffffff;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

html,
body {
    height: 100%;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    /* MOVIMOS LA FUENTE AQUÍ PARA QUE SEA CONSTANTE EN AMBOS MODOS */
    font-family: 'Plus Jakarta Sans', sans-serif;
    background-color: var(--bg);
    color: var(--text-main);
    transition: background-color 0.4s ease, color 0.4s ease;
}

* {
    box-sizing: border-box !important;
}

body.dark-theme {
    --bg: #020617;
    --surface: #0f172a;
    --card: #1e293b;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --border: #334155;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.hidden {
    display: none !important;
}


/* Header y Pestañas Raíz */

.root-cat-list {
    display: flex;
    gap: 25px;
    overflow-x: auto;
    justify-content: flex-start;
    margin-bottom: 30px;
    padding-bottom: 10px;
    scrollbar-width: none;
}

.root-cat-list::-webkit-scrollbar {
    display: none;
}

.root-tab {
    font-size: 2.2rem;
    font-weight: 800;
    color: var(--text-muted);
    /* Color suave pero legible */
    cursor: pointer;
    padding: 0 5px 10px 5px;
    border-bottom: 4px solid transparent;
    transition: var(--transition);
    white-space: nowrap;
}

.root-tab:hover {
    color: var(--text-main);
}

.root-tab.active {
    color: var(--text-main);
    border-bottom-color: var(--primary);
}

.material-icons {
    font-size: 20px;
    /* Tamaño ajustable */
    color: var(--primary);
    /* O el color que prefieras */
    transition: var(--transition);
}


/* Si quieres que el icono del botón cambie según el tema */

.theme-toggle .material-icons {
    color: var(--text-main);
}

nav {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    z-index: 10000 !important;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
    /* Cambiamos var(--surface) por var(--bg) */
    background-color: var(--bg) !important;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

header {
    padding: 130px 0 40px 0 !important;
    text-align: center;
}

.filters-bar {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-bottom: 40px;
}

.search-wrapper {
    position: relative;
    width: 100%;
    max-width: 500px;
    margin: 0 auto;
}

.search-input {
    width: 100%;
    padding: 15px 25px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-main);
    outline: none;
    transition: var(--transition);
}


/* Subcategorías y Grid */

.cat-list {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    justify-content: flex-start;
    padding-bottom: 10px;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.cat-list::-webkit-scrollbar {
    display: none;
}

.cat-pill {
    padding: 8px 20px;
    border-radius: 10px;
    background: var(--surface);
    border: 1px solid var(--border);
    white-space: nowrap;
    color: var(--text-main);
    cursor: pointer;
}

.cat-pill.active {
    background: var(--primary);
    border-color: var(--primary);
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 25px;
}

.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 20px;
    overflow: hidden;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
}

.card-content {
    padding: 20px;
    width: 100%;
}

.card-price {
    display: block;
    width: 100%;
    text-align: right;
    color: var(--primary);
    font-weight: 800;
    font-size: 1.2rem;
    margin-top: 10px;
}

.card img {
    width: 100%;
    height: 220px;
    object-fit: cover;
}


/* Carrusel y Detalle */

.carousel {
    position: relative;
    border-radius: 24px;
    overflow: hidden;
    background: #000;
    height: 500px;
}

.carousel-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.5);
    color: white;
    border: none;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    cursor: pointer;
    z-index: 100;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.carousel-btn:hover {
    background: var(--primary);
}

.carousel-dots {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 10px;
    z-index: 100;
}

.dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.4);
    cursor: pointer;
    transition: var(--transition);
}

.dot.active {
    background: var(--primary);
    transform: scale(1.2);
}

.slide-container {
    display: flex !important;
    /* Fuerza fila */
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    /* Prohibe que bajen */
    height: 100%;
    width: 100%;
    transition: transform 0.4s ease-in-out;
}

.slide-container img {
    flex: 0 0 100% !important;
    /* Cada imagen ocupa el 100% exacto */
    width: 100% !important;
    height: 100% !important;
    object-fit: contain !important;
    display: block;
}


/* Lightbox y Zoom */

.lightbox {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.95);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s;
}

.lightbox.active {
    opacity: 1;
    visibility: visible;
}

#lightbox-img {
    max-width: 95%;
    max-height: 85vh;
    touch-action: none;
    will-change: transform;
    transition: transform 0.1s ease-out;
}

.lightbox-btn {
    position: absolute;
    top: 50%;
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--border);
    border-radius: 50%;
    color: white;
    cursor: pointer;
    z-index: 10001;
}

.lb-prev {
    left: 20px;
}

.lb-next {
    right: 20px;
}

.lightbox-close {
    position: absolute;
    top: 20px;
    right: 20px;
    font-size: 3rem;
    color: white;
    background: none;
    border: none;
    z-index: 10001;
}


/* Redes Sociales Tactiles */

.social-btn {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: var(--surface);
    display: flex;
    align-items: center;
    justify-content: center;
}

.socialmediaicon {
    width: 24px;
    height: 24px;
}

.deployable-footer {
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    background-color: var(--surface);
    color: var(--text-main);
    text-align: center;
    padding: 20px;
    border-top: 3px solid var(--primary);
    box-shadow: 0 -5px 20px rgba(0, 0, 0, 0.1);
    z-index: 10001 !important;
    font-weight: 800;
    font-size: 1.1rem;
    transition: transform 0.4s ease;
}

.deployable-footer.footer-hidden {
    transform: translateY(100%) !important;
}


/* css/styles.css */


/*
  Solución para evitar que el footer fijo (Saavedra Creaciones)
  tape los iconos de redes sociales en la vista de detalle.
*/

#view-detail {
    /*
      Añadimos un padding inferior considerable.
      Ajusta este valor (100px) si tu footer es más alto.
      Debe ser suficiente para que quepa el footer + un espacio de respiración.
    */
    padding-bottom: 100px !important;
}


/*
  Si el contenedor interno también tiene paddings que puedan
  estar interfiriendo, asegúrate de que el inferior sea 0
  para que solo mande el padding del contenedor padre.
*/

#view-detail .product-detail {
    padding-bottom: 0 !important;
}


/* --- BOTÓN DE INSTALACIÓN PWA (Estético y Adaptativo) --- */

.pwa-install-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 24px;
    background-color: var(--surface);
    /* Fondo adaptable */
    color: var(--text-main);
    /* Texto adaptable */
    border-radius: 30px;
    border: 1px solid var(--border);
    /* Borde sutil adaptable */
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}


/* Estado oculto */

.pwa-install-btn.hidden {
    display: none;
    opacity: 0;
    pointer-events: none;
    transform: translateY(20px);
}


/* Hover Effect */

.pwa-install-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
    background-color: var(--primary);
    /* El fondo se vuelve azul Troncochip */
    color: #ffffff !important;
    /* El texto se vuelve blanco puro */
    border-color: transparent;
}


/* Icono */

.pwa-install-btn .material-icons {
    font-size: 1.3rem;
    vertical-align: middle;
}


/* Adaptación responsive para móviles */

@media (max-width: 768px) {
    .pwa-install-btn {
        padding: 10px 18px;
        bottom: 15px;
        right: 15px;
    }
    .pwa-install-btn .btn-text {
        display: none;
        /* En móviles muy pequeños, solo muestra el icono */
    }
}