/* Estilos de la tienda (pagina publica y vista previa del panel). Todo cuelga de .tienda */
.tienda {
    --t-color: #8a4b2a;
    --t-logo: 70px;
    --t-titulo: 22px;
    --t-subtitulo: 15px;
    --t-detalle: 14px;
    --t-precio: 20px;
    --t-foto: 220px;
    --t-mini: 48px;
    --t-ancho: 280px;
    --t-fondo: #faf7f3;
    --t-texto: #2b2420;
    --t-suave: #7a6e66;
    --t-linea: #e8e0d8;

    color: var(--t-texto);
    background: var(--t-fondo);
    font-family: "Segoe UI", Arial, Helvetica, sans-serif;
}

.tienda * {
    box-sizing: border-box;
}

.tienda [hidden] {
    display: none !important;
}

body.tienda {
    margin: 0;
    min-height: 100vh;
}

/* Encabezado */
.t-header {
    background: #fff;
    border-bottom: 3px solid var(--t-color);
}

.t-header-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 16px;
}

.t-marca {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
    flex: 1;
}

.t-logo {
    height: var(--t-logo);
    width: auto;
    max-width: 50vw;
    object-fit: contain;
}

.t-nombre {
    margin: 0;
    font-size: 24px;
    color: var(--t-color);
    line-height: 1.2;
}

.t-bienvenida {
    margin: 2px 0 0;
    color: var(--t-suave);
    font-size: 14px;
}

.t-botones {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.t-boton {
    border: 1px solid var(--t-color);
    border-radius: 6px;
    padding: 8px 14px;
    background: #fff;
    color: var(--t-color);
    font: inherit;
    font-size: 14px;
    text-decoration: none;
    cursor: pointer;
    white-space: nowrap;
}

.t-boton.primario {
    background: var(--t-color);
    color: #fff;
}

.t-contador {
    display: inline-block;
    min-width: 20px;
    margin-left: 4px;
    padding: 0 6px;
    border-radius: 10px;
    background: #fff;
    color: var(--t-color);
    font-size: 12px;
    font-weight: 700;
    text-align: center;
}

/* Grilla de productos */
.t-main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px 16px 40px;
}

.t-grilla {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(var(--t-ancho), 100%), 1fr));
    gap: 18px;
}

.t-vacio {
    padding: 40px 0;
    color: var(--t-suave);
    text-align: center;
}

.t-card {
    display: flex;
    flex-direction: column;
    background: #fff;
    border: 1px solid var(--t-linea);
    border-radius: 10px;
    overflow: hidden;
}

.t-card.t-sin-stock .t-foto-img {
    opacity: 0.55;
}

/* Carrusel */
.t-foto {
    position: relative;
    height: var(--t-foto);
    background: #f1ece6;
}

.t-foto-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.t-sin-foto {
    height: 100%;
    display: grid;
    place-items: center;
    color: var(--t-suave);
    font-size: 13px;
}

.t-flecha {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 32px;
    height: 32px;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.85);
    color: var(--t-texto);
    font-size: 22px;
    line-height: 30px;
    cursor: pointer;
}

.t-prev { left: 8px; }
.t-next { right: 8px; }

.t-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    padding: 4px 10px;
    border-radius: 4px;
    background: #b42318;
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
}

.t-miniaturas {
    display: flex;
    gap: 6px;
    padding: 8px 10px 0;
    overflow-x: auto;
}

.t-mini {
    width: var(--t-mini);
    height: var(--t-mini);
    flex-shrink: 0;
    object-fit: cover;
    border: 2px solid transparent;
    border-radius: 6px;
    cursor: pointer;
    opacity: 0.7;
}

.t-mini.activa {
    border-color: var(--t-color);
    opacity: 1;
}

/* Cuerpo */
.t-cuerpo {
    display: flex;
    flex-direction: column;
    flex: 1;
    padding: 12px 14px 14px;
}

.t-titulo {
    margin: 0;
    font-size: var(--t-titulo);
    line-height: 1.2;
}

