:root {
    --primary-blue: #4A90E2;
    --light-blue: #E8F1FC;
    --hover-blue: #357ABD;
    --white: #FFFFFF;
    --bg-color: #F8FAFC;
    --text-main: #1A202C;
    --text-muted: #718096;
    --border-color: #E2E8F0;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.05);
    --shadow-lg: 0 10px 25px rgba(0,0,0,0.1);
    --wa-green: #25D366;
    --ml-yellow: #FFF159;
    --radius: 10px;
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    line-height: 1.6;
}

/* ── HEADER ─────────────────────────────────────────────────── */
.header {
    background: var(--white);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 200;
    border-bottom: 1px solid var(--border-color);
}

.header-container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0.9rem 2rem;
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.logo img {
    height: 48px;
    object-fit: contain;
    flex-shrink: 0;
}

.search-bar {
    flex: 1;
    display: flex;
    max-width: 580px;
    border: 1.5px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
    transition: border-color 0.2s;
}
.search-bar:focus-within { border-color: var(--primary-blue); }

.search-bar input {
    flex: 1;
    padding: 0.7rem 1rem;
    border: none;
    outline: none;
    font-size: 0.95rem;
    font-family: inherit;
    background: transparent;
}

.search-bar button {
    padding: 0 1.2rem;
    background: var(--light-blue);
    border: none;
    cursor: pointer;
    color: var(--primary-blue);
    font-size: 1rem;
    transition: background 0.2s;
}
.search-bar button:hover { background: var(--primary-blue); color: var(--white); }

.cart-icon {
    position: relative;
    font-size: 1.4rem;
    color: var(--primary-blue);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 8px;
    transition: background 0.2s;
    margin-left: auto;
}
.cart-icon:hover { background: var(--light-blue); }

.cart-count {
    position: absolute;
    top: -2px;
    right: -4px;
    background: var(--primary-blue);
    color: var(--white);
    font-size: 0.7rem;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
}

/* ── LAYOUT ──────────────────────────────────────────────────── */
.main-content {
    max-width: 1280px;
    margin: 1.5rem auto;
    padding: 0 2rem;
    display: flex;
    gap: 2rem;
    align-items: flex-start;
}

/* ── SIDEBAR ─────────────────────────────────────────────────── */
.sidebar {
    width: 220px;
    flex-shrink: 0;
    background: var(--white);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 1.2rem;
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 80px;
}

.filter-group h3 {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin-bottom: 0.8rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

.filter-group ul { list-style: none; }

.filter-group li { margin: 2px 0; }

.filter-group button {
    background: none;
    border: none;
    padding: 0.5rem 0.75rem;
    color: var(--text-muted);
    cursor: pointer;
    text-align: left;
    width: 100%;
    font-size: 0.88rem;
    font-family: inherit;
    border-radius: 6px;
    transition: background 0.15s, color 0.15s;
}
.filter-group button:hover  { background: var(--light-blue); color: var(--primary-blue); }
.filter-group button.active { background: var(--light-blue); color: var(--primary-blue); font-weight: 600; }

/* ── PRODUCTS ────────────────────────────────────────────────── */
.products { flex: 1; min-width: 0; }

.products-header {
    display: flex;
    align-items: baseline;
    gap: 0.8rem;
    margin-bottom: 1.2rem;
}

.products-header h1 { font-size: 1.3rem; font-weight: 600; }

.products-header span { color: var(--text-muted); font-size: 0.85rem; }

.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: 1.2rem;
}

.no-results {
    grid-column: 1/-1;
    text-align: center;
    color: var(--text-muted);
    padding: 3rem;
}

/* ── PRODUCT CARD ────────────────────────────────────────────── */
.product-card {
    background: var(--white);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    cursor: pointer;
    display: flex;
    flex-direction: column;
}
.product-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}

/* Image wrapper */
.product-image-wrapper {
    position: relative;
    width: 100%;
    height: 185px;
    background: #F0F5FF;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
}

.product-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    padding: 1rem;
}

