/* ============================================
   DICENTER | Tecnología y Hogar
   style.css
   ============================================ */

/* === VARIABLES === */
:root {
  --bg:          #12141a;
  --surface:     #1c1f28;
  --sidebar:     #181b23;
  --card:        #1f2230;
  --border:      #2a2e3d;
  --accent:      #1a56db;
  --accent-h:    #1e4fc7;
  --accent-glow: rgba(26, 86, 219, 0.25);
  --accent2:     #38bdf8;
  --text:        #e8eaf0;
  --text-dim:    #7c8299;
  --text-muted:  #50556a;
  --sidebar-w:   260px;
  --header-h:    68px;
  --green:       #22c55e;
}

/* === RESET === */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}

/* ============================================
   HEADER
   ============================================ */
.header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--header-h);
  background: var(--sidebar);
  border-bottom: 1px solid var(--border);
  z-index: 9000;
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 18px;
}

.logo-wrap {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  cursor: pointer;
  width: var(--sidebar-w);
  padding-right: 14px;
}

.logo-wrap img {
  height: 44px;
  width: auto;
  object-fit: contain;
  filter: none;
}

.logo-fallback {
  display: none;
  font-family: 'Syne', sans-serif;
  font-size: 22px;
  font-weight: 800;
  color: #fff;
  letter-spacing: -1px;
}
.logo-fallback em {
  color: var(--accent2);
  font-style: normal;
}

.search-wrap {
  flex: 1;
  max-width: 580px;
  position: relative;
}

.search-wrap input {
  width: 100%;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  padding: 10px 44px 10px 16px;
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}

.search-wrap input::placeholder { color: var(--text-muted); }

.search-wrap input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.search-icon {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 16px;
  pointer-events: none;
}

.header-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.btn-hdr {
  padding: 9px 16px;
  border-radius: 8px;
  border: none;
  font-family: 'DM Sans', sans-serif;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  transition: opacity .2s, transform .15s;
  white-space: nowrap;
}
.btn-hdr:hover { opacity: .88; transform: translateY(-1px); }

.btn-support  { background: var(--border); color: var(--text); }
.btn-software { background: #2d3250; color: var(--accent2); border: 1px solid var(--border); }
.btn-wa       { background: var(--green); color: #fff; display: flex; align-items: center; gap: 5px; }

/* ============================================
   LAYOUT
   ============================================ */
.layout {
  display: flex;
  margin-top: var(--header-h);
  min-height: calc(100vh - var(--header-h));
}

/* ============================================
   SIDEBAR
   ============================================ */
.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar);
  border-right: 1px solid var(--border);
  position: fixed;
  top: var(--header-h);
  bottom: 0;
  left: 0;
  overflow-y: auto;
  overflow-x: visible;
  z-index: 8000;
  transition: transform .35s cubic-bezier(.4, 0, .2, 1);
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

.nav-section { padding: 8px 0; }
.nav-section + .nav-section { border-top: 1px solid var(--border); }

.nav-item {
  position: relative;
}

.nav-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 16px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-dim);
  cursor: pointer;
  user-select: none;
  transition: color .15s, background .15s;
  letter-spacing: .01em;
  gap: 6px;
}

.nav-label .ico   { font-size: 15px; flex-shrink: 0; }
.nav-label .lbl   { flex: 1; }
.nav-label .arrow { font-size: 9px; opacity: .45; transition: transform .2s, opacity .2s; flex-shrink: 0; }

/* --- Hover en Desktop: lo maneja JavaScript --- */
@media (min-width: 769px) {
  .nav-item:hover > .nav-label {
    color: var(--accent2);
    background: rgba(26, 86, 219, .1);
  }
  .nav-item:hover > .nav-label .arrow {
    transform: rotate(90deg);
    opacity: 1;
  }
  /* El flyout original queda oculto siempre en desktop — JS mueve el contenido */
  .nav-item .flyout { display: none !important; }
}

/* ============================================
   FLYOUT PANEL — posicionado por JS en body
   ============================================ */
