/* ================================
RESET Y ESTILOS GENERALES
================================ */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Inter', sans-serif;
  }

body {
background-color: #ffffff;
color: #000000;
line-height: 1.4;
}

/* ================================
CABECERA
================================ */
.header {
background-color: #ffffff;
border-bottom: 2px solid #009bb3;
padding: 5px 20px;
display: flex;
flex-direction: column;
align-items: stretch;
gap: 10px;
z-index: 20;
}

.header-top-row {
display: flex;
align-items: center;
justify-content: space-between;
gap: 10px;
flex-wrap: wrap;
}

.logo img {
height: 80px;
width: auto;
}

.header-icons {
display: flex;
align-items: center;
gap: 15px;
margin-left: auto;
}

.header-icons img.header-icon {
width: 25px;
height: 25px;
cursor: pointer;
}

.search-icons-wrapper {
display: flex;
align-items: center;
justify-content: center;
gap: 20px;
width: 100%;
}

.search-form {
display: flex;
flex: 1;
max-width: 600px;
width: 100%;
}

.search-form input[type="text"] {
flex: 1;
padding: 10px 12px;
font-size: 16px;
border: 2px solid #009bb3;
border-radius: 8px 0 0 8px;
outline: none;
}

.search-form button {
padding: 10px 16px;
border: none;
border-radius: 0 8px 8px 0;
background-color: #009bb3;
color: #fff;
cursor: pointer;
transition: background 0.3s;
}

.search-form button:hover {
background-color: #007a8c;
}

.icon-logueado {
    border: 2px solid red;
    border-radius: 5px;
    padding: 2px;
}

/* ================================
CONTENEDOR PRINCIPAL
================================ */
.container {
display: flex;
padding: 20px;
gap: 20px;
flex-wrap: wrap;
z-index: 1;
}

/* PANEL IZQUIERDO */

.edicion-item {
    display: block;
    margin-bottom: 5px;
    padding: 5px 10px;
    text-decoration: none;
    color: #333;
}


.edicion-item.active {
    background-color:#009bb3; /* verde */
    color: white;              /* texto blanco */
    border-radius: 4px;        /* opcional, bordes redondeados */
    padding: 5px 10px;         /* opcional, algo de espacio */
    display: inline-block;     /* para que se vea el fondo */
    text-decoration: none;     /* quita subrayado si es un link */
}



.left-panel {
display: flex;
flex-direction: column;
gap: 16px;
width: 250px;
}

.main-button {
display: block;
width: 200px;
height: 70px;
border-radius: 8px;
overflow: hidden;
cursor: pointer;
background: none;
padding: 0;
transition: transform .2s ease, box-shadow .2s ease;
flex: 0 0 auto;
justify-content: center; /* centra horizontal */
    align-items: center;   
}

.main-button:hover {
transform: scale(1.03);
box-shadow: 0 0 10px #00E5FF55;
}

.main-button img {
width: 100%;
height: 100%;
object-fit: contain;
background: white;
}

.top-familias a.image-button {
    display: flex;
    justify-content: center; /* centra horizontal */
    align-items: center;     /* centra vertical */

    min-width: 120px;        /* ancho del cuadro */
    height: 80px;            /* alto del cuadro */

    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;

    scroll-snap-align: center;
    flex-shrink: 0;
    text-decoration: none;
}

/* PANEL DERECHO */
.carousel {
flex: 1;
}

.products-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
gap: 16px;
width: 100%;
}

.card {
background-color: white;
border-radius: 12px;
border: 1px solid #ddd;
padding: 12px;
display: flex;
flex-direction: column;
align-items: center;
justify-content: space-between;
transition: transform 0.2s;
}

