/* ============================================================
   GLAMIA — Stylesheet v4 (Contraste mejorado)
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500&family=DM+Serif+Display&display=swap');

:root {
    --cream:       #faf7f2;
    --beige:       #f0ebe0;
    --beige2:      #e4ddd0;
    --border:      #ccc4b4;
    --white:       #ffffff;
    --dark:        #1e1a15;
    --body:        #3d3530;
    --muted:       #6b6458;
    --warm:        #8a7560;
    --sage:        #4a6e4a;
    --sage-dark:   #3a5a3a;
    --sage-bg:     #eef4ee;
    --sage-border: #a8c4a8;
    --radius:      10px;
    --shadow:      0 2px 16px rgba(30,26,21,.07);
}

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

body {
    font-family: 'DM Sans', sans-serif;
    background: var(--cream);
    color: var(--body);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    font-size: 15px;
    line-height: 1.6;
}

a { color: var(--sage); text-decoration: none; }
a:hover { color: var(--sage-dark); }
img { max-width: 100%; height: auto; display: block; }

/* ---- Header ---- */
.site-header {
    background: var(--white);
    border-bottom: 1.5px solid var(--border);
    position: sticky; top: 0; z-index: 100;
}
.header-inner {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 32px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}
.logo {
    font-family: 'DM Serif Display', serif;
    font-size: 1.45rem;
    color: var(--dark);
    letter-spacing: .01em;
}
.logo em { color: var(--sage); font-style: normal; }

.cart-icon {
    background: var(--sage);
    color: var(--white);
    border-radius: 999px;
    padding: 7px 20px;
    font-size: .82rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    transition: background .2s;
}
.cart-icon:hover { background: var(--sage-dark); color: var(--white); }
.cart-count {
    background: var(--white);
    color: var(--sage);
    border-radius: 50%;
    padding: 0 6px;
    font-size: .7rem;
    font-weight: 700;
}

/* ---- Layout ---- */
.site-main {
    flex: 1;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
    padding: 28px 32px 48px;
    display: grid;
    grid-template-columns: 180px 1fr;
    gap: 28px;
    align-items: start;
}

/* ---- Sidebar ---- */
.sidebar {
    background: var(--beige);
    border: 1.5px solid var(--border);
    border-radius: 14px;
    padding: 20px 14px;
    position: sticky;
    top: 76px;
}
.search-wrap {
    background: var(--white);
    border: 1.5px solid var(--border);
    border-radius: 8px;
    display: flex;
    align-items: center;
    padding: 8px 11px;
    gap: 7px;
    margin-bottom: 22px;
}
.search-wrap .search-icon { color: var(--muted); font-size: .9rem; flex-shrink: 0; }
.search-wrap input {
    border: none; outline: none;
    font-family: 'DM Sans', sans-serif;
    font-size: .82rem;
    color: var(--dark);
    background: transparent;
    width: 100%;
}
.search-wrap button {
    background: none; border: none; cursor: pointer;
    color: var(--sage); font-size: .78rem; font-weight: 500;
}
.sidebar-section { margin-bottom: 22px; }
.sidebar-label {
    font-size: .62rem; font-weight: 500;
    text-transform: uppercase; letter-spacing: .12em;
    color: var(--warm); margin-bottom: 8px; padding-left: 2px;
}
.cat-item {
    display: flex; align-items: center; justify-content: space-between;
    padding: 8px 10px; border-radius: 6px;
    font-size: .82rem; color: var(--muted);
    cursor: pointer; transition: all .15s;
    margin-bottom: 2px; text-decoration: none;
}
.cat-item:hover { background: var(--beige2); color: var(--dark); }
.cat-item.active { background: var(--sage); color: var(--white); font-weight: 500; }
.cat-count {
    font-size: .65rem; background: var(--beige2);
    color: var(--muted); border-radius: 999px; padding: 1px 7px;
    border: 1px solid var(--border);
}
.cat-item.active .cat-count { background: rgba(255,255,255,.2); color: var(--white); border-color: transparent; }

/* ---- Main content ---- */
.main-content { min-width: 0; }

/* Barra catálogo */
.catalog-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}
.catalog-bar-left { display: flex; align-items: baseline; gap: 10px; }
.catalog-title {
    font-family: 'DM Serif Display', serif;
    font-size: 1.1rem;
    color: var(--dark);
}
.catalog-count { font-size: .78rem; color: var(--muted); }
.catalog-sort {
    font-size: .78rem; color: var(--body);
    background: var(--white);
    border: 1.5px solid var(--border);
    border-radius: 7px;
    padding: 5px 10px;
    font-family: 'DM Sans', sans-serif;
    cursor: pointer;
}

