/* ====================================================== 
VARIABLES DE COLOR (PALETA 1) 
====================================================== */
:root {
	--primary: #ededed;
	--bg: #b7dffd; 	/* Fondo gris muy claro */
	--title: #443030; /* Titulos */
	--subtitle: #877a7a; /* Subtitulos */
	--text: #aaa; 	/* Texto gris oscuro */
}

/* ====================================================== 
GENERALES 
====================================================== */
/* Eliminar márgenes y permitir que la página use el 100% de altura */
html, body {
    height: 100%;
    margin: 0;
}

body {
	background: var(--bg);
	margin: 0;
	padding: 0;
	font-family: system-ui, sans-serif;
	/* Convertir el body en un contenedor vertical con flexbox */
	display: flex;
    flex-direction: column;
    min-height: 100vh;
}

main {
    flex: 1;
}


section {
	margin: 0 auto;
	background: whitesmoke;
	width: 90%;
	text-align: center;
	display: none; /* Por defecto todas las secciones ocultas */
}

h2 {
	color: var(--subtitle);
	font-family: emoji;
	margin: 0 auto;
}

p {
  font-family: "Courier New", "Roboto Mono", monospace;
  font-style: normal;
}

/* ====================================================== 
MENU 
====================================================== */
nav ul {
	margin: 1px auto;
	padding: 1px;
	list-style: none;
	text-align: center;
}

nav ul li {
	width: 65px;
	margin: 10px;
	display: inline-block;
}

nav ul li a img {
	width: 60px;
	height: 60px;
	border-radius: 30px;
	border: 2px dashed whitesmoke;
	transition: all 0.3s ease;
}

/* Hover nav: iluminar y agrandar */
nav ul li a:hover img {
	transform: scale(1.1);
	filter: brightness(1.2);
}

nav ul li a.active img {
	transform: scale(1.05);
	filter: brightness(1.1);
}

/* ====================================================== 
HOME 
====================================================== */
section#home .home-title {
	align-content: center;
	height: 400px;
}

section#home .home-title h1 {
	color: var(--title);
	font-family: system-ui;
	font-size: 40px;
	font-weight: bolder;
	margin: 0 auto;
}

section#home .home-image img {
	width: 100%;
	transition: all 0.3s ease;
}

/* ====================================================== 
HOME RESPONSIVE - cambiar layout para pantallas grandes
====================================================== */
/* HOME RESPONSIVE - ajustar espacio y layout */
@media (min-width: 900px) {
    section#home {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 20px;
    }

    section#home .home-title {
        width: 50%;
        text-align: left;
        padding-left: 20px; /* espacio extra a la izquierda */
    }

    section#home .home-image {
        width: 50%;
    }
}

/* ====================================================== 
PRODUCTOS 
====================================================== */
.products-container {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 10px;
}

article.product-item {
	background: var(--primary);
	border-radius: 5px;
	margin: 10px;
	flex: 1 1 calc(100% - 20px);
	max-width: calc(100% - 20px);
	transition: all 0.3s ease;
}

article .name-product-item img {
	width: 80%;
	min-width: unset;
	border-radius: 5px;
	transition: all 0.3s ease;
}

article .name-product-item img:hover {
	transform: scale(1.05);
}

article .name-product-item figcaption {
	width: 85%;
	margin: 0 auto;	
	font-family: math;
	font-size: smaller;
}

article .detail-product-item p {
	display: inline-block;
	font-size: smaller;
}

article .add-product-item input {
	width: 90%;
	margin-bottom: 5px;
	border: 2px solid #d0d0d0;
	border-radius: 8px;
	background: #ffffff;
	font-size: 16px;
	color: #443030;
	outline: none;
	transition: all 0.3s ease;
	box-sizing: border-box;
}

article .add-product-item input::placeholder {
	color: #877a7a;   
	font-family: monospace; 
	font-size: 12px;    
	font-style: italic;  
	opacity: 0.7;      
}