.card:hover {
transform: scale(1.03);
box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.card img {
width: 100px;
height: auto;
object-fit: contain;
margin-bottom: 10px;
}

.product-desc {
font-size: 16px;
font-weight: bold;
text-align: center;
margin-bottom: 10px;
line-height: 1.2em;
height: calc(1.2em * 6);
overflow: hidden;
}

.product-dates {
margin-bottom: 10px;
font-size: 14px;
}

.product-dates div {
margin: 2px 0;
}

.price-row {
width: 100%;
display: flex;
justify-content: space-between;
font-size: 18px;
font-weight: bold;
color: #1ca900;
margin-bottom: 10px;
}

.iva {
font-size: 14px;
font-weight: bold;
color: #1ca900;
}

.buy-button {
padding: 8px 12px;
border: none;
border-radius: 6px;
background-color: #ff7b00;
color: #fff;
cursor: pointer;
transition: background 0.3s, transform 0.1s;
width: 100%;
text-align: center;
}

.buy-button:hover {
background-color: #009bb3;
transform: scale(1.03);
}

.qty-selector {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 10px;
    gap: 12px;
}

.qty-btn {
    width: 28px;
    height: 28px;
    border: none;
    background: #8b8b8b;
    color: white;
    font-size: 18px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
}

.qty-btn:hover {
    background: #000;
}

.qty-number {
    font-size: 18px;
    font-weight: bold;
}



.img-agotado {
  width: 20%;
  height: 20%;
  object-fit: cover; /* rellena todo el contenedor */
  object-position: center;
  display: block;
}

/* ================================
LOGIN
================================ */
.login-form-container {
display: flex;
flex-direction: column;
gap: 20px;
background-color: #ffffff;
padding: 25px;
border-radius: 10px;
width: 60%;
margin: 20px auto;
box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

.login-form-container label {
font-weight: bold;
text-align: left;
}

.login-form-container input {
padding: 10px;
border-radius: 6px;
border: 1px solid #ccc;
width: 100%;
}

.login-form-container .login-links {
display: flex;
flex-direction: column;
gap: 8px;
font-size: 14px;
}

.login-form-container .login-links a {
color: #009bb3;
text-decoration: none;
}

.login-form-container .login-links a:hover {
text-decoration: underline;
}

.login-button {
padding: 12px;
border: none;
border-radius: 6px;
background-color: #009bb3;
color: #fff;
cursor: pointer;
width: 100%;
}

.login-button:hover {
background-color: #007a91;
}


/* ===== USER PANEL ===== */
.user-panel {
    background: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 0 10px #ccc;
    max-width: auto;
    margin: auto;
}

.panel-menu {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.panel-menu button {
    flex: 1;
    padding: 10px;
    border: none;
    background: #ddd;
    font-weight: bold;
    cursor: pointer;
    border-radius: 6px;
}

.panel-menu button.active {
    background: #009bb3;
    color: white;
}

.user-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.user-form input {
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 6px;
}

.btn-save {
    padding: 12px;
    background: #1ca900;
    color: white;
    border: none;
    border-radius: 6px;
    font-weight: bold;
    cursor: pointer;
}

/* Icono login rojo */
.login-active {
   /* filter: hue-rotate(-40deg) saturate(3);*/
}

/* Botones del formulario de usuario */
.form-btn {
    flex: 1;
    padding: 12px;
    border-radius: 6px;
    font-weight: bold;
    border: none;
    cursor: pointer;
    color: white;
    text-align: center;
}

/* Botón Cancelar */
.form-btn.cancel {
    background: #d9534f;
}

/* Botón Grabar */
.form-btn.save {
    background: #1ca900;
}

/* Hover efecto */
.form-btn:hover {
    opacity: 0.9;
}

/* Mensajes de formulario */
#form-message.success {
    color: #2b7a2b;
    font-weight: bold;
    margin-top: 15px;
}
#form-message.error {
    color: #d9534f;
    font-weight: bold;
    margin-top: 15px;
}
/* Mensajes de formulario */
#form-message {
    position: relative;
    text-align: center;
    font-weight: bold;
    margin-top: 15px;
    opacity: 0;
    transition: opacity 0.3s ease, transform 0.6s ease;
}

