
@font-face{font-family:'Montserrat';font-weight:700;font-style:normal;font-display:swap;src:url('../../assets/fonts/montserrat-700.woff2') format('woff2')}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --bg: #f5f7fa;
    --surface: #ffffff;
    --text: #202938;
    --muted: #64748b;
    --border: #e5e7eb;
    --accent: #1d4ed8;
    --accent-light: #eff6ff;
    --accent-hover: #1e40af;
    --danger: #dc2626;
}

body { font-family: Arial, Helvetica, sans-serif; background: var(--bg); color: var(--text); min-height: 100vh; }

html.modal-open,
body.modal-open {
    overflow: hidden !important;
    overscroll-behavior: none;
}

/* ========== HEADER ========== */
header {
  background: var(--surface); border-bottom: 1px solid var(--border);
  padding: 0 5%; display: flex; align-items: center;
  justify-content: space-between; height: 76px; position: sticky; top: 0; z-index: 100;
}

.logo { display: flex; align-items: center; gap: 12px; font-family: Arial, Helvetica, sans-serif; font-size: 18px; font-weight: 800; letter-spacing: -0.5px; color: #172554; }
.logo span { font-family: 'DM Sans', sans-serif; }
.logo img { width: 46px; height: 46px; object-fit: cover; }

.header-right { display: flex; align-items: center; gap: 12px; }

.search-bar {
  display: flex; align-items: center; background: #f5f7fa;
  border: 1px solid var(--border); border-radius: 8px;
  padding: 0 12px; height: 36px; gap: 8px; width: 220px;
}
.search-bar input { border: none; background: transparent; font-family: Arial, sans-serif; font-size: 13px; color: var(--text); outline: none; width: 100%; }
.search-bar input::placeholder { color: var(--muted); }

.search-box { position: relative; display: inline-block; }
.search-box input { height: 36px; line-height: normal; padding: 0 30px 0 0; font-size: 13px; }
.search-box button {
    position: absolute;
    right: 5px;
    top: 50%;
    transform: translateY(-50%);
    border: none;
    background: transparent;
    font-size: 20px;
    cursor: pointer;
}

.icon-btn {
  background: #fff; border: 1px solid var(--border); border-radius: 8px;
  width: 36px; height: 36px; display: flex; align-items: center;
  justify-content: center; cursor: pointer; position: relative; transition: background 0.15s;
}
.icon-btn:hover { background: var(--accent-light); }

.cart-badge {
  position: absolute; top: -6px; right: -6px; background: var(--accent);
  color: white; font-size: 10px; font-weight: 500; border-radius: 10px;
  min-width: 18px; height: 18px; display: flex; align-items: center;
  justify-content: center; padding: 0 4px;
}

#filterBtn { display: none; }
#favBtn { color: var(--muted) !important; }
#favBtn.active { color: #e74c3c !important; background: #fdecea; }

/* ========== LAYOUT / SIDEBAR ========== */
.layout { display: grid; grid-template-columns: 220px 1fr; min-height: calc(100vh - 64px); }

aside { position: sticky; top: 64px; height: calc(100vh - 64px); overflow-y: auto; background: #fff; border-right: 1px solid var(--border); padding: 1.5rem; }

.sidebar-section { margin-bottom: 2rem; }
.sidebar-title { font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); margin-bottom: 0.75rem; }
.sidebar-close { display: none; }

.category-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 7px 10px; border-radius: 7px; cursor: pointer;
  font-size: 14px; color: var(--text); transition: background 0.12s; margin-bottom: 2px;
}
.category-item:hover { background: #f1f5f9; }
.category-item.active { background: var(--accent-light); color: var(--accent); font-weight: 500; }
.category-item.active .category-count { background: var(--accent); color: white; }

.category-count { font-size: 12px; color: var(--muted); background: #f1f5f9; padding: 2px 7px; border-radius: 10px; }

.price-range { display: flex; flex-direction: column; gap: 10px; }
input[type=range] { width: 100%; accent-color: var(--accent); }
.price-labels { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); }

.tag-list { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { font-size: 12px; padding: 4px 10px; border-radius: 20px; background: #f8fafc; border: 1px solid var(--border); color: var(--text); cursor: pointer; transition: all 0.12s; }
.tag:hover, .tag.active { background: var(--accent); color: white; border-color: var(--accent); }

.filter-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.3); z-index: 140; }
.filter-overlay.open { display: block; }

/* ========== PRODUCTOS ========== */
main { padding: 1.5rem 2rem; }
.toolbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.5rem; }
.results-count { font-size: 13px; color: var(--muted); }
.results-count strong { color: var(--text); }
.sort-select { font-family: Arial, sans-serif; font-size: 13px; border: 1px solid var(--border); border-radius: 8px; padding: 6px 10px; background: var(--surface); color: var(--text); cursor: pointer; outline: none; }

