*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

a { color: inherit; text-decoration: none; }

:root {
    --verde-oscuro:  #1b4332;
    --verde-medio:   #2d6a4f;
    --verde-claro:   #40916c;
    --verde-suave:   #95d5b2;
    --verde-palido:  #d8f3dc;
    --crema:         #f6fbf4;
    --texto-oscuro:  #1b2d24;
    --texto-medio:   #3d5a47;
    --blanco:        #ffffff;
    --gris-borde:    #e0ebe3;
    --sombra:        rgba(27, 67, 50, 0.10);
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--crema);
    color: var(--texto-oscuro);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ── Navbar ── */
.navbar {
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 3rem;
    height: 64px;
    background: rgba(255,255,255,0.92);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--gris-borde);
}

.navbar-marca {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
}

.logo-icono { font-size: 1.4rem; }

.logo-nombre {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--texto-oscuro);
    letter-spacing: -0.02em;
}

.logo-nombre span { color: var(--verde-claro); }

.navbar-nav { display: flex; gap: 1.5rem; }

.nav-link {
    text-decoration: none;
    color: var(--texto-medio);
    font-size: 0.9rem;
    font-weight: 600;
    transition: color 0.2s;
}

.nav-link:hover { color: var(--verde-claro); }

.navbar-acciones {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.saludo { font-size: 0.88rem; color: var(--texto-medio); }

.btn-logout {
    padding: 0.45rem 1rem;
    background: transparent;
    border: 1.5px solid var(--gris-borde);
    border-radius: 8px;
    color: var(--texto-medio);
    font-size: 0.85rem;
    cursor: pointer;
    font-weight: 600;
    transition: border-color 0.2s, color 0.2s;
}

.btn-logout:hover { border-color: var(--verde-claro); color: var(--verde-claro); }

/* ── Breadcrumb header ── */
.pagina-header {
    background: linear-gradient(135deg, var(--verde-oscuro) 0%, var(--verde-medio) 100%);
    padding: 2rem 3rem;
    color: var(--blanco);
}

.breadcrumb {
    font-size: 0.82rem;
    color: rgba(255,255,255,0.6);
    margin-bottom: 0.5rem;
}

.breadcrumb a {
    color: rgba(255,255,255,0.6);
    text-decoration: none;
}

.breadcrumb a:hover { color: var(--verde-suave); }

.breadcrumb span { color: rgba(255,255,255,0.9); }

.pagina-titulo {
    font-size: 1.8rem;
    font-weight: 800;
    letter-spacing: -0.03em;
}

/* ── Contenido principal ── */
.detalle-wrapper {
    flex: 1;
    padding: 3rem;
    max-width: 1000px;
    width: 100%;
    margin: 0 auto;
}

/* ── Grid dos columnas ── */
.detalle-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
    align-items: start;
    margin-bottom: 3rem;
}

/* ── Panel visual (izquierdo) ── */
.detalle-visual {
    background: linear-gradient(145deg, var(--verde-palido) 0%, #b7e4c7 100%);
    border: 1px solid var(--gris-borde);
    border-radius: 24px;
    aspect-ratio: 1 / 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 8rem;
    box-shadow: 0 4px 20px var(--sombra);
}

/* ── Panel info (derecho) ── */
.detalle-info {
    display: flex;
    flex-direction: column;
    gap: 1.4rem;
}

.categoria-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: var(--verde-palido);
    color: var(--verde-oscuro);
    font-size: 0.75rem;
    font-weight: 700;
    padding: 0.3rem 0.85rem;
    border-radius: 999px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    width: fit-content;
}

.producto-nombre {
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: var(--texto-oscuro);
    line-height: 1.15;
}

.producto-descripcion {
    font-size: 0.96rem;
    color: var(--texto-medio);
    line-height: 1.8;
}

/* ── Caja de precio ── */
.precio-box {
    background: var(--blanco);
    border: 1px solid var(--gris-borde);
    border-radius: 16px;
    padding: 1.25rem 1.5rem;
    box-shadow: 0 2px 8px var(--sombra);
}

.precio-label {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--texto-medio);
    text-transform: uppercase;
    letter-spacing: 0.07em;
    margin-bottom: 0.4rem;
}

.precio-monto {
    font-size: 2.4rem;
    font-weight: 800;
    color: var(--verde-oscuro);
    line-height: 1;
}

.precio-unidad {
    font-size: 0.85rem;
    color: var(--texto-medio);
    margin-top: 0.25rem;
}

/* ── Selector de cantidad ── */
.cantidad-box {
    background: var(--blanco);
    border: 1px solid var(--gris-borde);
    border-radius: 16px;
    padding: 1.25rem 1.5rem;
    box-shadow: 0 2px 8px var(--sombra);
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.cantidad-label {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--texto-medio);
    text-transform: uppercase;
    letter-spacing: 0.07em;
}

.cantidad-control {
    display: flex;
    align-items: center;
    gap: 0;
    width: fit-content;
    border: 1.5px solid var(--gris-borde);
    border-radius: 10px;
    overflow: hidden;
}

.cantidad-btn {
    width: 40px;
    height: 40px;
    background: var(--crema);
    border: none;
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--verde-medio);
    cursor: pointer;
    transition: background 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.cantidad-btn:hover { background: var(--verde-palido); }

.cantidad-input {
    width: 64px;
    height: 40px;
    border: none;
    border-left: 1.5px solid var(--gris-borde);
    border-right: 1.5px solid var(--gris-borde);
    text-align: center;
    font-size: 1rem;
    font-weight: 700;
    color: var(--texto-oscuro);
    outline: none;
    -moz-appearance: textfield;
}