/* Estilos según tipo */
#form-message.success {
    color: #2b7a2b;
}

#form-message.error {
    color: #d9534f;
}

/* Animación tipo tooltip */
@keyframes float-up {
    0% {
        opacity: 0;
        transform: translateY(0);
    }
    10% {
        opacity: 1;
        transform: translateY(-10px);
    }
    90% {
        opacity: 1;
        transform: translateY(-10px);
    }
    100% {
        opacity: 0;
        transform: translateY(-40px);
    }
}

/* Clase para activar animación */
#form-message.show {
    animation: float-up 2s forwards;
}

/* Contenedor del icono para poder posicionar el badge */
#carrito-wrapper {
    position: relative;
    display: inline-block;
}

/* Icono de carrito */
#carrito-icon {
    width: 32px;
    height: 32px;
}

/* Badge del carrito */
.carrito-badge {
    position: absolute;
    top: -6px;          /* ajusta según tamaño del icono */
    right: -6px;        /* ajusta según tamaño del icono */
    background-color: red;
    color: white;
    font-size: 10px;
    font-weight: bold;
    padding: 3px 6px;
    border-radius: 50%;
    display: none;      /* se muestra sólo si hay productos */
}

/* -------------------------- */
/* Contenedor principal del carrito */
.cart-container {
    width: 100%;
    max-width: 1000px;
    margin: 20px auto;
    padding: 10px;
}

/* Tabla de escritorio */
/* Tabla para escritorio */
.cart-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
    background: #ffffff;
    border-radius: 10px;
    overflow: hidden;
    font-size: 0.95rem;
}

.cart-table thead {
    background: #009bb3;
}

.cart-table th {
    padding: 12px;
    text-align: right;
    font-weight: 600;
    color: #333;
    border-bottom: 1px solid #ddd;
}

.cart-table td {
    padding: 12px;
    border-bottom: 1px solid #eee;
    vertical-align: middle;
}



.cart-img {
    max-width: 60px;
    height: auto;
}

/* Tarjetas para móvil - ocultas por defecto */
.cart-cards {
    display: none;
}

.btn {
    padding: 6px 14px;
    font-size: 14px;
    border-radius: 6px;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
    font-weight: 500;
}

/* Botón Ver Líneas – elegante, corporativo */
.btn-ver {
    background: #009bb3;
    color: white;
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}
.btn-ver:hover {
    background: #005fcc;
    transform: translateY(-1px);
}

/* Botón Anular – suave pero con tono de alerta */
.btn-anular {
    background: #ff3b30;
    color: white;
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}
.btn-anular:hover {
    background: #d92a22;
    transform: translateY(-1px);
}

/* CONTENEDOR ÚNICO DE LA TABLA */
.pedidos-table-container {
    max-width: auto;
    margin: 20px auto;
    padding: 10px;
}

/* Todo lo que está dentro de .pedidos-table SOLO afecta a esta tabla */
.pedidos-table {
    width: 100%;
    border-collapse: collapse;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 14px;
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}

/* Encabezado */
.pedidos-table thead tr {
    background: #009bb3;
    color: white;
    text-align: left;
}

.pedidos-table th {
    padding: 12px 10px;
    font-weight: 600;
    letter-spacing: 0.5px;
}

/* Filas */
.pedidos-table td {
    padding: 10px 8px;
    border-bottom: 1px solid #e5e5e5;
}

/* Alternancia */
.pedidos-table tbody tr:nth-child(even) {
    background: #f5faff;
}

/* Hover */
.pedidos-table tbody tr:hover {
    background: #e8f2ff;
    cursor: pointer;
}

/* Alineaciones */
.pedidos-table td.num,
.pedidos-table th.num {
    text-align: right;
}

.pedidos-table td.center,
.pedidos-table th.center {
    text-align: center;
}