#flyoutPanel {
  filter: drop-shadow(14px 8px 20px rgba(0,0,0,.7));
}

#flyoutPanel .flyout-inner {
  background: var(--card);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 0 12px 12px 0;
  padding: 8px 0;
  max-height: 80vh;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
  min-width: 220px;
}

#flyoutPanel .flyout-inner.wide {
  min-width: 380px;
  display: grid;
  grid-template-columns: 1fr 1fr;
}

#flyoutPanel .flyout-inner a {
  display: block;
  padding: 9px 18px;
  font-size: 13px;
  color: var(--text-dim);
  text-decoration: none;
  border-bottom: 1px solid rgba(255,255,255,.03);
  transition: color .15s, background .15s, padding-left .15s;
  cursor: pointer;
}
#flyoutPanel .flyout-inner a:last-child { border-bottom: none; }
#flyoutPanel .flyout-inner a:hover {
  color: var(--accent2);
  background: rgba(26,86,219,.1);
  padding-left: 24px;
}

.sidebar-sec-title {
  padding: 14px 16px 4px;
  font-size: 10px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 700;
}

/* ============================================
   MAIN CONTENT
   ============================================ */
.main {
  margin-left: var(--sidebar-w);
  flex: 1;
  padding: 28px;
  min-width: 0;
}

/* ============================================
   HERO BANNERS
   ============================================ */
.hero-grid {
  display: grid;
  grid-template-columns: 1.7fr 1fr;
  grid-template-rows: 200px 200px;
  gap: 14px;
  margin-bottom: 32px;
}

.hero-card {
  border-radius: 16px;
  position: relative;
  overflow: hidden;
  cursor: pointer;
  display: flex;
  align-items: flex-end;
  transition: transform .25s;
}
.hero-card:hover { transform: scale(1.012); }
.hero-card.span2 { grid-row: span 2; }