.cantidad-input::-webkit-outer-spin-button,
.cantidad-input::-webkit-inner-spin-button { -webkit-appearance: none; }

.cantidad-total {
    font-size: 0.92rem;
    color: var(--texto-medio);
}

.cantidad-total strong {
    color: var(--verde-oscuro);
    font-size: 1.1rem;
}

/* ── Icono carrito en navbar ── */
.nav-carrito {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.45rem 0.9rem;
    border: 1.5px solid var(--gris-borde);
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--texto-medio);
    text-decoration: none;
    transition: border-color 0.2s, color 0.2s;
}
.nav-carrito:hover { border-color: var(--verde-claro); color: var(--verde-claro); }

.carrito-count {
    background: var(--gris-borde);
    color: var(--texto-oscuro);
    border-radius: 999px;
    padding: 0 0.45rem;
    font-size: 0.78rem;
    font-weight: 800;
    min-width: 1.3em;
    text-align: center;
    transition: background 0.2s, color 0.2s;
}
.carrito-count.tiene-items {
    background: var(--verde-medio);
    color: var(--blanco);
}

/* ── Toast ── */
.toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(2rem);
    background: var(--verde-oscuro);
    color: var(--blanco);
    padding: 0.75rem 1.5rem;
    border-radius: 10px;
    font-size: 0.92rem;
    font-weight: 600;
    box-shadow: 0 4px 16px rgba(27,67,50,0.3);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s, transform 0.25s;
    z-index: 200;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.toast.visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
    pointer-events: auto;
}

/* ── Botones de acción ── */
.acciones {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.btn-comprar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.9rem 1.5rem;
    background: var(--verde-medio);
    color: var(--blanco);
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
    font-family: inherit;
    box-shadow: 0 2px 10px rgba(27, 67, 50, 0.25);
    transition: background 0.2s, transform 0.15s, box-shadow 0.2s;
}

.btn-comprar:hover {
    background: var(--verde-oscuro);
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(27, 67, 50, 0.3);
}

.btn-volver {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.8rem 1.5rem;
    background: transparent;
    color: var(--texto-medio);
    border: 1.5px solid var(--gris-borde);
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 600;
    text-decoration: none;
    transition: border-color 0.2s, color 0.2s;
}

.btn-volver:hover {
    border-color: var(--verde-claro);
    color: var(--verde-claro);
}

/* ── Ficha técnica ── */
.ficha {
    background: var(--blanco);
    border: 1px solid var(--gris-borde);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 2px 8px var(--sombra);
}

.ficha-titulo {
    padding: 1rem 1.75rem;
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--texto-medio);
    background: var(--crema);
    border-bottom: 1px solid var(--gris-borde);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.ficha table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.92rem;
}

.ficha td {
    padding: 1rem 1.75rem;
    border-bottom: 1px solid var(--gris-borde);
}

.ficha tr:last-child td { border-bottom: none; }

.ficha td:first-child {
    font-weight: 600;
    color: var(--texto-medio);
    width: 38%;
}

.ficha td:last-child { color: var(--texto-oscuro); }

.badge-stock {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-weight: 700;
    font-size: 0.88rem;
}

.badge-stock.disponible { color: var(--verde-medio); }
.badge-stock.agotado    { color: #9ca3af; }

/* ── Footer ── */
.footer {
    padding: 1.5rem 3rem;
    border-top: 1px solid var(--gris-borde);
    text-align: center;
    font-size: 0.82rem;
    color: var(--texto-medio);
    background: var(--blanco);
    margin-top: auto;
}

/* ── Galería de imágenes ── */
.detalle-galeria {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.img-principal {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    border-radius: 24px;
    border: 1px solid var(--gris-borde);
    box-shadow: 0 4px 20px var(--sombra);
    background: var(--verde-palido);
    transition: opacity 0.2s;
    cursor: zoom-in;
}

/* ── Lightbox ── */
.lightbox {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 500;
    background: rgba(0, 0, 0, 0.85);
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    cursor: zoom-out;
}

.lightbox.activo {
    display: flex;
}

.lightbox-img {
    max-width: 90vw;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 12px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.5);
    cursor: default;
}

.lightbox-cerrar {
    position: absolute;
    top: 1.25rem;
    right: 1.5rem;
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: #fff;
    font-size: 2rem;
    line-height: 1;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.lightbox-cerrar:hover {
    background: rgba(255, 255, 255, 0.3);
}

.img-thumbs {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.img-thumb {
    width: 64px;
    height: 64px;
    object-fit: cover;
    border-radius: 10px;
    border: 2px solid var(--gris-borde);
    cursor: pointer;
    transition: border-color 0.2s, transform 0.15s;
    background: var(--verde-palido);
}

.img-thumb:hover  { border-color: var(--verde-claro); transform: scale(1.05); }
.img-thumb.activa { border-color: var(--verde-medio); box-shadow: 0 2px 8px var(--sombra); }

/* ── Responsive ── */
@media (max-width: 768px) {
    .navbar        { padding: 0 1.25rem; }
    .pagina-header { padding: 1.5rem; }
    .detalle-wrapper { padding: 1.5rem; }
    .detalle-grid  { grid-template-columns: 1fr; gap: 2rem; }
    .detalle-visual { aspect-ratio: 4 / 3; font-size: 5rem; }
    .producto-nombre { font-size: 1.6rem; }
    .precio-monto  { font-size: 2rem; }
}