.pedido-descripcion td {
    background: #f7f7f7;
    padding: 10px 12px;
    font-size: 14px;
    border-bottom: none;
}

.pedido-datos td {
    border-top: none;
    padding-top: 6px;
}

/* ==== PANEL DE FAMILIAS HORIZONTAL PEGADO AL HEADER ==== */
.top-familias {
    width: 100%;
    display: flex;
    flex-direction: row;
    gap: 8px;
    padding: 6px 8px;       /* Menos padding → más cerca del header */
    margin-top: 0;          /* Asegura que no se separe del header */
    background: #fff;
    overflow-x: auto;
    overflow-y: hidden;
    /*border-bottom: 1px solid #ddd;*/
    scroll-snap-type: x mandatory;
    
}

.top-familias a {
    flex: 0 0 auto;
    scroll-snap-align: center;
}

.top-familias img {
    width: 80px;            /* Un poco más compacto */
    height: 80px;
    object-fit: contain;
    border-radius: 8px;
    transition: transform 0.2s;
    
}

.top-familias img:hover {
    /*transform: scale(1.1);*/
}

/* Ocultar panel lateral si quedaba algo */
.left-panel {
    display: none !important;
}

/* Asegura que el contenido arranca justo debajo */
.container {
    display: flex;
    flex-direction: column;
    margin-top: 0;
    padding-top: 0;
}

.cookie-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: #fff;
    border-top: 1px solid #ccc;
    box-shadow: 0 -2px 6px rgba(0,0,0,0.1);
    padding: 12px 16px;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    font-size: 14px;
}

.cookie-banner .cookie-content {
    max-width: 1000px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    text-align: center;
}

.cookie-banner .cookie-buttons {
    display: flex;
    gap: 8px;
    justify-content: center;
}

.cookie-banner button {
    padding: 6px 12px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    font-weight: 500;
}

.cookie-banner button#accept-cookies {
    background-color: #1ca900;
    color: #fff;
}

.cookie-banner button#reject-cookies {
    background-color: #d9534f;
    color: #fff;
}

.cookie-banner button#config-cookies {
    background-color: #f0ad4e;
    color: #fff;
}

.menu-options {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
}


.main-content {
    display: flex;
    gap: 20px;
    align-items: flex-start;
}

.ediciones-aside {
    display: block;
    width: 220px;
    background: #f8f8f8;
    padding: 10px;
    border-radius: 6px;
}

.carousel {
    flex: 1;
}


/* Responsive: móvil */
@media screen and (max-width: 768px) {

    .ediciones-aside.con-edicion {
        display: none;
    }

     .menu-options {
        grid-template-columns: 1fr;
    }

    /* Ocultar tabla tradicional en móvil */
    .cart-table {
        display: none;
    }

    /* Mostrar tarjetas en móvil */
    .cart-cards {
        display: block;
    }

    .cart-item-card {
        display: flex;
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        padding: 10px;
        margin-bottom: 15px;
        border: 1px solid #ccc;
        border-radius: 8px;
        box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    }

    .cart-item-card img {
        width: 80px;
        height: auto;
        border-radius: 4px;
        margin-right: 10px;
    }

    .cart-item-info {
        flex: 1;
        display: flex;
        flex-direction: column;
        justify-content: center;
        gap: 5px;
    }

    .cart-item-info div {
        font-size: 0.9em;
    }

    .cart-item-info strong {
        font-weight: bold;
    }

    .cart-item-actions {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 5px;
    }

    .cart-item-actions button {
        background: none;
        border: none;
        cursor: pointer;
        padding: 5px;
    }

    .top-familias img {
        width: 60px;            /* Un poco más compacto */
        height: 60px;
        object-fit: contain;
        border-radius: 8px;
        transition: transform 0.2s;
    }
   .ediciones-aside {
        position: fixed;
        top: 60px;
        left: 0;
        right: 0;
        max-height: 60vh;
        overflow-y: auto;
        background: white;
        z-index: 9999;
        box-shadow: 0 8px 20px rgba(0,0,0,0.25);
        display: none;           /* oculto */
    }

    .ediciones-aside.open {
        display: block;
    }

    .toggle-ediciones {
        display: block;
        position: sticky;
        top: 0;
        z-index: 10000;
        background: #009bb3;
        color: white;
        border: none;
        padding: 10px;
        width: 100%;
        font-size: 16px;
    }

    .pedido-descripcion td {
    background: #f7f7f7;
    padding: 10px 12px;
    font-size: 8px;
    border-bottom: none;
}


}