/* Botones de cantidad circulares */
article .add-product-item .btn-circle {
	width: 40px;
	height: 40px;
	border-radius: 50%;
	background: #4a90e2;
	color: white;
	font-weight: bold;
	border: none;
	cursor: pointer;
	transition: all 0.3s ease;
}

article .add-product-item .btn-circle:hover {
	background: #357ab8;
	transform: scale(1.1);
}

/* Botón eliminar producto */
article.product-item .btn-delete {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #e74c3c; /* rojo */
    color: white;
    font-weight: bold;
    border: none;
    cursor: pointer;
    font-size: 20px;
    line-height: 40px;
    text-align: center;
    transition: all 0.3s ease;
    margin-left: 5px;
}

article.product-item .btn-delete:hover {
    background: #c0392b;
    transform: scale(1.1);
}

/* Media query productos: 2,3,4 columnas */
@media (min-width: 260px) {
	article.product-item {
		flex: 1 1 calc(10% - 5px);
		min-width: calc(30% - 5px);
	}

	article.name-product-item{
		min-height: 190px;
	}

	article .detail-product-item p {
	display: inline-block;
	font-size: small;
	}

	article .name-product-item figcaption {
	width: 85%;
	margin: 0 auto;	
	font-family: math;
	font-size: small;
	}

}

@media (min-width: 420px) {
	article.product-item {
		flex: 0 1 calc(10% - 5px);
		min-width: calc(25% - 5px);
	}
}

@media (min-width: 600px) {
	article.product-item {
		flex: 0 1 calc(10% - 10px);
		min-width: calc(20% - 10px);
	}
}

@media (min-width: 900px) {
	article.product-item {
		flex: 0 1 calc(10% - 20px);
		max-width: calc(25% - 20px);
	}
}

@media (min-width: 1200px) {
	article.product-item {
		flex: 0 1 calc(10% - 20px);
		max-width: calc(33% - 20px);
	}
}

/* Request container */
#products .request-container {
	background: var(--primary);
	width: 90%;
	margin: 10px auto;
	border-radius: 5px;
	padding: 10px 0;
}

/* ================================
Formulario de datos del cliente
================================ */
.customer-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 20px auto;
    min-width: 65%;    
    max-width: 400px;
    background: var(--primary);
    padding: 15px;
    border-radius: 8px;
}

.customer-form h3 {
    text-align: center;
    margin-bottom: 10px;
    color: var(--title);
}

.customer-form input,
.customer-form textarea {
    width: 90%;
    margin: auto;
    padding: 10px;
    border-radius: 6px;
    border: 1px solid #ccc;
    font-size: 14px;
    background: #ffffff;
}


/* Div para listado de pedido */
#products .request-container #pedido-listado {
    background: white;
    padding: 10px;
    border-radius: 8px;
    border: 1px solid #ccc;
    font-size: 16px;
}

/* ====================================================== 
Se usan para gestionar el pedido listado a traves del JS
====================================================== */


.linea-item {
    padding: 8px;
    border-bottom: 1px solid #eee;
}

.linea-item:nth-child(odd) {
    background: #f7f7f7;
}

.linea-item:nth-child(even) {
    background: #ffffff;
}

.linea-item:last-child {
    border-bottom: none;
}

.linea-cantidad {
    font-weight: bold;
    color: #1b5e20;
}

.linea-producto {
    margin-left: 5px;
}

.linea-nombre{
	font-weight: bold;
	font-size: larger;
}

.linea-subtotal{
	font-weight: bold;
	color: #1b5e20;
}

.linea-total{
	font-weight: bold;
	font-size: larger;
}

.separador {
    color: #888;
    margin-left: 5px;
}

.clear-btn {
    background-color: #b30000 !important;
    border-color: #800000 !important;
}

.clear-btn:hover {
    background-color: #cc0000 !important;
}

#products .btn-primary {
	display: block;
	background-color: #25D366; 
	color: white;
	padding: 12px 22px;
	font-size: 18px;
	font-weight: bold;
	border: none;
	border-radius: 10px;
	cursor: pointer;
	width: 80%;
	max-width: 300px;
	margin: 0 auto;
	margin-top: 5px;
	margin-bottom: 10px;
	box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
	transition: all 0.25s ease;
}

