/* ── PALETA ──
   Verde oscuro #1b5e20 / Verde  #2e7d32 / Verde CTA #43a047
   Rojo (tomate) #e53935 / Ámbar (acento) #ffb300
*/

/* ── RESET ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Segoe UI', Arial, sans-serif; background: #f6f8f3; color: #333; font-size: 15px; }
a { color: #2e7d32; text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── NAV ── */
nav {
    background: #1b5e20;
    padding: 0 20px;
    display: flex;
    align-items: center;
    gap: 14px;
    height: 58px;
    position: sticky;
    top: 0;
    z-index: 200;
}
.brand { font-size: 19px; font-weight: 700; color: #fff; white-space: nowrap; flex-shrink: 0; display: flex; align-items: center; }
.brand:hover { text-decoration: none; color: #fff; }
.brand-logo { height: 40px; width: auto; display: block; border-radius: 6px; }
.sandbox-badge {
    background: #ff6f00; color: #fff; font-size: 10px; font-weight: 700;
    padding: 2px 7px; border-radius: 3px; margin-left: 8px; vertical-align: middle;
}

/* ── SEARCH ── */
.search-wrap { flex: 1; max-width: 500px; position: relative; }
#search-input {
    width: 100%; padding: 9px 16px; border-radius: 24px; border: none;
    /* font-size 16px es obligatorio: en iOS, cualquier valor menor hace zoom automático al enfocar el input */
    font-size: 16px; outline: none; background: rgba(255,255,255,.16); color: #fff;
    transition: background .2s;
}
#search-input::placeholder { color: rgba(255,255,255,.6); }
#search-input:focus { background: rgba(255,255,255,.26); }

#search-results {
    display: none;
    position: absolute;
    top: calc(100% + 6px); left: 0; right: 0;
    background: #fff; border-radius: 10px;
    box-shadow: 0 8px 32px rgba(0,0,0,.18);
    z-index: 9999;
    max-height: 370px; overflow-y: auto;
}
.search-item {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 12px; cursor: pointer; border-bottom: 1px solid #f0f0f0; transition: background .15s;
}
.search-item:last-child { border-bottom: none; }
.search-item:hover { background: #f2f9f1; }
.search-item img { width: 40px; height: 40px; object-fit: contain; background:#fafafa; border-radius: 6px; flex-shrink: 0; }
.search-item-info { flex: 1; min-width: 0; }
.search-item-name {
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
    overflow: hidden; font-size: 12.5px; font-weight: 600; color: #222; line-height: 1.3;
}
.search-item-name mark { background: #fff3cd; border-radius: 2px; padding: 0 2px; }
.search-item-name em { font-weight: 400; color: #2e7d32; font-style: normal; }
.search-item-meta { display: block; font-size: 12px; color: #888; margin-top: 2px; }
.search-add-btn {
    flex-shrink: 0; background: #43a047; color: #fff; border: none;
    border-radius: 50%; width: 28px; height: 28px; font-size: 17px; font-weight: 700;
    cursor: pointer; padding: 0; line-height: 1;
    display: flex; align-items: center; justify-content: center;
}
.search-add-btn:hover { background: #2e7d32; }

/* ── CART BUTTON ── */
.cart-nav-btn {
    background: none; border: none; cursor: pointer; color: #fff;
    font-size: 22px; padding: 4px 6px;
    display: flex; align-items: center; gap: 5px;
    flex-shrink: 0; white-space: nowrap;
}
.cart-nav-btn:hover { color: #ffca28; }
.cart-count {
    background: #e53935; color: #fff; border-radius: 50%;
    min-width: 20px; height: 20px; font-size: 11px; font-weight: 700;
    display: flex; align-items: center; justify-content: center; padding: 0 4px;
}

/* ── OVERLAY ── */
#cart-overlay {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0,0,0,.45);
    z-index: 400;
}
#cart-overlay.show { display: block; }

/* ── CART DRAWER ── */
#cart-drawer {
    position: fixed;
    top: 0; right: 0; bottom: 0;
    width: 370px; max-width: 100vw;
    background: #fff;
    z-index: 500;
    display: flex; flex-direction: column;
    transform: translateX(100%);
    transition: transform .28s cubic-bezier(.4,0,.2,1);
    box-shadow: -4px 0 24px rgba(0,0,0,.15);
}
#cart-drawer.open { transform: translateX(0); }

.drawer-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 18px; border-bottom: 1px solid #eee; flex-shrink: 0;
}
.drawer-header h2 { font-size: 17px; }
.drawer-header-actions { display: flex; align-items: center; gap: 14px; }
.empty-cart-btn {
    background: none; border: none; cursor: pointer;
    color: #e53935; font-size: 13px; font-weight: 600; padding: 4px 2px;
    display: flex; align-items: center; gap: 4px;
}
.empty-cart-btn:hover { text-decoration: underline; }
.empty-cart-btn::before { content: "🗑"; font-size: 13px; }
#close-drawer {
    background: none; border: none; font-size: 24px;
    cursor: pointer; color: #666; line-height: 1; padding: 0 4px;
}
#close-drawer:hover { color: #111; }

#drawer-items { flex: 1; overflow-y: auto; padding: 10px 16px; }
.drawer-empty { color: #aaa; text-align: center; padding: 40px 0; font-size: 14px; }

.drawer-item {
    display: flex; gap: 12px; padding: 12px 0;
    border-bottom: 1px solid #f0f0f0; align-items: flex-start;
}
.drawer-item:last-child { border-bottom: none; }
.drawer-item img { width: 64px; height: 64px; object-fit: contain; background:#fafafa; border-radius: 6px; flex-shrink: 0; }
.drawer-item-info { flex: 1; min-width: 0; }
.drawer-item-name { display: block; font-size: 13px; font-weight: 600; margin-bottom: 4px; line-height: 1.3; }
.drawer-item-name .var-label { font-weight: 400; color: #2e7d32; font-style: normal; }
.drawer-item-price { display: block; font-size: 14px; color: #2e7d32; font-weight: 700; margin-bottom: 8px; }
.drawer-item-qty { display: flex; align-items: center; gap: 8px; }
.qty-btn {
    width: 28px; height: 28px; border-radius: 50%; border: 1.5px solid #ddd;
    background: #f5f5f5; font-size: 16px; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; line-height: 1; transition: background .15s;
}
.qty-btn:hover { background: #e0e0e0; }
.drawer-item-qty > span { min-width: 22px; text-align: center; font-weight: 700; }
.remove-btn {
    margin-left: 6px; background: none; border: none;
    color: #e53935; font-size: 12px; cursor: pointer; padding: 0;
}
.remove-btn:hover { text-decoration: underline; }

.drawer-footer { padding: 14px 18px; border-top: 2px solid #eee; flex-shrink: 0; }
.drawer-total-row {
    display: flex; justify-content: space-between;
    font-size: 16px; font-weight: 700; margin-bottom: 12px;
}
#drawer-total { color: #2e7d32; }
.drawer-checkout-btn {
    display: block; width: 100%; padding: 12px;
    background: #43a047; color: #fff; border: none; border-radius: 8px;
    font-size: 15px; font-weight: 700; cursor: pointer; text-align: center;
    text-decoration: none; transition: background .2s;
}
.drawer-checkout-btn:hover { background: #2e7d32; text-decoration: none; }

/* ── CATEGORÍAS ── */
.categories-bar {
    background: #fff;
    border-bottom: 1px solid #eee;
    position: sticky;
    top: 58px;
    z-index: 150;
    box-shadow: 0 2px 8px rgba(0,0,0,.04);
}
.cat-label {
    max-width: 1500px;
    margin: 0 auto;
    padding: 12px 16px 0;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .6px;
    text-transform: uppercase;
    color: #1b5e20;
}
.categories-scroll {
    max-width: 1500px;
    margin: 0 auto;
    padding: 10px 16px 14px;
    display: flex;
    gap: 10px;
    overflow-x: auto;
    scrollbar-width: thin;
}
.categories-scroll::-webkit-scrollbar { height: 5px; }
.categories-scroll::-webkit-scrollbar-thumb { background: #ddd; border-radius: 10px; }
.cat-chip {
    flex-shrink: 0;
    display: flex; align-items: center; gap: 8px;
    padding: 8px 16px;
    border-radius: 24px;
    background: #f0f5ed;
    color: #333;
    font-size: 13.5px;
    font-weight: 600;
    white-space: nowrap;
    border: 1.5px solid transparent;
    transition: all .18s;
}
.cat-chip:hover { background: #dcefdc; color: #2e7d32; text-decoration: none; }
.cat-chip.active {
    background: #1b5e20; color: #fff; border-color: #1b5e20;
    box-shadow: 0 0 0 3px rgba(27,94,32,.22), 0 3px 8px rgba(27,94,32,.28);
    transform: translateY(-1px);
    font-weight: 700;
}
.cat-chip.active::before { content: '✓'; font-weight: 900; margin-right: 1px; }
.cat-chip.active .cat-count { opacity: .9; }
.cat-chip img { width: 20px; height: 20px; object-fit: cover; border-radius: 50%; flex-shrink: 0; }
.cat-chip .cat-emoji { font-size: 15px; line-height: 1; }
.cat-chip .cat-count { font-size: 11px; font-weight: 700; opacity: .6; }

/* ── FILTRO ALFABÉTICO ── */
.alpha-bar {
    background: #fff;
    border-bottom: 1px solid #eee;
}
.alpha-scroll {
    max-width: 1500px;
    margin: 0 auto;
    padding: 8px 16px;
    display: flex;
    gap: 5px;
    overflow-x: auto;
    scrollbar-width: thin;
}
.alpha-scroll::-webkit-scrollbar { height: 4px; }
.alpha-scroll::-webkit-scrollbar-thumb { background: #ddd; border-radius: 10px; }
.alpha-chip {
    flex-shrink: 0;
    min-width: 40px;
    padding: 8px 12px;
    border-radius: 7px;
    background: #f0f5ed;
    color: #2e7d32;
    font-size: 17px;
    font-weight: 700;
    text-align: center;
    white-space: nowrap;
    transition: all .15s;
}
.alpha-chip:hover { background: #dcefdc; text-decoration: none; }
.alpha-chip.active {
    background: #1b5e20; color: #fff;
    box-shadow: 0 0 0 3px rgba(27,94,32,.22), 0 3px 8px rgba(27,94,32,.28);
    transform: translateY(-1px) scale(1.06);
}
.alpha-chip.disabled { color: #ccc; background: #f7f7f7; cursor: default; pointer-events: none; }

/* ── BARRA DE FILTRO ACTIVO ── */
.active-filter-bar {
    max-width: 1500px;
    margin: 14px auto 0;
    padding: 0 16px;
    display: flex; align-items: center; flex-wrap: wrap; gap: 8px;
}
.active-filter-bar .aff-label { font-size: 13px; color: #666; font-weight: 600; }
.active-filter-tag {
    display: inline-flex; align-items: center; gap: 7px;
    background: #e8f5e9; color: #1b5e20;
    border: 1.5px solid #1b5e20;
    padding: 5px 12px; border-radius: 20px;
    font-size: 13px; font-weight: 700;
}
.active-filter-tag .aff-x {
    display: inline-flex; align-items: center; justify-content: center;
    width: 18px; height: 18px; border-radius: 50%;
    background: #1b5e20; color: #fff; font-size: 12px; line-height: 1;
    text-decoration: none;
}
.active-filter-tag .aff-x:hover { background: #e53935; }
.active-filter-clear {
    font-size: 12.5px; color: #e53935; font-weight: 700; text-decoration: underline;
}

/* ── HAZ EL SÚPER RÁPIDO ── */
.super-bar { max-width: 1500px; margin: 0 auto; padding: 14px 16px 0; }
.super-btn {
    position: relative; overflow: hidden;
    width: 100%; display: flex; align-items: center; gap: 14px;
    background: #1b5e20; color: #fff; border: none; border-radius: 12px;
    padding: 14px 18px; cursor: pointer; text-align: left; font-family: inherit;
    transition: background .15s;
}
.super-btn:hover { background: #14501a; }
/* Patrón de fondo con íconos tenues de frutas y verduras. */
.super-deco { position: absolute; inset: 0; z-index: 0; pointer-events: none; opacity: .14; }
/* brightness(0) invert(1) convierte cada emoji en una silueta blanca (patrón monocromático). */
.super-deco span { position: absolute; font-size: 26px; line-height: 1; filter: brightness(0) invert(1); }
.super-btn-ico  { position: relative; z-index: 1; font-size: 26px; flex-shrink: 0; }
.super-btn-txt  { position: relative; z-index: 1; flex: 1; display: flex; flex-direction: column; gap: 2px; }
.super-btn-txt strong { font-size: 16px; }
.super-btn-txt small { font-size: 12.5px; opacity: .85; }
.super-btn-arrow { position: relative; z-index: 1; font-size: 26px; opacity: .8; }

#super-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 600; }
#super-overlay.show { display: block; }
#super-modal {
    display: none; position: fixed; z-index: 610;
    top: 50%; left: 50%; transform: translate(-50%, -50%);
    width: 94vw; max-width: 540px; max-height: 88vh;
    background: #f6f8f3; border-radius: 14px; overflow: hidden;
    flex-direction: column; box-shadow: 0 12px 40px rgba(0,0,0,.3);
}
#super-modal.open { display: flex; }
.super-head {
    display: flex; align-items: center; justify-content: space-between;
    background: #1b5e20; color: #fff; padding: 14px 18px; flex-shrink: 0;
}
.super-head h2 { font-size: 18px; color: #fff; margin: 0; }
#close-super { background: none; border: none; color: #fff; font-size: 28px; cursor: pointer; line-height: 1; padding: 0 4px; }
.super-body { padding: 16px 18px; overflow-y: auto; flex: 1; }
.super-hint { font-size: 13.5px; color: #666; margin-bottom: 16px; line-height: 1.45; }
.super-field { margin-bottom: 14px; }
.super-field > label { display: block; font-size: 13px; font-weight: 700; color: #1b5e20; margin-bottom: 6px; }
.super-seg { display: flex; gap: 6px; flex-wrap: wrap; }
.super-seg button {
    flex: 1; min-width: 60px; padding: 9px 10px; border: 1.5px solid #d7e4d3;
    background: #fff; color: #2e7d32; border-radius: 8px; font-size: 14px; font-weight: 600;
    cursor: pointer; font-family: inherit; transition: all .15s;
}
.super-seg-num button { flex: 0 1 auto; min-width: 44px; }
.super-seg button.active { background: #2e7d32; color: #fff; border-color: #2e7d32; }

.super-preview { margin-top: 8px; }
.super-loading { text-align: center; color: #888; font-size: 14px; padding: 20px 0; }
.super-list { border: 1px solid #e3ece0; border-radius: 10px; overflow: hidden; }
.super-item { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 12px; border-bottom: 1px solid #eef2ec; }
.super-item:last-child { border-bottom: none; }
.super-item-info { display: flex; flex-direction: column; min-width: 0; }
.super-item-name { font-size: 13.5px; font-weight: 600; color: #222; }
.super-item-pres { font-size: 12px; color: #777; }
.super-item-sub { font-size: 13.5px; font-weight: 700; color: #2e7d32; white-space: nowrap; }
.super-nofound { margin-top: 12px; background: #fff8e1; border: 1px solid #ffe082; color: #7a5900; padding: 10px 12px; border-radius: 8px; font-size: 12.5px; line-height: 1.4; }

.super-foot { padding: 14px 18px; border-top: 1px solid #e3ece0; background: #fff; flex-shrink: 0; }
.super-total-row { display: flex; justify-content: space-between; align-items: baseline; font-size: 16px; margin-bottom: 10px; }
.super-total-row strong { color: #2e7d32; font-size: 20px; }

/* ── MODAL CONFIRMAR (vaciar carrito) ── */
#confirm-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 700; }
#confirm-overlay.show { display: block; }
#confirm-modal {
    display: none; position: fixed; z-index: 710;
    top: 50%; left: 50%; transform: translate(-50%, -46%);
    width: 92vw; max-width: 380px; background: #fff;
    border-radius: 16px; padding: 26px 24px 20px; text-align: center;
    box-shadow: 0 16px 48px rgba(0,0,0,.28);
    opacity: 0; transition: opacity .18s, transform .18s;
}
#confirm-modal.open { display: block; opacity: 1; transform: translate(-50%, -50%); }
.confirm-icon {
    width: 56px; height: 56px; margin: 0 auto 14px;
    display: flex; align-items: center; justify-content: center;
    background: #ffebee; border-radius: 50%; font-size: 26px;
}
.confirm-title { font-size: 18px; font-weight: 700; color: #222; margin-bottom: 8px; }
.confirm-text { font-size: 14px; color: #666; line-height: 1.5; margin-bottom: 22px; }
.confirm-actions { display: flex; gap: 10px; }
.confirm-btn {
    flex: 1; height: 46px; border-radius: 10px; border: none;
    font-size: 15px; font-weight: 700; cursor: pointer; font-family: inherit;
    transition: background .15s, border-color .15s;
}
.confirm-cancel { background: #fff; color: #555; border: 1.5px solid #ddd; }
.confirm-cancel:hover { background: #f5f5f5; }
.confirm-ok { background: #e53935; color: #fff; }
.confirm-ok:hover { background: #c62828; }

/* ── CONTAINER ── */
.container { max-width: 1500px; margin: 0 auto; padding: 24px 16px; }

/* ── ENLACE VOLVER ── */
.back-link {
    display: inline-flex; align-items: center; gap: 6px;
    margin-bottom: 16px;
    padding: 8px 16px;
    border-radius: 24px;
    background: #eef6ea;
    color: #2e7d32;
    font-size: 14px; font-weight: 600;
    text-decoration: none;
    transition: background .15s;
}
.back-link:hover { background: #dcefdc; text-decoration: none; }

/* ── PRODUCT GRID ── */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: 18px; margin-top: 10px;
}
/* En escritorio, 5 productos por fila usando el ancho ampliado. */
@media (min-width: 1100px) {
    .grid { grid-template-columns: repeat(5, 1fr); }
}
.card {
    position: relative;
    background: #fff; border-radius: 8px; overflow: hidden;
    box-shadow: 0 1px 4px rgba(0,0,0,.1); transition: box-shadow .2s;
    display: flex; flex-direction: column;
}
.card:hover { box-shadow: 0 4px 16px rgba(0,0,0,.15); }
.card img { width: 100%; aspect-ratio: 1 / 1; object-fit: contain; background: #fff; display: block; }
/* Puntito rojo: producto sin stock en ninguna presentación. */
.stock-dot {
    position: absolute; top: 8px; right: 8px; z-index: 3;
    width: 13px; height: 13px; border-radius: 50%;
    background: #e53935; border: 2px solid #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,.35);
}
/* Producto destacado: se elige desde el dashboard y se ancla arriba. */
.card.is-featured { box-shadow: 0 0 0 2px #de2822, 0 1px 4px rgba(0,0,0,.1); }
.dest-badge {
    position: absolute; top: 8px; left: 8px; z-index: 3;
    background: #ffb300; color: #fff;
    font-size: 13px; font-weight: 700; line-height: 1;
    padding: 5px 6px; border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0,0,0,.3);
}
.card-body { padding: 12px; display: flex; flex-direction: column; flex: 1; }
.card-body h3 { font-size: 14px; margin-bottom: 6px; line-height: 1.3; font-weight: 600; color: #222; }
.card-body .price { font-weight: 700; color: #2e7d32; font-size: 16px; margin-bottom: 10px; }
.card-body .price.variant-price { font-size: 14px; }

/* ── SELECTOR DE VARIANTES (index) ── */
.attr-selects { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; }
.variant-select {
    width: 100%; padding: 8px 10px;
    border: 1.5px solid #cfe3cf; border-radius: 5px;
    font-size: 13px; background: #fff; color: #333;
    outline: none; transition: border .2s;
}
.attr-selects .variant-select { margin-bottom: 0; }
.variant-select:focus { border-color: #43a047; }

/* ── BUTTONS ── */
.btn {
    display: inline-block; padding: 9px 18px; border-radius: 5px;
    border: none; cursor: pointer; font-size: 14px; font-weight: 600; transition: background .2s;
}
.btn-primary { background: #43a047; color: #fff; }
.btn-primary:hover { background: #2e7d32; text-decoration: none; }
.btn-success { background: #2e7d32; color: #fff; }
.btn-success:hover { background: #1b5e20; text-decoration: none; }
.btn-danger  { background: #e53935; color: #fff; }
.btn-danger:hover  { background: #b71c1c; }
.btn-block { display: block; width: 100%; text-align: center; }
.btn-sm { padding: 5px 12px; font-size: 13px; }

.add-to-cart-btn { margin-top: auto; }
.add-to-cart-btn:disabled { background: #bdbdbd; cursor: not-allowed; }

/* ── PAGINACIÓN (barra segmentada tipo píldora) ── */
.pagination {
    display: flex; justify-content: center; align-items: center;
    margin-top: 32px;
}
.page-bar {
    position: relative; overflow: hidden;
    display: inline-flex; align-items: center; gap: 2px;
    max-width: 100%; flex-wrap: wrap; justify-content: center;
    background: #1b5e20; border: 1px solid #1b5e20;
    border-radius: 999px; padding: 5px;
}
/* Mismo patrón de íconos tenues que el botón del súper. */
.page-deco { position: absolute; inset: 0; z-index: 0; pointer-events: none; opacity: .14; }
.page-deco span { position: absolute; font-size: 22px; line-height: 1; filter: brightness(0) invert(1); }
.page-btn {
    position: relative; z-index: 1;
    min-width: 40px; height: 40px; padding: 0 14px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 999px; border: none; background: transparent;
    color: #fff; font-size: 15px; font-weight: 600; text-decoration: none;
    transition: background .15s, color .15s;
}
.page-btn:hover { background: rgba(255,255,255,.18); text-decoration: none; }
.page-btn.active {
    background: #fff; color: #1b5e20; cursor: default; font-weight: 700;
    box-shadow: 0 2px 6px rgba(0,0,0,.22);
}
.page-btn.active:hover { background: #fff; }
.page-btn.nav { font-size: 19px; line-height: 1; min-width: 38px; padding: 0 12px; }
.page-btn.is-disabled { color: rgba(255,255,255,.4); pointer-events: none; }
.page-ellipsis { position: relative; z-index: 1; padding: 0 4px; color: rgba(255,255,255,.7); font-weight: 700; }

.pagination-tools {
    display: flex; align-items: center; justify-content: center;
    gap: 18px; flex-wrap: wrap; margin-top: 14px;
}
.pagination-info { margin: 0; color: #666; font-size: 13.5px; }
.pagination-info strong { color: #1b5e20; }

.page-jump { display: flex; align-items: center; gap: 8px; }
.page-jump label { font-size: 13.5px; color: #666; font-weight: 600; }
.page-jump input {
    width: 68px; height: 38px; padding: 0 10px;
    border: 1.5px solid #dbe7d6; border-radius: 8px;
    font-size: 15px; text-align: center; color: #1b5e20; font-weight: 700; outline: none;
}
.page-jump input:focus { border-color: #43a047; box-shadow: 0 0 0 3px rgba(67,160,71,.15); }
.page-jump button {
    height: 38px; padding: 0 16px; border: none; border-radius: 8px;
    background: #43a047; color: #fff; font-size: 14px; font-weight: 700; cursor: pointer;
    transition: background .15s;
}
.page-jump button:hover { background: #2e7d32; }

/* ── ALERTS ── */
.alert { padding: 12px 16px; border-radius: 5px; margin-bottom: 16px; font-size: 14px; }
.alert-danger  { background: #ffebee; color: #c62828; border: 1px solid #ef9a9a; }
.alert-success { background: #e8f5e9; color: #2e7d32; border: 1px solid #a5d6a7; }
.alert-info    { background: #e3f2fd; color: #1565c0; border: 1px solid #90caf9; }

/* ── PRODUCT DETAIL ── */
.product-detail {
    display: flex; gap: 32px; background: #fff; padding: 24px;
    border-radius: 8px; box-shadow: 0 1px 4px rgba(0,0,0,.1);
}
.product-detail img { width: 340px; height: 340px; object-fit: contain; background:#fafafa; border-radius: 6px; flex-shrink: 0; }
.product-info { flex: 1; }
.product-info h1 { font-size: 22px; margin-bottom: 10px; }
.product-info .price { font-size: 24px; color: #2e7d32; font-weight: 700; margin-bottom: 14px; }
.product-info .description { color: #555; line-height: 1.6; margin-bottom: 18px; }
.qty-input { width: 60px; padding: 7px; border: 1px solid #ccc; border-radius: 4px; text-align: center; }

/* ── CART PAGE ── */
.cart-table { width: 100%; border-collapse: collapse; background: #fff; border-radius: 8px; overflow: hidden; box-shadow: 0 1px 4px rgba(0,0,0,.1); }
.cart-table th { background: #1b5e20; color: #fff; padding: 12px 16px; text-align: left; font-size: 13px; }
.cart-table td { padding: 12px 16px; border-bottom: 1px solid #eee; vertical-align: middle; }
.cart-table img { width: 56px; height: 56px; object-fit: contain; background:#fafafa; border-radius: 4px; }
.cart-summary { margin-top: 18px; background: #fff; padding: 18px; border-radius: 8px; box-shadow: 0 1px 4px rgba(0,0,0,.1); text-align: right; }
.cart-summary .total { font-size: 20px; font-weight: 700; color: #2e7d32; margin-bottom: 10px; }

/* ── CHECKOUT (drawer sobre la tienda, igual que el carrito) ── */
#checkout-drawer {
    position: fixed;
    top: 0; right: 0; bottom: 0;
    width: 560px; max-width: 100vw;
    background: #f6f8f3;
    z-index: 500;
    display: flex; flex-direction: column;
    transform: translateX(100%);
    transition: transform .28s cubic-bezier(.4,0,.2,1);
    box-shadow: -6px 0 28px rgba(0,0,0,.22);
}
#checkout-drawer.open { transform: translateX(0); }
.checkout-drawer-head {
    background: #1b5e20; color: #fff;
    gap: 10px;
}
.checkout-drawer-head h2 { flex: 1; text-align: center; font-size: 18px; color: #fff; }
.drawer-icon-btn {
    background: none; border: none; cursor: pointer; color: #fff;
    width: 36px; height: 36px; flex-shrink: 0; line-height: 1;
    display: flex; align-items: center; justify-content: center;
    border-radius: 50%; transition: background .15s;
    font-size: 24px;
}
#close-checkout { font-size: 30px; }
.drawer-icon-btn:hover { background: rgba(255,255,255,.15); }
.checkout-drawer-body { flex: 1; overflow-y: auto; padding: 18px; }

/* Paso 1: teléfono */
.step-hint { font-size: 13.5px; color: #666; margin-bottom: 14px; line-height: 1.4; }
.phone-field {
    display: flex; align-items: stretch;
    border: 1.5px solid #cfe3cf; border-radius: 8px; overflow: hidden;
    transition: border .2s;
}
.phone-field:focus-within { border-color: #43a047; box-shadow: 0 0 0 3px rgba(67,160,71,.15); }
.phone-prefix {
    display: flex; align-items: center; gap: 4px;
    padding: 0 12px; background: #f0f5ed; color: #1b5e20;
    font-size: 16px; font-weight: 700; white-space: nowrap;
    border-right: 1.5px solid #cfe3cf;
}
.phone-field input {
    flex: 1; border: none; outline: none;
    padding: 12px 14px; font-size: 18px; font-weight: 600; letter-spacing: 1px;
    color: #222; width: 100%;
}
.phone-msg { font-size: 13px; margin-top: 8px; min-height: 16px; }
.phone-msg.error { color: #c62828; }

/* Mensaje de bienvenida al reconocer al cliente */
.welcome-msg {
    background: #e8f5e9; border: 1px solid #a5d6a7; color: #2e7d32;
    padding: 12px 14px; border-radius: 8px; font-size: 14px; font-weight: 600;
    margin-bottom: 16px;
}

/* Chip con el teléfono elegido + enlace para cambiarlo */
.phone-chip {
    display: flex; align-items: center; gap: 8px;
    background: #f0f5ed; border-radius: 8px; padding: 8px 12px;
    font-size: 14px; margin-bottom: 14px;
}
.phone-chip strong { color: #1b5e20; }
.link-btn {
    margin-left: auto; background: none; border: none; cursor: pointer;
    color: #43a047; font-size: 13px; font-weight: 600; text-decoration: underline;
    padding: 0;
}
.link-btn:hover { color: #2e7d32; }

/* Aviso "primera compra" para clientes nuevos */
.first-time-note {
    background: #fff8e1; border: 1px solid #ffe082; color: #7a5900;
    padding: 12px 14px; border-radius: 8px; font-size: 13.5px; line-height: 1.45;
    margin-bottom: 16px;
}
.first-time-note strong { color: #5d4400; }

/* Switch (toggle) dirección de facturación diferente */
.switch-row {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    margin: 6px 0 4px; padding: 10px 0; cursor: pointer;
    font-size: 14px; font-weight: 600; color: #444;
}
.switch { position: relative; flex-shrink: 0; width: 46px; height: 26px; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch .slider {
    position: absolute; inset: 0; background: #ccc; border-radius: 26px;
    transition: background .2s;
}
.switch .slider::before {
    content: ""; position: absolute; height: 20px; width: 20px; left: 3px; top: 3px;
    background: #fff; border-radius: 50%; transition: transform .2s;
    box-shadow: 0 1px 3px rgba(0,0,0,.3);
}
.switch input:checked + .slider { background: #43a047; }
.switch input:checked + .slider::before { transform: translateX(20px); }

/* Envío */
.shipping-line {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    background: #f0f5ed; border-radius: 8px; padding: 12px 14px; margin-bottom: 8px;
    font-size: 14px;
}
.shipping-place { color: #333; }
.shipping-fee { color: #2e7d32; font-size: 15px; white-space: nowrap; }
#shipping-select {
    width: 100%; padding: 10px 12px; font-size: 16px;
    border: 1.5px solid #cfe3cf; border-radius: 6px; background: #fff; color: #333; outline: none;
}
#shipping-select:focus { border-color: #43a047; }

/* Opciones de método de pago */
.pay-option {
    display: flex; align-items: center; gap: 14px; width: 100%;
    text-align: left; cursor: pointer; font-family: inherit;
    padding: 16px 14px; margin-bottom: 12px;
    border: 1.5px solid #d7e4d3; border-radius: 10px;
    background: #fff; color: #333;
    transition: border-color .15s, box-shadow .15s, background .15s;
}
.pay-option:last-child { margin-bottom: 0; }
.pay-option:hover { border-color: #43a047; background: #f4faf3; text-decoration: none; box-shadow: 0 2px 8px rgba(0,0,0,.06); }
.pay-option-icon { font-size: 26px; flex-shrink: 0; display: flex; align-items: center; }
.pay-option-icon svg { display: block; }
.pay-option-text { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.pay-option-text strong { font-size: 15px; color: #222; }
.pay-option-text small { font-size: 12.5px; color: #777; }
.pay-option-arrow { font-size: 24px; color: #43a047; flex-shrink: 0; }
#pay-transfer { border-color: #a5d6a7; }
#pay-transfer:hover { border-color: #25d366; background: #f0fbf3; }

.checkout-grid { display: grid; grid-template-columns: 1fr; gap: 18px; }
.checkout-section { background: #fff; padding: 22px; border-radius: 8px; box-shadow: 0 1px 4px rgba(0,0,0,.1); }
.checkout-section h2 { font-size: 17px; margin-bottom: 16px; border-bottom: 2px solid #43a047; padding-bottom: 7px; }
.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 4px; color: #555; }
.form-group input, .form-group select {
    /* font-size 16px evita el zoom automático de iOS al enfocar el campo */
    width: 100%; padding: 9px 12px; border: 1px solid #ccc; border-radius: 5px; font-size: 16px; transition: border .2s;
}
.form-group input:focus, .form-group select:focus { border-color: #43a047; outline: none; box-shadow: 0 0 0 3px rgba(67,160,71,.15); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.card-icons { display: flex; gap: 8px; margin-bottom: 12px; }
.card-logos { height: 34px; width: auto; display: block; }
.pay-title { display: flex; align-items: center; gap: 8px; }
.pay-title svg { color: #2e7d32; flex-shrink: 0; }
.secure-note {
    display: flex; align-items: center; gap: 6px;
    margin: 8px 0 14px; font-size: 12.5px; color: #2e7d32;
}
.secure-note svg { flex-shrink: 0; }
.secure-note strong { color: #1b5e20; }
.payment-note { background: #fff8e1; border-left: 4px solid #ffc107; padding: 10px 14px; font-size: 13px; border-radius: 0 4px 4px 0; margin-bottom: 14px; }

/* ── CONFIRMACIÓN ── */
.confirm-box { background: #fff; border-radius: 8px; padding: 36px; text-align: center; box-shadow: 0 1px 4px rgba(0,0,0,.1); max-width: 520px; margin: 40px auto; }
.confirm-box .icon { font-size: 60px; margin-bottom: 14px; }
.confirm-box h1 { font-size: 24px; color: #2e7d32; margin-bottom: 8px; }
.confirm-box p { color: #555; margin-bottom: 6px; }
.confirm-box .order-id { font-size: 20px; font-weight: 700; color: #2e7d32; }

/* ── RESPONSIVE ── */
@media (max-width: 680px) {
    .checkout-grid { grid-template-columns: 1fr; }
    .product-detail { flex-direction: column; }
    .product-detail img { width: 100%; height: 240px; }
    nav { gap: 10px; padding: 0 12px; }
    .brand-logo { height: 32px; }
    /* En móvil el carrito abre parcialmente (deja ver la tienda detrás), no a pantalla completa. */
    #cart-drawer { width: 85vw; max-width: 340px; }
    /* El checkout abre un poco más ancho que el carrito, pero tampoco a pantalla completa. */
    #checkout-drawer { width: 92vw; max-width: 440px; }
    .checkout-drawer-body { padding: 14px 12px; }
    .checkout-section { padding: 16px; }

    .container { padding: 16px 8px; }
    .grid { grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 6px; }
    .card-body { padding: 8px 6px; }
    .card-body h3 {
        font-size: 11.5px; margin-bottom: 4px; min-height: 2.6em;
        display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
    }
    .card-body .price { font-size: 12.5px; margin-bottom: 6px; }
    .variant-select { font-size: 11px; padding: 6px 4px; margin-bottom: 6px; }
    .add-to-cart-btn { font-size: 10.5px; padding: 7px 4px; line-height: 1.2; white-space: normal; }

    .search-wrap { max-width: none; }
    #search-results { left: -40px; right: -8px; }
    .search-item { gap: 8px; padding: 8px; }
    .search-item img { width: 34px; height: 34px; }
    .search-item-name { font-size: 12px; }
    .search-item-meta { font-size: 11px; }
    .search-add-btn { width: 26px; height: 26px; font-size: 16px; }

    .alpha-scroll { padding: 7px 12px; gap: 4px; }
    .alpha-chip { min-width: 36px; padding: 7px 9px; font-size: 16px; }
    .page-btn { height: 42px; font-size: 15px; }
    /* En móvil se ocultan primera/última, las páginas más lejanas (±3) y el "ir a". */
    .page-desktop, .page-far3 { display: none !important; }
    .pagination-tools { flex-direction: column; gap: 8px; }
    /* La barra ocupa todo el ancho y los botones se reparten por igual. */
    .page-bar { width: 100%; flex-wrap: nowrap; gap: 3px; padding: 4px; }
    .page-bar > .page-btn { flex: 1 1 0; min-width: 0; padding: 0 2px; font-size: 14px; }
}

/* En pantallas muy chicas, mostrar solo ±1 para que no se sature. */
@media (max-width: 390px) {
    .page-far2 { display: none !important; }
}

/* ── Calendario de fecha de entrega ───────────────────────────── */
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.cal-head strong { font-size: 15px; }
.cal-nav {
    border: 1px solid #ddd; background: #fff; border-radius: 6px; cursor: pointer;
    width: 34px; height: 34px; font-size: 18px; line-height: 1; color: #2e7d32;
}
.cal-nav:hover:not(:disabled) { background: #f1f8f1; border-color: #2e7d32; }
.cal-nav:disabled { opacity: .3; cursor: default; }

.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-dow {
    text-align: center; font-size: 11px; font-weight: 700; color: #999;
    text-transform: uppercase; padding-bottom: 4px;
}
.cal-day {
    border: 1px solid transparent; background: #f5f5f5; border-radius: 6px;
    padding: 9px 0; font-size: 14px; cursor: pointer; color: #333;
}
.cal-day:hover:not(.is-off) { background: #e8f5e9; border-color: #2e7d32; }
/* Días no disponibles: hoy, domingos y fuera de rango. */
.cal-day.is-off {
    background: transparent; color: #ccc; cursor: not-allowed;
    text-decoration: line-through;
}
.cal-day.is-selected { background: #2e7d32; border-color: #2e7d32; color: #fff; font-weight: 700; }

.delivery-chosen {
    margin-top: 12px; font-size: 14px; font-weight: 600; color: #2e7d32;
    background: #e8f5e9; border-radius: 6px; padding: 8px 10px;
}
.delivery-hint { color: #c62828 !important; font-weight: 600; }