/* Footer fijo en escritorio */
.cart-footer-fixed {
    position: sticky;
    bottom: 0;
    background: #ffffffee;
    backdrop-filter: blur(5px);
    padding: 15px 20px;
    border-top: 2px solid #ddd;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 1.3em;
    margin-top: 20px;
}

/* Total */
.cart-footer-total {
    font-size: 1.2em;
}

/* Botón Finalizar */
.btn-finalizar {
    background: #0078ff;
    color: white;
    border: none;
    padding: 12px 20px;
    font-size: 1em;
    border-radius: 6px;
    cursor: pointer;
    transition: 0.2s;
}

.btn-finalizar:hover {
    background: #005fcc;
}

@media (max-width: 850px) {
    .cart-footer-fixed {
        flex-direction: column;
        gap: 12px;
        text-align: center;
        font-size: 1.1em;
    }

    .btn-finalizar {
        width: 100%;
        padding: 14px;
        font-size: 1.1em;
    }
}

.cart-footer-fixed {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: #ffffff;
    border-top: 2px solid #e3e3e3;
    padding: 14px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 1.3em;
    font-weight: bold;
    z-index: 9999;
}

/* Botón finalizar */
.btn-finalizar {
    background-color: #007bff;
    color: white;
    border: none;
    padding: 12px 22px;
    border-radius: 8px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
}

.btn-finalizar:hover {
    background-color: #0056b3;
}

/* ====== MODO APP PARA MÓVIL ====== */
@media (max-width: 850px) {
    .cart-footer-fixed {
        visibility: hidden;
        flex-direction: column;
        text-align: center;
        padding: 16px 10px;
        font-size: 1.2em;
        gap: 12px;
    }

    .btn-finalizar {
        width: 100%;
        padding: 14px;
        font-size: 1.2em;
        border-radius: 10px;
    }
}
/* ================================
RESPONSIVE GENERALIZADO
================================ */
@media (max-width: 1024px) {
.container { flex-direction: column; }
.left-panel {
width: 100%;
flex-direction: row;
flex-wrap: nowrap;
overflow-x: auto;
gap: 10px;
padding: 10px 0;
margin-bottom: 20px;
justify-content: flex-start;
-webkit-overflow-scrolling: touch;
}
.left-panel::-webkit-scrollbar { display: none; }
.left-panel { -ms-overflow-style: none; scrollbar-width: none; }

.main-button { width: 120px; height: 60px; }
.carousel { width: 100%; }


}

@media (max-width: 768px) {
.logo img { height: 60px; }
.main-button { width: 100px; height: 55px; }
.search-form input[type="text"] { font-size: 14px; padding: 8px 10px; }
.search-form button { font-size: 14px; padding: 6px 10px; }
}

@media (max-width: 600px) {
.logo img { height: 50px; }
.main-button { width: 90px; height: 50px; }
.search-form { max-width: 70%; }
}

@media (max-width: 480px) {
.main-button { width: 80px; height: 45px; }
.search-form input[type="text"] { font-size: 12px; }
.search-form button { font-size: 12px; }
.card img { height: 120px; }
}

@media(max-width:800px){
    .main-content { flex-direction:column; }
    aside.ediciones-aside { width:100%; max-width:none; margin-bottom:20px; }
}
.edicion-item.active { background:#009bb3; color:white; }