#products .btn-primary:hover {
	background: #1ebe5d;
	transform: translateY(-2px);
	box-shadow: 0 6px 14px rgba(0, 0, 0, 0.25);
}

#products .btn-primary:active {
	background: #17a754;
	transform: translateY(0px);
	box-shadow: 0 3px 6px rgba(0, 0, 0, 0.15);
}


/* ====================================================== 
CONTACT 
====================================================== */
section#contact{
	height: 100%;
}

.contact-container {
	width: 95%;
	max-width: 500px;
	margin: 20px auto;
	padding: 20px;
	border-radius: 12px;
	box-sizing: border-box;
}

.contact-container h2 {
	font-family: system-ui;
	color: var(--title);
	text-align: center;
	margin-bottom: 5px;
	font-size: 22px;
}

.contact-container p {
	font-family: cursive;
	color: var(--subtitle);
	text-align: center;
	margin-bottom: 20px;
	font-size: 14px;
}

.contact-container .form-group {
	margin-bottom: 15px;
}

.contact-container label {
	display: block;
	font-size: 14px;
	font-weight: 600;
	color: var(--title);
	margin-bottom: 5px;
	font-family: monospace;
}

.contact-container input,
.contact-container textarea {
	width: 100%;
	padding: 14px;
	border: 2px solid #d0d0d0;
	border-radius: 8px;
	background: #ffffff;
	color: #443030;
	font-size: 16px;
	font-family: inherit;
	outline: none;
	transition: all 0.3s ease;
	box-sizing: border-box;
}

.contact-container input::placeholder,
.contact-container textarea::placeholder {
	color: #877a7a;
	font-family: monospace;
	font-size: 14px;
	opacity: 0.7;
}

.contact-container input:focus,
.contact-container textarea:focus {
	border-color: #2196F3;
	box-shadow: 0 0 6px rgba(33,150,243,0.3);
}

.contact-container textarea {
	min-height: 140px;
	resize: vertical;
}

.contact-container .btn-primary {
	width: 100%;
	padding: 14px 0;
	font-size: 18px;
	font-weight: bold;
	border-radius: 10px;
	background: #2196F3;
	color: white;
	cursor: pointer;
	border: none;
	margin-top: 10px;
	box-shadow: 0 4px 10px rgba(0,0,0,0.2);
	transition: all 0.25s ease;
}

.contact-container .btn-primary:hover {
	background: #1E88E5;
	transform: translateY(-2px);
	box-shadow: 0 6px 14px rgba(0,0,0,0.3);
}

.contact-container .btn-primary:active {
	background: #1976D2;
	transform: translateY(0);
	box-shadow: 0 3px 6px rgba(0,0,0,0.15);
}

/* ====================================================== 
FOOTER 
====================================================== */
footer {
	background: whitesmoke;
	padding: 20px 0;
	text-align: center;
	font-family: monospace;
	color: var(--title);
}

footer .footer-container {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 15px;
	margin-bottom: 10px;
}

footer .footer-item h3 {
	margin: 0;
	font-size: 14px;
	color: var(--subtitle);
}

footer .footer-item p {
	margin: 3px 0 0 0;
	font-size: 14px;
}

footer .footer-item a {
	color: #2196F3;
	text-decoration: none;
	transition: all 0.3s ease;
}

footer .footer-item a:hover {
	color: #1E88E5;
	text-decoration: underline;
}

footer .footer-copy {
	font-size: 12px;
	color: #877a7a;
}

@media (min-width: 600px) {
	footer .footer-container {
		flex-direction: row;
		justify-content: center;
		gap: 60px;
	}
}

footer .footer-dev {
	font-size: 12px;
	color: #877a7a;
	margin-top: 5px;
}

footer .footer-dev a {
	color: #2196F3;
	text-decoration: none;
	transition: all 0.3s ease;
}

footer .footer-dev a:hover {
	color: #1E88E5;
	text-decoration: underline;
}


/* ================================================================= 
Se ocultan las secciones principales y se gestionan en el main.js 
para arrancar con solo el home visible entre home, products y contact
===================================================================== */

