/* ====== PRODUCTOS GRID ====== */
.productos-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.25rem;
}

/* Tablet: 3 columnas */
@media (max-width: 1023px) {
    .productos-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Móvil: 1 columna */
@media (max-width: 767px) {
    .productos-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
}

.producto-card {
    background: #ffffff;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s;
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 440px;
    text-decoration: none;
    color: inherit;
    align-items: stretch;
}

.producto-card,
.producto-card:link,
.producto-card:visited,
.producto-card:hover,
.producto-card:active {
    text-decoration: none !important;
    color: inherit !important;
}

.producto-card:hover {
    border-color: var(--green);
    box-shadow: 0 8px 25px rgba(46, 125, 50, 0.15);
    transform: translateY(-3px);
}

.producto-card .producto-imagen {
    width: 100%;
    height: 170px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
    overflow: hidden;
    background: #ffffff;
    flex-shrink: 0;
}

.producto-card .producto-imagen img {
    width: 70%;
    height: 100%;
    object-fit: contain;
    transition: transform 0.3s ease;
}

.producto-card:hover .producto-imagen img {
    transform: scale(1.04);
}

.producto-info {
    flex: 1;
    margin-bottom: 1rem;
    display: flex;
    flex-direction: column;
    width: 100%;
}

.producto-nombre,
.producto-categoria,
.producto-stock {
    color: inherit !important;
}

.producto-nombre {
    font-size: 1.05rem;
    margin-bottom: 0.4rem;
    line-height: 1.3;
    min-height: 2.6em;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ============================================================ */
/* ====== BADGES DE CATEGORÍA (chips blancos con borde verde) ====== */
/* ============================================================ */
.producto-categorias-wrap,
.producto-categorias {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 0.5rem;
}

.producto-badge-categoria {
    display: inline-block;
    background: #ffffff;
    color: var(--green, #2F6B4F);
    font-size: 0.68rem;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 999px;
    letter-spacing: 0.02em;
    line-height: 1.3;
    white-space: nowrap;
    text-transform: capitalize;
    border: 1.5px solid var(--green, #2F6B4F);
    transition: background 0.15s, color 0.15s;
}

.producto-badge-categoria:hover {
    background: var(--green, #2F6B4F);
    color: #ffffff;
}

/* Fallback: si en algún lado todavía se usa .producto-categoria sin badges */
.producto-categoria {
    font-size: 0.75rem;
    color: var(--ink-soft);
    margin-bottom: 0.5rem;
    display: inline-block;
    letter-spacing: 0.01em;
}

.producto-precio {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--green-dark) !important;
    margin: 0.4rem 0;
    font-family: 'Fraunces', Georgia, serif;
}

.producto-stock {
    font-size: 0.8rem;
    color: var(--green);
    margin-bottom: 1rem;
}

.producto-acciones {
    display: flex;
    gap: 0.5rem;
    margin-top: auto;
    width: 100%;
}

/* Botón hijo directo del card, ancho 100% */
.producto-card > .btn-agregar {
    width: 100%;
    min-height: 52px;
    background: var(--amber);
    color: var(--white);
    border: none;
    padding: 0.75rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-weight: 600;
    font-family: inherit;
    font-size: 0.95rem;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1.2;
    margin-top: auto;
    flex-shrink: 0;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.producto-card > .btn-agregar:hover {
    background: var(--amber-dark);
}

/* Fallback por si el botón está dentro de .producto-acciones */
.producto-acciones .btn-agregar {
    flex: 1;
    width: 100%;
    min-height: 52px;
    background: var(--amber);
    color: var(--white);
    border: none;
    padding: 0.75rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-weight: 600;
    font-family: inherit;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    touch-action: manipulation;
}

.producto-acciones .btn-agregar:hover {
    background: var(--amber-dark);
}

/* ====== RESULTADOS BÚSQUEDA ====== */
.resultados {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--white);
    border: 1px solid var(--line);
    border-top: none;
    border-radius: 0 0 var(--radius-md) var(--radius-md);
    box-shadow: var(--shadow-hover);
    max-height: 400px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
}

.resultado-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.9rem 1rem;
    border-bottom: 1px solid var(--line);
    cursor: pointer;
    transition: background 0.2s;
}

.resultado-item:last-child {
    border-bottom: none;
}

.resultado-item:hover {
    background: var(--surface);
}

.resultado-info {
    flex: 1;
}

.resultado-nombre {
    font-weight: 600;
    color: var(--ink);
    margin-bottom: 0.2rem;
}

.resultado-categoria {
    font-size: 0.78rem;
    color: var(--ink-soft);
}

.resultado-precio {
    font-weight: 700;
    color: var(--green-dark) !important;
    font-size: 1.25rem;
    font-family: 'Fraunces', Georgia, serif;
    letter-spacing: -0.01em;
}

/* ============================================================ */
/* ====== SELECTOR DE SABOR (tarjeta con grupo) ====== */
/* ============================================================ */

.producto-card-grupo {
    cursor: default;
}

.selector-sabor-wrap {
    margin: 8px 0 6px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    width: 100%;
}

.selector-sabor-label {
    font-size: 12px;
    color: #666;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.selector-sabor {
    width: 100%;
    padding: 8px 32px 8px 10px;
    border: 1px solid #ccc;
    border-radius: 6px;
    background: #fff;
    font-size: 14px;
    font-family: inherit;
    color: #333;
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%232e7d32' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 8px center;
    background-size: 16px;
    touch-action: manipulation;
}

.selector-sabor:focus {
    outline: none;
    border-color: #2e7d32;
    box-shadow: 0 0 0 3px rgba(46, 125, 50, 0.15);
}

.selector-sabor:hover {
    border-color: #2e7d32;
}

/* ============================================================ */
/* ====== TARJETA SURTIDA (mix personalizado) ====== */
/* ============================================================ */

.producto-card-surtida {
    cursor: default;
    min-height: auto;
}

.producto-card-surtida .producto-imagen {
    height: 140px;
}

.surtida-panel {
    margin: 8px 0;
    width: 100%;
}

.surtida-instruccion {
    font-size: 0.8rem;
    color: #666;
    margin: 6px 0;
    font-style: italic;
}

.surtida-lista {
    display: flex;
    flex-direction: column;
    gap: 3px;
    margin: 4px 0 8px;
    background: #f9f9f9;
    border-radius: 6px;
    padding: 6px 8px;
    max-height: 240px;
    overflow-y: auto;
}

.surtida-fila {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 0;
    border-bottom: 1px solid #eee;
}

.surtida-fila:last-child {
    border-bottom: none;
}

.surtida-nombre {
    font-size: 0.85rem;
    color: #333;
    flex: 1;
}

.surtida-controles {
    display: flex;
    align-items: center;
    gap: 6px;
}

.surtida-btn {
    width: 32px;
    height: 32px;
    border: 1px solid #ccc;
    background: #fff;
    color: #2e7d32;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    line-height: 1;
    transition: background 0.15s, border-color 0.15s;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    -webkit-user-select: none;
}

.surtida-btn:hover {
    background: #e8f5e9;
    border-color: #2e7d32;
}

.surtida-btn:active {
    background: #c8e6c9;
}

.surtida-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    background: #fff;
}

.surtida-cantidad {
    min-width: 24px;
    text-align: center;
    font-weight: 700;
    font-size: 0.95rem;
    color: #333;
    user-select: none;
    -webkit-user-select: none;
}

.surtida-total {
    font-size: 0.85rem;
    color: #666;
    margin: 4px 0;
    text-align: center;
    font-weight: 600;
}

.surtida-total.completo {
    color: #2e7d32;
}

/* CHECKBOX (modo checklist: De Todito, Jugo Pulp) */
.surtida-checkbox-fila {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 4px;
    cursor: pointer;
    border-radius: 4px;
    transition: background 0.15s;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    -webkit-user-select: none;
}

.surtida-checkbox-fila:hover {
    background: #e8f5e9;
}

.surtida-checkbox {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #2e7d32;
    flex-shrink: 0;
}

.surtida-checkbox-nombre {
    flex: 1;
    font-size: 0.85rem;
    color: #333;
}

.surtida-checkbox-cant {
    font-size: 0.85rem;
    font-weight: 700;
    color: #2e7d32;
    min-width: 30px;
    text-align: right;
}

.btn-agregar-disabled {
    opacity: 0.5;
    cursor: not-allowed !important;
    background: #999 !important;
}

.btn-agregar-disabled:hover {
    background: #999 !important;
}

/* Título clickeable SIN subrayado por defecto */
.producto-card-grupo .producto-nombre {
    text-decoration: none;
    color: inherit;
}

/* Solo subrayar al hacer hover */
.producto-card-grupo .producto-nombre:hover {
    color: #2e7d32;
    text-decoration: underline;
}

/* ============================================================ */
/* ====== RESPONSIVE MÓVIL ====== */
/* ============================================================ */
@media (max-width: 768px) {
    /* ---------- TARJETA HORIZONTAL (productos simples) ---------- */
    .producto-card:not(.producto-card-grupo) {
        display: grid;
        grid-template-columns: 100px 1fr;
        grid-template-rows: auto auto;
        column-gap: 0.85rem;
        row-gap: 0.6rem;
        padding: 0.85rem;
        min-height: auto;
        align-items: start;
    }

    .producto-card:not(.producto-card-grupo) .producto-imagen {
        grid-column: 1;
        grid-row: 1;
        width: 100%;
        height: 100px;
        margin-bottom: 0;
        border-radius: var(--radius-sm);
    }

    .producto-card:not(.producto-card-grupo) .producto-imagen img {
        width: 85%;
    }

    .producto-card:not(.producto-card-grupo) .producto-info {
        grid-column: 2;
        grid-row: 1;
        margin-bottom: 0;
        min-width: 0;
    }

    .producto-card:not(.producto-card-grupo) .producto-nombre {
        min-height: auto;
        font-size: 0.95rem;
        -webkit-line-clamp: 3;
    }

    .producto-card:not(.producto-card-grupo) .producto-stock {
        margin-bottom: 0.4rem;
    }

    .producto-card:not(.producto-card-grupo) .cantidad-selector {
        margin: 0.4rem 0 0.3rem;
    }

    .producto-card:not(.producto-card-grupo) > .btn-agregar {
        grid-column: 1 / -1;
        grid-row: 2;
        min-height: 44px;
        font-size: 0.9rem;
        margin-top: 0;
    }

    /* ---------- TARJETAS DE GRUPO (siguen verticales) ---------- */
    .producto-card.producto-card-grupo {
        min-height: auto;
        padding: 1rem;
    }

    .producto-card.producto-card-grupo .producto-imagen {
        height: 150px;
    }

    .producto-card.producto-card-grupo .producto-nombre {
        min-height: auto;
        font-size: 1rem;
    }

    .producto-badge-categoria {
        font-size: 0.65rem;
        padding: 3px 8px;
    }

    .surtida-btn {
        width: 36px;
        height: 36px;
        font-size: 18px;
    }

    .surtida-checkbox {
        width: 22px;
        height: 22px;
    }

    .surtida-checkbox-fila {
        padding: 10px 6px;
    }
}

@media (max-width: 480px) {
    .producto-card:not(.producto-card-grupo) {
        grid-template-columns: 90px 1fr;
        column-gap: 0.7rem;
        padding: 0.7rem;
    }

    .producto-card:not(.producto-card-grupo) .producto-imagen {
        height: 90px;
    }

    .producto-card:not(.producto-card-grupo) .producto-nombre {
        font-size: 0.9rem;
    }

    .producto-card.producto-card-grupo .producto-imagen {
        height: 130px;
    }

    .producto-card.producto-card-grupo .producto-nombre {
        font-size: 0.95rem;
    }

    .producto-precio {
        font-size: 1.15rem;
    }

    .producto-badge-categoria {
        font-size: 0.62rem;
        padding: 2px 7px;
    }
}

/* ============================================================ */
/* ====== SELECTOR DE CANTIDAD EN TARJETAS ====== */
/* ============================================================ */

.cantidad-selector {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin: 0.75rem 0 0.5rem;
    padding: 0.4rem 0.5rem;
    background: var(--surface, #F6F5F2);
    border-radius: var(--radius-sm, 6px);
    border: 1px solid var(--line, #E8E6E1);
    width: 100%;
}

.btn-cant-card {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: var(--green, #2F6B4F);
    color: var(--white, #FFFFFF);
    font-size: 1.2rem;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: background 0.2s, transform 0.15s;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    -webkit-user-select: none;
    flex-shrink: 0;
}

.btn-cant-card:hover {
    background: var(--green-dark, #1E4A36);
}

.btn-cant-card:active {
    transform: scale(0.92);
}

.cant-card {
    font-size: 1rem;
    font-weight: 700;
    color: var(--ink, #1D1D1B);
    min-width: 28px;
    text-align: center;
    user-select: none;
    -webkit-user-select: none;
}

@media (max-width: 768px) {
    .btn-cant-card {
        width: 32px;
        height: 32px;
        font-size: 1.15rem;
    }

    .cant-card {
        font-size: 0.95rem;
        min-width: 24px;
    }
}

/* ============================================================ */
/* OFERTAS - Precio con descuento                                */
/* ============================================================ */
.producto-precio-wrap {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin: 4px 0;
}

.producto-precio-linea-sup {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.producto-precio-tachado {
    font-size: 0.85rem;
    color: #999;
    text-decoration: line-through;
    font-family: 'Inter', Arial, sans-serif;
    font-weight: 500;
}

.producto-badge-oferta {
    display: inline-block;
    background: #f97316;
    color: #ffffff;
    font-size: 0.62rem;
    font-weight: 800;
    padding: 3px 8px;
    border-radius: 999px;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.producto-precio-descuento {
    color: #dc2626 !important;
    font-size: 1.35rem !important;
    font-weight: 800 !important;
}

.producto-precio-wrap-dinamico {
    display: block;
}

/* En tarjetas de grupo, cuando hay oferta */
.producto-card-oferta {
    border-color: #f97316 !important;
    box-shadow: 0 0 0 2px rgba(249, 115, 22, 0.15);
}

/* Detalle del producto */
.detalle-precio-tachado {
    font-size: 1rem;
    color: #999;
    text-decoration: line-through;
    margin-right: 10px;
    font-weight: 500;
}

.detalle-badge-oferta {
    display: inline-block;
    background: #f97316;
    color: #ffffff;
    font-size: 0.7rem;
    font-weight: 800;
    padding: 4px 10px;
    border-radius: 999px;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    margin-right: 10px;
    vertical-align: middle;
}

.detalle-precio-descuento {
    color: #dc2626;
    font-size: 1.6rem;
    font-weight: 800;
    font-family: 'Fraunces', Georgia, serif;
}