/* ---- Alerts ---- */
.alert {
    padding: 12px 18px; border-radius: var(--radius);
    margin-bottom: 18px; font-weight: 500; font-size: .88rem;
    border: 1.5px solid;
}
.alert-success { background: var(--sage-bg); color: var(--sage-dark); border-color: var(--sage-border); }
.alert-error   { background: #fdf0ee; color: #8a2a20; border-color: #e8b8b4; }
.alert-info    { background: var(--beige2); color: var(--body); border-color: var(--border); }

/* ---- Product Grid ---- */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(185px, 1fr));
    gap: 16px;
    margin-bottom: 40px;
}
.product-card {
    background: var(--white);
    border: 1.5px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    transition: transform .18s, box-shadow .18s;
}
.product-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(30,26,21,.1);
}
.product-card img { width: 100%; height: 180px; object-fit: cover; background: var(--beige); }
.product-card .card-body { padding: 12px 14px 14px; }
.product-card .card-cat {
    font-size: .62rem; color: var(--warm);
    font-weight: 500; text-transform: uppercase;
    letter-spacing: .1em; margin-bottom: 3px;
}
.product-card .card-name {
    font-weight: 500; font-size: .9rem;
    margin-bottom: 8px; color: var(--dark);
    display: -webkit-box; -webkit-line-clamp: 2;
    -webkit-box-orient: vertical; overflow: hidden; line-height: 1.35;
}
.product-card .card-price { color: var(--sage); font-weight: 500; font-size: .95rem; }
.product-card .card-price-old {
    text-decoration: line-through; color: var(--muted);
    font-size: .78rem; margin-right: 4px;
}
.product-card .card-actions { margin-top: 10px; display: flex; gap: 7px; }

