/* Reset y base */
* {
    box-sizing: border-box;
}
body {
    margin: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #1e1e2f;
    color: #ddd;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}
a {
    color: #4caf50;
    text-decoration: none;
}
a:hover {
    text-decoration: underline;
}

/* Encabezado */
header {
    background: #4caf50;
    padding: 20px;
    color: white;
    text-align: center;
    box-shadow: 0 3px 8px rgba(0,0,0,0.3);
    font-weight: 700;
    font-size: 28px;
    letter-spacing: 1px;
}

/* Leyenda animada */
header.leyenda {
    background-color: #FFFFFF;
    width: 89%;
    margin: 0 auto 20px;
    border-radius: 10px;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    padding: 10px;
}
header.leyenda div {
    white-space: nowrap;
    animation: marquee 30s linear infinite;
}
header.leyenda h1 {
    font-size: 18px;
    font-style: italic;
    margin: 0;
    text-align: center;
    display: inline-block;
    color: #4CAF50;
}
@keyframes marquee {
    0% { transform: translateX(100%); }
    100% { transform: translateX(-100%); }
}

/* Contenedor principal */
main {
    flex: 1;
    max-width: 1400px;
    margin: 0 auto 30px;
    padding: 0 15px;
    width: 100%;
    position: relative;
    z-index: 1;
}

/* Buscador */
.buscador {
    margin-bottom: 25px;
    display: flex;
    justify-content: center;
}
.buscador input[type="text"] {
    width: 100%;
    max-width: 400px;
    padding: 12px 20px;
    border-radius: 30px;
    border: none;
    font-size: 16px;
    outline: none;
    box-shadow: 0 0 8px #4caf50aa;
    background: #333;
    color: #eee;
    transition: box-shadow 0.3s ease;
}
.buscador input[type="text"]:focus {
    box-shadow: 0 0 15px #4caf50ee;
}

/* Grid productos */
.grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr); /* 4 columnas desktop */
    gap: 16px;
    width: 100%;
    padding: 0;
    margin: 0 auto;
    box-sizing: border-box;
}


/* Productos individuales */
.grid > .producto {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: stretch;      /* para que el contenido ocupe todo el ancho */
    background: #2c2c44;
    border-radius: 12px;
    padding: 12px;
    box-shadow: 0 5px 10px rgba(0,0,0,0.7);
    position: relative;
    cursor: pointer;
    overflow: hidden;          /* evita que texto se salga */
}
.grid > .producto:hover {
    transform: translateY(-6px);
    box-shadow: 0 10px 20px rgba(76, 175, 80, 0.8);
}


/* Imágenes de productos */
.grid > .producto img {
    width: 100%;
    height: 200px;       /* altura fija uniforme */
    object-fit: contain;  /* mantiene proporción sin deformar */
    margin-bottom: 10px;
    border-radius: 8px;
    flex-shrink: 0;      /* no se achique si el texto es largo */
    background: #444;
}


/* Texto de producto */
.producto h2 {
    font-size: 16px;
    font-weight: 600;
    margin: 6px 0 4px;
    color: #c8facc;
    line-height: 1.2em;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;       /* 1 línea */
}

.producto .codigo {
    font-size: 12px;
    color: #bbb;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.producto .precio {
    font-size: 14px;
    font-weight: 700;
    color: #fff;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}


.producto p {
    font-size: 13px;
    color: #bbb;
    line-height: 1.2em;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}


.producto img {
    width: 100%;
    height: 220px;
    object-fit: contain;
    margin-bottom: 15px;
    border-radius: 8px;
    background: #444;
    flex-shrink: 0;       /* evita que se achique */
    max-height: 220px;    /* mantiene tamaño máximo */
}


/* Etiqueta estado */
.etiqueta-estado {
    position: absolute;
    top: 12px;
    left: 12px;
    z-index: 10;
    background-color: var(--color);
    color: #222;
    padding: 5px 12px;
    border-radius: 50px;
    font-weight: 600;
    font-size: 13px;
    box-shadow: 0 0 8px var(--color);
    pointer-events: none;
}


/* Paginación */
.paginacion {
    margin: 35px 0;
    display: flex;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
}
.paginacion button {
    background: #4caf50;
    border: none;
    padding: 10px 16px;
    color: #1e1e2f;
    font-weight: 700;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}
.paginacion button:hover:not(.activo) {
    background-color: #69db7c;
}
.paginacion button.activo {
    background-color: #fff;
    color: #4caf50;
    cursor: default;
    box-shadow: 0 0 10px #69db7c;
}

/* Pie de página */
footer {
    background: #12121e;
    color: #999;
    text-align: center;
    padding: 15px 10px;
    font-size: 14px;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.1);
}
footer a {
    color: #4caf50;
}

/* Carrito flotante */
#boton-carrito {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background-color: #4caf50;
    color: #1e1e2f;
    border: none;
    border-radius: 50%;
    width: 56px;
    height: 56px;
    font-size: 28px;
    cursor: pointer;
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1001;
}
#carrito {
    position: fixed;
    top: 60px;
    right: 20px;
    width: 320px;
    max-height: 80vh;
    background: #2c2c44;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.7);
    padding: 15px;
    color: #ddd;
    overflow-y: auto;
    z-index: 1000;
    display: none;
    flex-direction: column;
}
#carrito h3 {
    margin-top: 0;
    margin-bottom: 12px;
    text-align: center;
    color: #4caf50;
}
#carrito .item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    font-size: 14px;
}
#carrito .item span {
    flex: 1;
}
#carrito .item button {
    background: transparent;
    border: none;
    color: #f44336;
    cursor: pointer;
    font-size: 16px;
    padding: 0 5px;
    user-select: none;
}
#carrito .item input {
    width: 40px;
    margin: 0 5px;
    text-align: center;
    border-radius: 5px;
    border: none;
    font-size: 14px;
}
#carrito .total {
    font-weight: 700;
    font-size: 16px;
    margin-top: 12px;
    text-align: right;
    color: #fff;
}
#carrito button#enviar-pedido {
    background-color: #4caf50;
    border: none;
    padding: 10px;
    margin-top: 15px;
    border-radius: 10px;
    color: #1e1e2f;
    font-weight: 700;
    cursor: pointer;
    transition: background-color 0.3s ease;
}
#carrito button#enviar-pedido:hover {
    background-color: #69db7c;
}

/* Producto seleccionado con borde */
.producto.seleccionado {
    border: 3px solid #69db7c;
}

/* Formulario datos usuario */
#datos-usuario {
    margin-top: 15px;
    border-top: 1px solid #4caf50aa;
    padding-top: 12px;
    font-size: 14px;
    color: #ccc;
}
#datos-usuario label {
    display: block;
    margin-bottom: 6px;
}
#datos-usuario input {
    width: 100%;
    padding: 6px 8px;
    border-radius: 6px;
    border: none;
    font-size: 14px;
    margin-bottom: 10px;
    box-sizing: border-box;
}

/* Overlay imagen */
#overlay-img {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(30, 30, 47, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    z-index: 2000;
}
#overlay-img img {
    max-width: 90vw;
    max-height: 90vh;
    border-radius: 12px;
    box-shadow: 0 0 30px rgba(76, 175, 80, 0.9);
    cursor: default;
}

/* Media query para móviles: 2 productos por fila */
@media (max-width: 1023px) {
    .grid {
        grid-template-columns: repeat(2, 1fr); /* 2 columnas móviles */
    }
}