.product-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 20px; }

.product-card { background: #fff; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; cursor: pointer; transition: box-shadow .2s, transform .2s; display: flex; flex-direction: column; }
.product-card:hover { transform: translateY(-3px); box-shadow: 0 8px 25px #00000010; }

.product-img { width: 100%; height: auto; aspect-ratio: 1; display: flex; align-items: center; justify-content: center; font-size: 48px; background: #fff; position: relative; object-fit: contain; padding: 12px; }

.product-badge { position: absolute; top: 8px; left: 8px; font-size: 10px; font-weight: 500; padding: 3px 8px; border-radius: 6px; }
.badge-new { background: var(--accent); color: white; }
.badge-sale { background: var(--danger); color: white; }

.product-info { padding: 16px; display: flex; flex-direction: column; flex: 1; }
.product-cat { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 4px; }
.product-name { font-size: 15px; font-weight: 700; margin-bottom: 6px; line-height: 1.45; text-transform: capitalize; flex: 1; }
.product-footer { display: flex; align-items: center; justify-content: space-between; margin-top: auto; }
.product-price { font-size: 20px; font-weight: 800; color: #15803d; }
.product-old-price { font-size: 12px; color: var(--muted); text-decoration: line-through; margin-left: 4px; }

.fav-btn { font-size: 25px; cursor: pointer; color: var(--border); transition: color 0.15s; line-height: 1; }
.fav-btn.active, .fav-btn:hover { color: #e74c3c; }

.add-btn { background: var(--accent); color: white; border: none; border-radius: 7px; width: 30px; height: 30px; font-size: 18px; display: flex; align-items: center; justify-content: center; cursor: pointer; transition: background 0.12s; line-height: 1; }
.add-btn:hover { background: var(--accent-hover); }

.btn-ver-producto {
    width: 100%;
    margin-top: 10px;
    padding: 9px;
    border: 1px solid var(--accent);
    border-radius: 6px;
    background: var(--accent);
    color: #fff;
    font-weight: 600;
    cursor: pointer;
    transition: .2s;
    text-decoration: none;
    text-align: center;
}
.btn-ver-producto:hover { background: #fff; color: var(--accent); }

/* ========== PAGINACIÓN ========== */
.pagination { display: flex; justify-content: center; gap: 6px; margin-top: 2rem; }
.page-btn { width: 34px; height: 34px; border: 1px solid var(--border); background: #fff; border-radius: 7px; cursor: pointer; font-size: 13px; display: flex; align-items: center; justify-content: center; }
.page-btn.active { background: var(--accent); color: white; border-color: var(--accent); }
.page-btn:hover:not(.active) { background: var(--accent-light); }

/* ========== CARRITO ========== */
.cart-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.3); z-index: 200; }
.cart-overlay.open { display: block; }

.cart-panel { position: fixed; top: 0; right: -400px; width: 360px; height: 100vh; background: #fff; border-left: 1px solid var(--border); z-index: 201; display: flex; flex-direction: column; transition: right 0.25s cubic-bezier(0.4,0,0.2,1); }
.cart-panel.open { right: 0; }

.cart-header { padding: 1.25rem 1.5rem; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.cart-title, .modal-title { font-family: Arial, sans-serif; font-size: 18px; font-weight: 700; }
.close-btn { background: none; border: none; font-size: 20px; cursor: pointer; color: var(--muted); line-height: 1; }
.cart-items { flex: 1; overflow-y: auto; padding: 1rem 1.5rem; }
.cart-empty { text-align: center; color: var(--muted); font-size: 14px; padding: 3rem 0; }

.cart-item { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); align-items: center; }
.cart-item-emoji { font-size: 32px; width: 48px; height: 48px; display: flex; align-items: center; justify-content: center; background: var(--bg); border-radius: 8px; }
.cart-item-info { flex: 1; }
.cart-item-name { font-size: 13px; font-weight: 500; }
.cart-item-price { font-size: 12px; color: var(--muted); }
.cart-item-qty { display: flex; align-items: center; gap: 8px; }
.qty-btn { background: var(--bg); border: 1px solid var(--border); border-radius: 6px; width: 24px; height: 24px; cursor: pointer; font-size: 14px; display: flex; align-items: center; justify-content: center; }
.qty-num { font-size: 13px; font-weight: 500; min-width: 16px; text-align: center; }

.cart-footer { padding: 1.25rem 1.5rem; border-top: 1px solid var(--border); }
.cart-total { display: flex; justify-content: space-between; font-size: 15px; font-weight: 500; margin-bottom: 1rem; }

.checkout-btn { width: 100%; background: var(--accent); color: white; border: none; border-radius: 8px; padding: 13px; font-family: Arial, sans-serif; font-size: 14px; font-weight: 700; cursor: pointer; transition: background 0.12s; }
.checkout-btn:hover { background: var(--accent-hover); }

.clear-btn { width: 100%; background: none; border: 1px solid var(--border); border-radius: 8px; padding: 10px; font-family: 'DM Sans', sans-serif; font-size: 13px; color: var(--muted); cursor: pointer; margin-bottom: 10px; transition: all 0.12s; }
.clear-btn:hover { border-color: var(--danger); color: var(--danger); }

.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(80px); background: var(--accent); color: white; padding: 10px 20px; border-radius: 8px; font-size: 13px; font-weight: 500; z-index: 300; transition: transform 0.3s cubic-bezier(0.4,0,0.2,1); white-space: nowrap; }
.toast.show { transform: translateX(-50%) translateY(0); }

/* ========== MODALES ========== */
.modal-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.4); z-index: 300; align-items: flex-start; padding-top: 60px; justify-content: center; }
.modal-overlay.open { display: flex; overflow-y: auto; align-items: flex-start; padding-bottom: 30px;}
.modal { background: var(--surface); border-radius: 12px; width: 420px; overflow: hidden; }
.modal-header { padding: 1.25rem 1.5rem; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.modal-body { padding: 1.5rem; display: flex; flex-wrap: wrap; gap: 12px; }
.modal-body input { width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; font-family: Arial, sans-serif; font-size: 14px; outline: none; }
.input-full { width: 100% !important; }
.input-half { width: calc(50% - 6px) !important; }
.modal-body input:focus { border-color: var(--accent); }
.modal-footer { padding: 1rem 1.5rem; border-top: 1px solid var(--border); }

/* ========== VISTA DEL PRODUCTO ========== */
.preview-panel {
  max-height: calc(100vh - 30px);
  overflow-y: auto;
  width: min(1100px, 95vw);
  min-height: 0;
  height: min(750px, calc(100vh - 60px));  
  background: var(--surface);
  border-radius: 12px;
  box-shadow: 0 10px 35px #00000015;
  display: grid;
  grid-template-columns: 1fr 1fr;
  position: relative;
  margin: 30px auto;
  flex-shrink: 0;
}

.preview-img {
  background: #fff;
  height: 100%;
  min-height: 400px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.preview-img img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  position: relative;
}

.preview-info {
  padding: 2rem;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.preview-cat { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
.preview-name { font-family: Arial, sans-serif; font-size: 22px; font-weight: 700; line-height: 1.3; }
.preview-price { font-size: 24px; font-weight: 800; color: #15803d; }
.preview-specs { flex: 1; }
.preview-specs table { width: 100%; font-size: 13px; border-collapse: collapse; }
.preview-specs td { padding: 6px 0; border-bottom: 1px solid var(--border); }
.preview-specs td:first-child { color: var(--muted); width: 40%; }
.preview-actions { display: flex; gap: 10px; }

/* ========== CARRUSEL ========== */
.product-carousel { position: relative; width: 100%; height: 100%; }

/* Estilo común de las flechas (tarjeta y modal) */
.product-carousel .prev-img,
.product-carousel .next-img,
.preview-img .prev-img,
.preview-img .next-img {
    position: absolute !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    border-radius: 50%;
    border: 0;
    background: rgba(30,40,45,.65);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.product-carousel .prev-img,
.product-carousel .next-img {
    width: 34px !important;
    height: 34px !important;
    font-size: 26px;
    z-index: 10;
}
/* izquierda */
.product-carousel .prev-img { left: 10px !important; right: auto !important; }
/* derecha */
.product-carousel .next-img { right: 10px !important; left: auto !important; }

/* Flechas del modal */
.preview-img .prev-img,
.preview-img .next-img {
    width: 38px;
    height: 38px;
    font-size: 30px;
    cursor: pointer;
    z-index: 20;
    line-height: 1;
    left: 12px !important;
    right: auto !important;
}
.preview-img .prev-img:hover,
.preview-img .next-img:hover { background: rgba(30,40,45,.9); }

/* ========== BOTÓN BOLD ========== */
.bold-btn {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    height: 48px;
    padding: 16px 32px;
    border: none;
    border-radius: 32px;
    color: #fff;
    background: linear-gradient(270deg, #ff2947 13.86%, #121e6c 83.33%);
    font-family: Arial, sans-serif;
    font-size: 14px;
    line-height: 20px;
    font-weight: 500;
    cursor: pointer;
    user-select: none;
    position: relative;
}
.bold-btn:hover { opacity: .92; }
.bold-btn strong { font-weight: 700; }

/* ========== RESPONSIVE ========== */
@media (max-width: 1100px) {
    .product-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 768px) {
    #filterBtn { display: flex; }

    .layout { grid-template-columns: 1fr; }

    aside {
        position: fixed;
        top: 0;
        left: -280px;
        width: 280px;
        height: 100vh;
        z-index: 150;
        transition: left 0.25s cubic-bezier(0.4,0,0.2,1);
        padding-top: 4rem;
    }
    aside.open { left: 0; }

    header { height: 65px; padding: 0 12px; }

    .logo span { font-size: 13px; }
    .logo img { width: 38px; height: 38px; }

    .product-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }

    main { padding: 16px 12px; }

    .product-info { padding: 12px; }
    .product-name { font-size: 13px; }
    .product-price { font-size: 17px; }
    .product-img { padding: 8px; }

    .search-bar { width: 150px; }
    .search-box { height: 50px; }
    .search-box input { height: 60px; padding-right: 30px; }

    .cart-panel { right: -100%; width: 100%; }

    .modal { width: 95%; margin: 0 auto; }

    .sidebar-close { display: flex; justify-content: flex-end; margin-bottom: 1rem; }
    .sidebar-close button { background: none; border: none; font-size: 20px; cursor: pointer; color: var(--muted); }

    .razon-tienda { display: none !important; }

    .preview-panel {
        width: 95vw;
        height: auto;
        min-height: 0;
        grid-template-columns: 1fr;
        margin: 15px auto;
        overflow-y: auto;
        max-height: 92vh;
    }
      .preview-img {
        height: 350px;
        min-height: 350px;
    }

    .preview-info {
        padding: 1.25rem;
    }

    .preview-name {
        font-size: 20px;
    }

    #previewCarousel { width: 100%; min-width: 0; overflow: hidden; }
    #previewImg { width: 100% !important; max-width: 100%; object-fit: contain; }
}

@media (max-width: 380px) {
    .search-bar { width: 125px; }
    .logo span { font-size: 11px; }
}