/* ---- Buttons ---- */
.btn {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 9px 20px; border-radius: var(--radius);
    font-family: 'DM Sans', sans-serif; font-weight: 500; font-size: .84rem;
    cursor: pointer; border: none; text-decoration: none;
    transition: background .18s, transform .1s;
}
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--sage); color: var(--white); }
.btn-primary:hover { background: var(--sage-dark); color: var(--white); }
.btn-outline {
    background: transparent; color: var(--sage);
    border: 1.5px solid var(--border);
}
.btn-outline:hover { background: var(--beige); border-color: var(--sage); }
.btn-soft { background: var(--beige); color: var(--body); border: 1.5px solid var(--border); }
.btn-soft:hover { background: var(--beige2); }
.btn-sm { padding: 6px 13px; font-size: .78rem; }
.btn-danger { background: #c0392b; color: var(--white); }
.btn-danger:hover { background: #a93226; }

/* Carrito AJAX */
.btn-agregar-ajax { position: relative; }
.btn-agregado { background: var(--sage-dark) !important; }
.spinner {
    display: inline-block; width: 13px; height: 13px;
    border: 2px solid rgba(255,255,255,.35);
    border-top-color: #fff; border-radius: 50%;
    animation: spin .6s linear infinite; vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Wishlist */
.btn-wish {
    background: var(--white);
    border: 1.5px solid var(--border);
    border-radius: 7px;
    cursor: pointer; font-size: .85rem;
    padding: 6px 9px; transition: all .15s; line-height: 1;
    font-family: inherit;
}
.btn-wish:hover { border-color: var(--sage); transform: scale(1.08); }
.btn-wish.en-wish { background: #fdf0ee; border-color: #e8b8b4; }

/* Badges */
.badge-oferta {
    background: var(--sage-bg); color: var(--sage-dark);
    font-size: .6rem; font-weight: 500;
    padding: 2px 8px; border-radius: 999px;
    text-transform: uppercase; letter-spacing: .04em;
    border: 1px solid var(--sage-border);
}
.badge-nuevo {
    background: #e8eef8; color: #2c4a7a;
    font-size: .6rem; font-weight: 500;
    padding: 2px 8px; border-radius: 999px;
    text-transform: uppercase; letter-spacing: .04em;
    border: 1px solid #b8c8e4;
}

/* ---- Producto detalle ---- */
.product-detail { display: grid; grid-template-columns: 1fr 1fr; gap: 48px; align-items: start; }
.product-detail img { border-radius: 14px; border: 1.5px solid var(--border); }
.product-detail .price-main { font-size: 1.8rem; color: var(--sage); font-weight: 500; }
.product-detail .price-old { text-decoration: line-through; color: var(--muted); margin-right: 10px; }
.product-detail .description { color: var(--muted); line-height: 1.8; margin: 18px 0; font-size: .92rem; }
.qty-input {
    width: 70px; text-align: center; padding: 9px;
    border-radius: var(--radius); border: 1.5px solid var(--border);
    font-size: .95rem; font-family: inherit; background: var(--white);
    color: var(--dark);
}
.qty-input:focus { outline: none; border-color: var(--sage); }

/* ---- Carrito ---- */
.cart-table { width: 100%; border-collapse: collapse; background: var(--white); border-radius: var(--radius); overflow: hidden; border: 1.5px solid var(--border); }
.cart-table th { background: var(--sage); color: var(--white); padding: 12px 16px; text-align: left; font-weight: 500; font-size: .82rem; letter-spacing: .02em; }
.cart-table td { padding: 14px 16px; border-bottom: 1px solid var(--beige2); vertical-align: middle; font-size: .88rem; color: var(--body); }
.cart-table img { width: 54px; height: 54px; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); }
.cart-summary { background: var(--white); border: 1.5px solid var(--border); border-radius: var(--radius); padding: 24px; margin-top: 20px; }
.cart-summary table { width: 100%; }
.cart-summary td { padding: 7px 0; font-size: .9rem; color: var(--body); }
.cart-summary .total-row td { font-size: 1.1rem; font-weight: 500; color: var(--sage); border-top: 1.5px solid var(--border); padding-top: 14px; }

/* ---- Checkout ---- */
.checkout-grid { display: grid; grid-template-columns: 1fr 360px; gap: 28px; align-items: start; }
.form-card {
    background: var(--white);
    border: 1.5px solid var(--border);
    border-radius: 14px;
    padding: 28px;
    margin-bottom: 20px;
}
.form-card h2 { font-family: 'DM Serif Display', serif; font-size: 1rem; margin-bottom: 20px; color: var(--dark); font-weight: 400; }
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-weight: 500; margin-bottom: 5px; font-size: .82rem; color: var(--body); }
.form-group input,
.form-group select,
.form-group textarea {
    width: 100%; padding: 10px 14px;
    border: 1.5px solid var(--border); border-radius: var(--radius);
    font-family: 'DM Sans', sans-serif; font-size: .88rem;
    background: var(--cream); color: var(--dark);
    transition: border-color .2s, background .2s;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none; border-color: var(--sage);
    background: var(--white); box-shadow: 0 0 0 3px var(--sage-bg);
}
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* ---- Resultado pago ---- */
.success-box {
    text-align: center; background: var(--white);
    border: 1.5px solid var(--border); border-radius: 18px;
    padding: 60px 40px; max-width: 520px; margin: 0 auto;
}
.success-box .icon { font-size: 3.5rem; margin-bottom: 16px; }
.success-box h1 { font-family: 'DM Serif Display', serif; font-size: 1.6rem; margin-bottom: 12px; color: var(--dark); font-weight: 400; }
.success-box p { color: var(--muted); line-height: 1.75; font-size: .9rem; }

/* ---- Área cuenta cliente ---- */
.cuenta-header {
    display: flex; align-items: center; gap: 16px;
    background: var(--white); border: 1.5px solid var(--border);
    border-radius: 14px; padding: 20px 24px; margin-bottom: 24px;
}
.cuenta-avatar { width: 60px; height: 60px; border-radius: 50%; border: 2px solid var(--sage-border); object-fit: cover; }
.cuenta-stat { background: var(--white); border: 1.5px solid var(--border); border-radius: 12px; padding: 18px 20px; text-align: center; }
.cuenta-stat-val { font-family: 'DM Serif Display', serif; font-size: 1.5rem; color: var(--sage); font-weight: 400; }
.cuenta-stat-label { font-size: .68rem; color: var(--muted); margin-top: 4px; text-transform: uppercase; letter-spacing: .06em; font-weight: 500; }

/* Sidebar cuenta cliente */
.sidebar-footer { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border); }
.sidebar-footer .cat-item { color: #8a2a20; }
.sidebar-footer .cat-item:hover { background: #fdf0ee; color: #8a2a20; }

/* ---- Footer ---- */
.site-footer {
    background: var(--dark); color: var(--muted);
    text-align: center; padding: 14px 24px;
    font-size: .78rem; line-height: 1.6;
}
.site-footer strong { color: var(--warm); }

/* ---- Whatsapp ---- */
.whatsapp-btn {
    position: fixed; bottom: 28px; right: 28px;
    width: 56px; height: 56px; background: #25d366;
    border-radius: 50%; display: flex; align-items: center; justify-content: center;
    box-shadow: 0 4px 18px rgba(37,211,102,.4); z-index: 999;
    transition: transform .2s, box-shadow .2s;
    animation: wa-pulse 2.5s infinite;
}
.whatsapp-btn:hover { transform: scale(1.1); animation: none; box-shadow: 0 6px 24px rgba(37,211,102,.55); }
@keyframes wa-pulse {
    0%,100% { box-shadow: 0 4px 18px rgba(37,211,102,.4); }
    50%      { box-shadow: 0 4px 24px rgba(37,211,102,.65), 0 0 0 7px rgba(37,211,102,.1); }
}

/* ---- Responsive ---- */
@media (max-width: 1024px) {
    .site-main { grid-template-columns: 160px 1fr; gap: 20px; padding: 20px 20px 40px; }
    .products-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
}
@media (max-width: 768px) {
    .header-inner { padding: 0 16px; }
    .site-main { grid-template-columns: 1fr; padding: 16px 16px 40px; }
    .sidebar { position: static; }
    .product-detail { grid-template-columns: 1fr; }
    .checkout-grid { grid-template-columns: 1fr; }
    .form-row { grid-template-columns: 1fr; }
}
/* ============================================================
   PATCH — Stock bajo + Barra envío gratis
   Agregar al final de assets/css/style.css
   ============================================================ */

/* ---- Barra de envío gratis ---- */
.envio-bar {
    background: var(--white);
    border-bottom: 1.5px solid var(--border);
    padding: 8px 32px;
    font-size: .82rem;
    color: var(--body);
}
.envio-bar-inner {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 14px;
}
.envio-bar-text { white-space: nowrap; min-width: 220px; }
.envio-bar-text strong { color: var(--sage); }
.envio-progress-wrap {
    flex: 1;
    background: var(--beige2);
    border-radius: 999px;
    height: 7px;
    overflow: hidden;
    border: 1px solid var(--border);
}
.envio-progress-bar {
    height: 100%;
    background: var(--sage);
    border-radius: 999px;
    transition: width .5s ease;
    min-width: 4px;
}
.envio-bar-icon { font-size: 1rem; flex-shrink: 0; }

/* ---- Stock bajo en tarjeta ---- */
.stock-bajo {
    font-size: .72rem;
    color: #8a2a20;
    font-weight: 500;
    margin-top: 4px;
    display: flex;
    align-items: center;
    gap: 4px;
}
.stock-bajo::before {
    content: '';
    display: inline-block;
    width: 6px; height: 6px;
    background: #c0392b;
    border-radius: 50%;
    animation: pulse-red 1.5s infinite;
}
@keyframes pulse-red {
    0%,100% { opacity: 1; }
    50%      { opacity: .4; }
}

/* ---- Stock bajo en detalle de producto ---- */
.stock-badge-bajo {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #fdf0ee;
    border: 1.5px solid #e8b8b4;
    color: #8a2a20;
    border-radius: 999px;
    padding: 4px 12px;
    font-size: .78rem;
    font-weight: 500;
}
.stock-badge-ok {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--sage-bg);
    border: 1.5px solid var(--sage-border);
    color: var(--sage-dark);
    border-radius: 999px;
    padding: 4px 12px;
    font-size: .78rem;
    font-weight: 500;
}
/* ============================================================
   Productos vistos recientemente — fila horizontal con scroll
   Agregar al final de assets/css/style.css
   ============================================================ */

.recientes-wrap {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 32px 48px;
    border-top: 1.5px solid var(--border);
    padding-top: 28px;
    margin-top: 8px;
}
.recientes-titulo {
    font-family: 'DM Serif Display', serif;
    font-size: 1rem;
    font-weight: 400;
    color: var(--dark);
    margin-bottom: 14px;
}
.recientes-scroll {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding-bottom: 10px;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}
.recientes-scroll::-webkit-scrollbar { height: 4px; }
.recientes-scroll::-webkit-scrollbar-track { background: transparent; }
.recientes-scroll::-webkit-scrollbar-thumb { background: var(--border); border-radius: 999px; }

.reciente-card {
    flex-shrink: 0;
    width: 120px;
    background: var(--white);
    border: 1.5px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
    transition: transform .18s, box-shadow .18s;
    text-decoration: none;
    color: inherit;
    display: block;
}
.reciente-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(30,26,21,.1);
}
.reciente-card img {
    width: 100%;
    height: 100px;
    object-fit: cover;
    background: var(--beige);
    display: block;
}
.reciente-card-body {
    padding: 8px 10px 10px;
}
.reciente-card-name {
    font-size: .72rem;
    font-weight: 500;
    color: var(--dark);
    line-height: 1.3;
    margin-bottom: 4px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.reciente-card-price {
    font-size: .75rem;
    color: var(--sage);
    font-weight: 500;
}
.reciente-card-price-old {
    font-size: .68rem;
    color: var(--muted);
    text-decoration: line-through;
    margin-right: 3px;
}