.hc-1 { background: linear-gradient(135deg, #0d3a8e 0%, #051d55 100%); }
.hc-2 { background: linear-gradient(135deg, #1c1c2e 0%, #2a2a40 100%); }
.hc-3 { background: linear-gradient(135deg, #0a3d2e 0%, #052318 100%); }

.hero-dots {
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(255,255,255,.07) 1px, transparent 1px);
  background-size: 20px 20px;
}

.hero-circle {
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, .05);
}
.hero-circle.c1 { width: 260px; height: 260px; right: -60px; top: -60px; }
.hero-circle.c2 { width: 130px; height: 130px; right: 60px;  bottom: -50px; }

.hero-content {
  position: relative;
  z-index: 2;
  padding: 22px 26px;
}

.hero-tag {
  display: inline-block;
  background: rgba(255,255,255,.15);
  color: rgba(255,255,255,.85);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  padding: 3px 9px;
  border-radius: 20px;
  margin-bottom: 7px;
}

.hero-title {
  font-family: 'Syne', sans-serif;
  color: #fff;
  font-size: 26px;
  font-weight: 800;
  line-height: 1.1;
  margin-bottom: 5px;
}
.hero-card:not(.span2) .hero-title { font-size: 18px; }

.hero-sub {
  color: rgba(255,255,255,.6);
  font-size: 13px;
  margin-bottom: 13px;
}
.hero-card:not(.span2) .hero-sub { font-size: 11px; }

.hero-cta {
  display: inline-block;
  background: #fff;
  color: #111;
  font-weight: 700;
  font-size: 12px;
  padding: 7px 15px;
  border-radius: 50px;
  transition: transform .2s;
}
.hero-card:hover .hero-cta { transform: translateX(4px); }

/* ============================================
   SECTION HEADER
   ============================================ */
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.section-title {
  font-family: 'Syne', sans-serif;
  font-size: 20px;
  font-weight: 800;
}
.section-title span { color: var(--accent2); }

.btn-reset {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-dim);
  padding: 7px 13px;
  border-radius: 8px;
  font-size: 12px;
  font-family: 'DM Sans', sans-serif;
  cursor: pointer;
  transition: all .2s;
}
.btn-reset:hover { border-color: var(--accent); color: var(--accent); }

/* ============================================
   FILTER BAR
   ============================================ */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.chip {
  padding: 7px 15px;
  border-radius: 8px;
  border: 1.5px solid var(--border);
  background: transparent;
  color: var(--text-dim);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  transition: all .15s;
  font-family: 'DM Sans', sans-serif;
}
.chip:hover { border-color: var(--accent); color: var(--accent); }
.chip.on    { border-color: var(--accent); background: var(--accent); color: #fff; }

.prod-count { margin-left: auto; font-size: 12px; color: var(--text-muted); }

/* ============================================
   PRODUCT GRID
   ============================================ */
.prod-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 50px;
}

.prod-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  cursor: pointer;
  transition: border-color .2s, transform .2s, box-shadow .2s;
  display: flex;
  flex-direction: column;
  position: relative;
}
.prod-card:hover {
  border-color: var(--accent);
  transform: translateY(-4px);
  box-shadow: 0 8px 28px rgba(26, 86, 219, .2);
}

.prod-badge {
  position: absolute;
  top: 10px; left: 10px;
  background: #7c3aed;
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  padding: 3px 7px;
  border-radius: 6px;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.prod-img {
  height: 165px;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
}
.prod-img img { width: 100%; height: 100%; object-fit: contain; }

.prod-body {
  padding: 12px 13px 13px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.prod-code {
  font-size: 10px;
  color: var(--text-muted);
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  margin-bottom: 5px;
}

.prod-name {
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--text);
  flex: 1;
  margin-bottom: 9px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.prod-price {
  font-family: 'Syne', sans-serif;
  font-size: 18px;
  font-weight: 800;
  color: var(--accent2);
  margin-bottom: 9px;
}
.prod-price.ask-price {
  font-size: 12.5px;
  color: var(--text-muted);
  font-family: 'DM Sans', sans-serif;
  font-weight: 500;
}

.btn-card {
  width: 100%;
  padding: 9px;
  border: none;
  border-radius: 8px;
  font-family: 'DM Sans', sans-serif;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  transition: opacity .2s;
  background: var(--accent);
  color: #fff;
}
.btn-card:hover { opacity: .88; }
.btn-card.wa    { background: var(--green); }

/* ============================================
   EMPTY STATE
   ============================================ */
.empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 80px 20px;
  color: var(--text-muted);
}
.empty .e-icon { font-size: 52px; margin-bottom: 14px; }
.empty h3 { font-family: 'Syne', sans-serif; font-size: 18px; color: var(--text-dim); margin-bottom: 6px; }

/* ============================================
   MODAL
   ============================================ */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .78);
  z-index: 99000;
  backdrop-filter: blur(6px);
  padding: 20px;
  overflow-y: auto;
}
.modal-overlay.open { display: flex; align-items: flex-start; justify-content: center; }

.modal-box {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 20px;
  width: 100%;
  max-width: 860px;
  margin: 20px auto;
  position: relative;
  overflow: hidden;
  animation: mIn .22s ease;
}

@keyframes mIn {
  from { opacity: 0; transform: translateY(16px) scale(.97); }
  to   { opacity: 1; transform: none; }
}

.modal-close {
  position: absolute;
  top: 14px; right: 14px;
  width: 34px; height: 34px;
  background: var(--border);
  border: none;
  border-radius: 50%;
  color: var(--text-dim);
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 5;
  transition: background .15s;
}
.modal-close:hover { background: #3a3e52; }

.modal-grid {
  display: grid;
  grid-template-columns: 1fr 1.15fr;
}

.modal-gallery {
  background: #fff;
  padding: 28px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.modal-main-img {
  width: 100%;
  max-height: 280px;
  object-fit: contain;
}

.modal-thumbs { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }

.modal-thumbs img {
  width: 54px; height: 54px;
  object-fit: contain;
  border: 2px solid #e2e4ea;
  border-radius: 8px;
  cursor: pointer;
  padding: 3px;
  background: white;
  transition: border-color .15s;
}
.modal-thumbs img:hover,
.modal-thumbs img.on { border-color: var(--accent); }

.modal-info {
  padding: 30px 26px;
  display: flex;
  flex-direction: column;
}

.modal-code {
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: .08em;
  text-transform: uppercase;
  font-weight: 600;
  margin-bottom: 8px;
}

.modal-title {
  font-family: 'Syne', sans-serif;
  font-size: 19px;
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 18px;
}

.modal-price {
  font-family: 'Syne', sans-serif;
  font-size: 34px;
  font-weight: 800;
  color: var(--accent2);
  margin-bottom: 4px;
}
.modal-price.ask {
  font-size: 16px;
  color: var(--text-muted);
  font-family: 'DM Sans', sans-serif;
  font-weight: 500;
}

.modal-note {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-bottom: 22px;
}

.modal-wa-btn {
  margin-top: auto;
  width: 100%;
  padding: 15px;
  background: var(--green);
  color: #fff;
  border: none;
  border-radius: 12px;
  font-family: 'DM Sans', sans-serif;
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: opacity .2s, transform .15s;
}
.modal-wa-btn:hover { opacity: .92; transform: translateY(-1px); }

/* ============================================
   SIDEBAR OVERLAY (mobile)
   ============================================ */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .55);
  z-index: 7999;
}
.sidebar-overlay.open { display: block; }

/* ============================================
   BOTÓN MOBILE CATEGORÍAS
   ============================================ */
.mob-cat-btn {
  display: none;
  position: fixed;
  bottom: 22px;
  left: 22px;
  z-index: 10000;
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 13px 20px;
  border-radius: 50px;
  font-family: 'DM Sans', sans-serif;
  font-weight: 700;
  font-size: 14px;
  box-shadow: 0 4px 20px rgba(26, 86, 219, .5);
  cursor: pointer;
  align-items: center;
  gap: 7px;
}

/* ============================================
   RESPONSIVE — MOBILE
   ============================================ */
@media (max-width: 768px) {
  :root { --sidebar-w: 82%; }

  .header       { padding: 0 12px; gap: 10px; }
  .logo-wrap    { width: auto; }
  .logo-wrap img { height: 36px; }
  .btn-support,
  .btn-software { display: none; }

  /* Sidebar oculto por defecto, se abre con el botón */
  .sidebar { transform: translateX(-100%); box-shadow: none; }
  .sidebar.open {
    transform: translateX(0);
    box-shadow: 6px 0 40px rgba(0, 0, 0, .7);
  }

  /* Flyout en mobile: acordeón hacia abajo */
  .flyout {
    position: static;
    padding-left: 0;
    display: none;
  }
  .flyout.mob-open { display: block; }
  .flyout-inner,
  .flyout-inner.wide {
    background: var(--sidebar) !important;
    border-radius: 0 !important;
    border-left: none !important;
    border-top: 2px solid var(--accent) !important;
    grid-template-columns: 1fr 1fr;
    display: grid !important;
    box-shadow: none !important;
    min-width: 0 !important;
  }
  .flyout-inner a {
    color: var(--text-dim) !important;
    background: transparent !important;
    padding: 10px 16px !important;
    font-size: 13px !important;
    border-bottom: 1px solid rgba(255,255,255,.05) !important;
  }
  .flyout-inner a:hover,
  .flyout-inner a:active {
    color: #fff !important;
    background: rgba(26,86,219,.15) !important;
  }

  .main { margin-left: 0; padding: 16px; }

  .hero-grid { grid-template-columns: 1fr; grid-template-rows: auto; }
  .hero-card.span2 { grid-row: span 1; }
  .hero-title { font-size: 20px !important; }

  .prod-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }

  .modal-grid    { grid-template-columns: 1fr; }
  .modal-gallery { padding: 18px; }
  .modal-info    { padding: 18px; }
  .modal-main-img { max-height: 210px; }

  .mob-cat-btn { display: flex; }
}
