/* style.css - VERSIÓN CORREGIDA FINAL */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;600&display=swap');

:root {
    --bg-dark: #121212;     /* Fondo principal muy oscuro */
    --bg-card: #1e1e1e;     /* Fondo de tarjetas */
    --primary: #8e2de2;     /* Morado Vibrante */
    --secondary: #4a00e0;   /* Azul oscuro */
    --accent: #00d2d3;      /* Cyan para precios/stock */
    --sidebar-w: 260px;     /* Ancho fijo sidebar */
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'Poppins', sans-serif;
    background-color: var(--bg-dark);
    color: #fff;
    display: flex; /* Esto separa sidebar de contenido SIEMPRE */
    min-height: 100vh;
    overflow-x: hidden; /* Evita scroll lateral indeseado */
}

/* --- 1. SIDEBAR FIJA --- */
.sidebar {
    width: var(--sidebar-w);
    background: linear-gradient(180deg, #18181b 0%, #121212 100%);
    border-right: 1px solid #333;
    height: 100vh;
    position: fixed;
    top: 0; left: 0;
    padding: 30px 20px;
    z-index: 100;
    display: flex;
    flex-direction: column;
}

.brand {
    font-size: 1.5rem; font-weight: 700; 
    background: linear-gradient(90deg, #fff, #bbb);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    margin-bottom: 40px; text-align: center;
}

.sidebar a {
    color: #aaa; text-decoration: none; padding: 12px 15px;
    margin-bottom: 5px; border-radius: 10px; transition: 0.3s;
    font-size: 0.95rem; display: flex; align-items: center; gap: 10px;
}
.sidebar a:hover, .sidebar a.active {
    background: rgba(142, 45, 226, 0.15); color: var(--primary);
}

/* --- 2. CONTENIDO PRINCIPAL (A la derecha de la sidebar) --- */
.main-content {
    margin-left: var(--sidebar-w); /* Empuja el contenido */
    width: calc(100% - var(--sidebar-w)); /* Ocupa el resto */
    padding: 30px;
}

/* Anuncio Naranja */
.announcement-bar {
    background: linear-gradient(90deg, #ff9f43, #ff6b6b);
    padding: 12px; border-radius: 8px; text-align: center;
    font-weight: 600; font-size: 0.9rem; margin-bottom: 30px;
    box-shadow: 0 4px 15px rgba(255, 107, 107, 0.3);
}

/* --- 3. CARRUSEL (QUE NO SE DESBORDE) --- */
.carousel-container {
    width: 100%;
    height: 300px;
    border-radius: 20px;
    position: relative;
    overflow: hidden; /* CORTA lo que sobre */
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    margin-bottom: 40px;
    background: #000;
}
.slide {
    position: absolute; top: 0; left: 0;
    width: 100%; height: 100%;
    opacity: 0; transition: opacity 1s;
    display: flex; justify-content: center; align-items: center;
}
.slide.active { opacity: 1; z-index: 1; }
.slide img {
    width: 100%; height: 100%;
    object-fit: cover; /* Rellena sin estirar */
}

/* --- 4. GRID DE PRODUCTOS --- */
.grid-products {
    display: grid;
    /* Mínimo 220px por tarjeta, se ajusta solo */
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); 
    gap: 25px;
}

.card {
    background: var(--bg-card);
    border: 1px solid #333;
    border-radius: 16px;
    padding: 20px;
    text-align: center;
    transition: transform 0.2s;
    position: relative;
}
.card:hover { transform: translateY(-5px); border-color: var(--primary); }

.img-circle {
    width: 90px; height: 90px;
    border-radius: 50%; margin: 0 auto 15px;
    padding: 3px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
}
.img-circle img {
    width: 100%; height: 100%; border-radius: 50%;
    object-fit: cover; border: 3px solid var(--bg-card);
}

.price-tag {
    font-size: 1.2rem; font-weight: 700; color: var(--accent); margin: 5px 0;
}

.btn-comprar {
    background: var(--primary); color: white;
    border: none; padding: 10px 20px; border-radius: 50px;
    font-weight: 600; cursor: pointer; width: 100%;
    transition: 0.2s;
}
.btn-comprar:hover { background: var(--secondary); box-shadow: 0 0 15px var(--primary); }

/* --- 5. MODAL FLOTANTE (ESTILO APP) --- */
.modal-overlay {
    display: none; /* OCULTO POR DEFECTO */
    position: fixed; top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(5px);
    z-index: 2000; /* POR ENCIMA DE TODO */
    justify-content: center; align-items: center;
}

.modal-box {
    background: #1f1f23;
    width: 90%; max-width: 400px;
    padding: 30px; border-radius: 24px;
    text-align: center; border: 1px solid #444;
    box-shadow: 0 20px 50px rgba(0,0,0,0.8);
    animation: zoomIn 0.3s ease;
}
@keyframes zoomIn { from{transform:scale(0.8); opacity:0;} to{transform:scale(1); opacity:1;} }

.modal-input-qty {
    background: #000; border: 1px solid #444; color: white;
    font-size: 1.5rem; text-align: center; width: 80px; padding: 10px;
    border-radius: 10px; margin: 0 10px;
}

/* RESPONSIVE MÓVIL (Menor a 768px) */
@media (max-width: 768px) {
    .sidebar { display: none; } /* Ocultamos sidebar temporalmente en móvil */
    .main-content { margin-left: 0; width: 100%; padding: 15px; }
    .grid-products { grid-template-columns: repeat(2, 1fr); gap: 15px; } /* 2 columnas móvil */
    .carousel-container { height: 180px; }
    .card { padding: 15px 10px; }
    .img-circle { width: 70px; height: 70px; }
}