/* Solo la sección activa se muestra */
section.active {
    display: block;
}

/* Opcional: efecto de transición */
section {
    transition: all 0.3s ease;
}



/* ====================================================== 
Modales que se gestionan con los desde el main.js 
====================================================== */


.toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: #323232;
    color: white;
    padding: 12px 18px;
    border-radius: 6px;
    opacity: 0;
    transition: opacity .4s ease;
    pointer-events: none;
    z-index: 9999;
}
.toast.show {
    opacity: 1;
}


.modal-bg {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.65);
    display:flex;
    justify-content:center;
    align-items:center;
    z-index: 99999;
}
.modal {
    background: #fff;
    padding:20px;
    border-radius: 10px;
    width:280px;
    text-align:center;
}
.modal button {
    margin: 8px;
}

#modal-confirm{
	display: none;
}


/* ======== COBERTURA SECTION ======== */

.coverage-section {
    padding: 60px 20px;
    background: #f8f8f8;
}

.coverage-container {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    align-items: center;
}

.coverage-title {
    font-size: 2rem;
    margin-bottom: 15px;
}

.coverage-description {
    font-size: 1rem;
    margin-bottom: 20px;
    line-height: 1.6;
}

.coverage-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.coverage-list li {
    padding: 8px 0;
    font-size: 0.95rem;
}

.coverage-map iframe {
    width: 100%;
    height: 350px;
    border: none;
    border-radius: 10px;
}


/* ======== RESPONSIVE COBERTURA======== */

@media (max-width: 900px) {
    .coverage-container {
        grid-template-columns: 1fr;
        text-align: center;
    }

    .coverage-text {
        order: 2;
    }

    .coverage-map {
        order: 1;
    }

    .coverage-map iframe {
        height: 300px;
    }
}


/* ======== Cookie banner ======== */

.cookie-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: #222;
    color: #fff;
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
    z-index: 9999;
    box-sizing: border-box;
}

.cookie-banner a {
    color: #4fc3f7;
    text-decoration: underline;
}

.cookie-banner button {
    background: #4fc3f7;
    border: none;
    color: #000;
    padding: 8px 14px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
}

/* ======== privacy ======== */

#privacy {
    background: whitesmoke;
}

.privacy-container {
    max-width: 700px;
    margin: 40px auto;
    padding: 20px;
    text-align: left;
    position: relative;
}

.privacy-close {
    position: absolute;
    top: 10px;
    right: 10px;
    background: #e74c3c;
    border: none;
    color: white;
    padding: 6px 10px;
    border-radius: 6px;
    cursor: pointer;
}

/* ==== Terms =====*/

.legal-container {
    max-width: 800px;
    margin: 40px auto;
    padding: 20px;
    position: relative;
}

.legal-close {
    position: absolute;
    top: 10px;
    right: 10px;
    background: #e74c3c;
    color: #fff;
    border: none;
    padding: 6px 10px;
    border-radius: 6px;
    cursor: pointer;
}



/* ============================================================
   stock
   ============================================================ */

/* --- Badge de stock ---------------------------------------- */
.stock-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 20px;
  margin-top: 4px;
  letter-spacing: 0.3px;
}

.stock-badge.ok {
  background: #e8f5e9;
  color: #2e7d32;
}

.stock-badge.low {
  background: #fff8e1;
  color: #f57f17;
}

.stock-badge.out {
  background: #ffebee;
  color: #c62828;
}

/* --- Estado de carga --------------------------------------- */
.loading-products {
  width: 100%;
  text-align: center;
  padding: 40px 20px;
  color: #888;
  font-size: 15px;
}

.loading-products.error {
  color: #c62828;
}

.loading-products .btn-primary {
  margin-top: 12px;
}

/* --- Producto agotado: opacidad reducida ------------------- */
.product-item:has([disabled]) {
  opacity: 0.55;
  pointer-events: none;
}

.product-item:has([disabled]) .btn-delete {
  pointer-events: auto; /* el "-" sigue funcionando para limpiar */
  opacity: 1;
}