/* Impression badge (top-left of image) */
.badge-impr {
    position: absolute;
    top: 8px;
    left: 8px;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.badge-fullcolor { background: #EBF8FF; color: #2B6CB0; border: 1px solid #BEE3F8; }
.badge-unicolor  { background: #F0FFF4; color: #276749; border: 1px solid #C6F6D5; }
.badge-sinimpr   { background: #F7FAFC; color: #718096; border: 1px solid #E2E8F0; }

/* Card info */
.product-info {
    padding: 1rem;
    display: flex;
    flex-direction: column;
    flex: 1;
    gap: 0.3rem;
}

.product-title {
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--text-main);
    line-height: 1.3;
}

.product-material {
    font-size: 0.78rem;
    color: var(--text-muted);
}

.product-medidas {
    font-size: 0.75rem;
    color: var(--primary-blue);
    display: flex;
    align-items: center;
    gap: 5px;
    margin-top: 2px;
}

/* Personalizable badge */
.badge-personalizable {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.7rem;
    font-weight: 600;
    color: #744210;
    background: #FEFCBF;
    border: 1px solid #F6E05E;
    padding: 4px 8px;
    border-radius: 5px;
    margin-top: 4px;
}
.badge-personalizable.large {
    font-size: 0.82rem;
    padding: 6px 12px;
    margin-bottom: 1rem;
}

.btn-add-cart {
    margin-top: auto;
    padding-top: 0.7rem;
    background: var(--light-blue);
    color: var(--primary-blue);
    border: none;
    padding: 0.6rem;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.85rem;
    font-family: inherit;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: background 0.2s, color 0.2s;
}
.btn-add-cart:hover { background: var(--primary-blue); color: var(--white); }
.btn-add-cart.full-width { width: 100%; padding: 0.85rem; font-size: 1rem; }

/* ── MODAL ───────────────────────────────────────────────────── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s;
}
.modal-overlay.active { opacity: 1; pointer-events: all; }

.modal {
    background: var(--white);
    border-radius: 14px;
    width: 90%;
    max-width: 820px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    box-shadow: var(--shadow-lg);
    transform: translateY(16px) scale(0.98);
    transition: transform 0.25s;
}
.modal-overlay.active .modal { transform: translateY(0) scale(1); }

.close-modal {
    position: absolute;
    top: 1rem; right: 1rem;
    background: var(--bg-color);
    border: none;
    border-radius: 50%;
    width: 36px; height: 36px;
    font-size: 1rem;
    color: var(--text-muted);
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: background 0.2s;
    z-index: 10;
}
.close-modal:hover { background: var(--border-color); }

.modal-content {
    display: flex;
    flex-wrap: wrap;
    padding: 2rem;
    gap: 2rem;
}

.modal-image-container {
    flex: 1;
    min-width: 260px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    background: #F0F5FF;
    border-radius: 10px;
    padding: 1.5rem;
}

.modal-image {
    max-width: 100%;
    max-height: 320px;
    object-fit: contain;
}

.modal-img-hint {
    font-size: 0.72rem;
    color: var(--text-muted);
    text-align: center;
    line-height: 1.5;
}
.modal-img-hint code {
    background: var(--border-color);
    padding: 1px 5px;
    border-radius: 3px;
    font-size: 0.68rem;
}

.modal-details { flex: 1; min-width: 260px; }

.modal-title { font-size: 1.4rem; font-weight: 700; margin-bottom: 0.4rem; }

.modal-specs {
    list-style: none;
    margin-bottom: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.modal-specs li {
    font-size: 0.9rem;
    padding: 0.5rem 0.8rem;
    background: var(--bg-color);
    border-radius: 6px;
    border-left: 3px solid var(--primary-blue);
}

/* ── CART DRAWER ─────────────────────────────────────────────── */
.cart-drawer-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s;
}
.cart-drawer-overlay.active { opacity: 1; pointer-events: all; }

.cart-drawer {
    position: absolute;
    top: 0; right: -420px;
    width: 420px;
    max-width: 100%;
    height: 100%;
    background: var(--white);
    box-shadow: -8px 0 24px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
    transition: right 0.3s ease;
}
.cart-drawer-overlay.active .cart-drawer { right: 0; }

.cart-header {
    padding: 1.2rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--white);
}
.cart-header h2 { font-size: 1.1rem; font-weight: 700; }

.close-cart {
    background: none; border: none; font-size: 1.1rem;
    color: var(--text-muted); cursor: pointer;
    padding: 5px; border-radius: 6px;
}
.close-cart:hover { background: var(--bg-color); }

.cart-items {
    flex: 1;
    overflow-y: auto;
    padding: 1rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.cart-empty {
    text-align: center;
    color: var(--text-muted);
    padding: 2rem;
    font-size: 0.9rem;
}

.cart-item {
    display: flex;
    gap: 0.8rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.cart-item-img {
    width: 64px; height: 64px;
    object-fit: contain;
    border-radius: 8px;
    background: #F0F5FF;
    padding: 4px;
    flex-shrink: 0;
}

.cart-item-details { flex: 1; }

.cart-item-title { font-size: 0.88rem; font-weight: 600; margin-bottom: 2px; }
.cart-item-sub   { font-size: 0.75rem; color: var(--text-muted); }
.cart-item-medidas { font-size: 0.72rem; color: var(--primary-blue); margin-top: 2px; }

.cart-item-remove {
    background: none; border: none;
    color: #E53E3E; cursor: pointer;
    font-size: 0.75rem; margin-top: 4px;
    padding: 2px 0;
    display: flex; align-items: center; gap: 4px;
}

.cart-footer {
    padding: 1.2rem 1.5rem;
    border-top: 1px solid var(--border-color);
    background: var(--bg-color);
}

.cart-total {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 0.8rem;
    gap: 0.5rem;
}
.cart-total span:last-child {
    color: var(--primary-blue);
    font-size: 0.82rem;
    text-align: right;
}

.checkout-options { display: flex; flex-direction: column; gap: 0.7rem; }

.checkout-hint {
    font-size: 0.78rem;
    color: var(--text-muted);
    text-align: center;
    margin-bottom: 0.2rem;
}

.btn {
    padding: 0.85rem;
    border-radius: 8px;
    border: none;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    transition: filter 0.2s;
}
.btn i { font-size: 1.1rem; }
.btn small { font-weight: 400; font-size: 0.68rem; opacity: 0.85; }
.btn:hover { filter: brightness(0.92); }
.btn-whatsapp     { background: var(--wa-green); color: var(--white); }
.btn-mercadolibre { background: var(--ml-yellow); color: #333; }

/* ── RESPONSIVE ──────────────────────────────────────────────── */
@media (max-width: 900px) {
    .main-content { flex-direction: column; padding: 0 1rem; }
    .sidebar {
        width: 100%;
        position: static;
        overflow-x: auto;
    }
    .filter-group ul { display: flex; flex-wrap: wrap; gap: 6px; }
    .filter-group h3 { display: none; }
    .filter-group button {
        white-space: nowrap;
        border: 1px solid var(--border-color);
        border-radius: 20px;
    }
    .modal-content { flex-direction: column; }
}

@media (max-width: 480px) {
    .header-container { flex-wrap: wrap; }
    .search-bar { order: 3; flex: 1 1 100%; max-width: 100%; }
    .product-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
}