.t-subtitulo {
    margin: 4px 0 0;
    font-size: var(--t-subtitulo);
    font-weight: 600;
    color: var(--t-color);
}

.t-detalle {
    margin: 8px 0 0;
    font-size: var(--t-detalle);
    color: var(--t-suave);
    line-height: 1.45;
    white-space: pre-line;
}

.t-pie {
    margin-top: auto;
    padding-top: 12px;
}

.t-precio {
    display: block;
    margin-bottom: 10px;
    font-size: var(--t-precio);
    font-weight: 700;
}

.t-acciones {
    display: flex;
    gap: 8px;
}

.t-cantidad {
    display: flex;
    border: 1px solid var(--t-linea);
    border-radius: 6px;
    overflow: hidden;
}

.t-cantidad button {
    width: 34px;
    border: 0;
    background: #f5f1ec;
    font-size: 18px;
    cursor: pointer;
}

.t-cant {
    width: 48px;
    border: 0;
    text-align: center;
    font: inherit;
    -moz-appearance: textfield;
}

.t-cant::-webkit-outer-spin-button,
.t-cant::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.t-agregar {
    flex: 1;
    border: 0;
    border-radius: 6px;
    padding: 9px 12px;
    background: var(--t-color);
    color: #fff;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}

.t-agregar:disabled,
.t-cantidad button:disabled {
    background: #ccc;
    color: #fff;
    cursor: not-allowed;
}

.t-agregar.agregado {
    background: #2e7d32;
}

.t-footer {
    padding: 18px 16px 28px;
    color: var(--t-suave);
    font-size: 13px;
    text-align: center;
}

/* Carrito (panel lateral) */
.t-fondo-oscuro {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 20;
}

.t-carrito {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(420px, 100vw);
    display: flex;
    flex-direction: column;
    background: #fff;
    z-index: 21;
    box-shadow: -8px 0 24px rgba(0, 0, 0, 0.15);
}

.t-carrito-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid var(--t-linea);
}

.t-carrito-header h2 {
    margin: 0;
    font-size: 20px;
}

.t-cerrar {
    border: 0;
    background: none;
    font-size: 26px;
    cursor: pointer;
}

.t-carrito-cuerpo {
    flex: 1;
    overflow-y: auto;
    padding: 12px 16px 20px;
}

.t-item {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 4px 10px;
    padding: 10px 0;
    border-bottom: 1px solid var(--t-linea);
}

.t-item-titulo {
    font-weight: 600;
}

.t-item-sub {
    text-align: right;
    font-weight: 600;
}

.t-item-acciones {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--t-suave);
    font-size: 13px;
}

.t-item-quitar {
    border: 0;
    background: none;
    color: #b42318;
    font-size: 13px;
    cursor: pointer;
    padding: 0;
}

.t-total {
    display: flex;
    justify-content: space-between;
    margin: 14px 0;
    font-size: 20px;
    font-weight: 700;
}

.t-form label {
    display: block;
    margin-bottom: 10px;
    font-size: 13px;
    color: var(--t-suave);
}

.t-form input,
.t-form textarea {
    display: block;
    width: 100%;
    margin-top: 4px;
    padding: 9px 10px;
    border: 1px solid var(--t-linea);
    border-radius: 6px;
    font: inherit;
    color: var(--t-texto);
}

.t-form .t-agregar {
    width: 100%;
    padding: 12px;
    font-size: 16px;
}

.t-error {
    min-height: 18px;
    color: #b42318;
    font-size: 14px;
}

.t-ok {
    padding: 30px 6px;
    text-align: center;
}

.t-ok strong {
    display: block;
    margin-bottom: 8px;
    font-size: 22px;
    color: #2e7d32;
}

@media (max-width: 560px) {
    .t-header-inner {
        flex-wrap: wrap;
    }

    .t-botones {
        width: 100%;
        justify-content: flex-end;
    }

    .t-nombre {
        font-size: 20px;
    }
}
