/* =============================================================
   TecnoFix Computer - Hoja de estilos principal (tienda + admin)
   Basado en la identidad visual original: azul marca + acento naranja
   ============================================================= */
:root {
  --brand-primary: #123ba5;
  --brand-secondary: #081d5a;
  --brand-accent: #ff6f00;
  --bg-soft: #f2f8ff;
  --text-dark: #152238;
  --text-muted: #5b6b85;
  --white: #ffffff;
  --danger: #d62828;
  --success: #17843b;
  --warning: #b9770e;
  --border: #e1e8f5;
  --shadow: 0 16px 40px rgba(15, 42, 69, 0.12);
  --radius: 14px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Space Grotesk", Arial, sans-serif;
  color: var(--text-dark);
  background: linear-gradient(180deg, #f7fcff 0%, #edf5ff 100%);
  min-height: 100vh;
}

h1, h2, h3, h4 { font-family: "Sora", Arial, sans-serif; margin: 0 0 .5rem; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
.container { width: min(1180px, 92%); margin: 0 auto; }

/* ---------- Header / Nav ---------- */
.header { position: sticky; top: 0; z-index: 30; background: rgba(255,255,255,.95); backdrop-filter: blur(8px); border-bottom: 1px solid var(--border); }
.nav { display: flex; align-items: center; justify-content: space-between; gap: 1.6rem; min-height: 84px; flex-wrap: wrap; position: relative; }
.brand { display: inline-flex; align-items: center; }
.brand img { height: 48px; width: auto; display: block; }
.nav-collapse { display: flex; align-items: center; gap: 1.8rem; flex: 1; justify-content: flex-end; flex-wrap: wrap; }
.nav-links { display: flex; align-items: center; gap: 1.8rem; flex-wrap: wrap; }
.nav-links a { font-weight: 700; font-size: .96rem; color: var(--text-dark); padding: .35rem .1rem; border-bottom: 2px solid transparent; white-space: nowrap; }
.nav-links a.active, .nav-links a:hover { color: var(--brand-primary); border-color: var(--brand-accent); }
.nav-actions { display: flex; align-items: center; gap: .7rem; }
.search-wrap { display: flex; gap: .3rem; flex: 1; max-width: 300px; }
.search-wrap input { flex: 1; padding: .55rem .8rem; border-radius: 999px; border: 1px solid var(--border); font-size: 16px; }
.icon-btn, .cart-toggle, .account-toggle { display: inline-flex; align-items: center; gap: .4rem; background: var(--bg-soft); border: 1px solid var(--border); border-radius: 999px; padding: .5rem .9rem; font-weight: 700; cursor: pointer; color: var(--text-dark); }
.cart-toggle span, #cartCount, #cartCountMobile { background: var(--brand-accent); color: #fff; border-radius: 999px; padding: .05rem .5rem; font-size: .8rem; }

/* Menu desplegable de Categorias (megamenu) */
.nav-dropdown { position: relative; }
.nav-dropdown-toggle { display: inline-flex; align-items: center; gap: .35rem; font-weight: 700; font-size: .96rem; color: var(--text-dark); background: none; border: none; padding: .35rem .1rem; cursor: pointer; font-family: inherit; border-bottom: 2px solid transparent; }
.nav-dropdown-toggle svg { transition: transform .15s ease; }
.nav-dropdown.open .nav-dropdown-toggle, .nav-dropdown-toggle:hover { color: var(--brand-primary); border-color: var(--brand-accent); }
.nav-dropdown.open .nav-dropdown-toggle svg { transform: rotate(180deg); }
.nav-dropdown-menu {
  display: none; position: absolute; top: calc(100% + 14px); left: 0; z-index: 40;
  background: #fff; border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow);
  min-width: 300px; max-width: 420px; max-height: 60vh; overflow-y: auto; padding: .7rem;
}
.nav-dropdown.open .nav-dropdown-menu { display: block; }
.nav-dropdown-viewall { display: block; font-weight: 700; color: var(--brand-primary); padding: .5rem .6rem; border-bottom: 1px solid var(--border); margin-bottom: .4rem; }
.nav-dropdown-group { padding: .3rem .6rem; }
.nav-dropdown-cat { display: block; font-weight: 700; padding: .3rem 0; color: var(--text-dark); }
.nav-dropdown-cat:hover { color: var(--brand-primary); }
.nav-dropdown-subs { display: flex; flex-direction: column; padding-left: .8rem; border-left: 2px solid var(--border); margin: .2rem 0 .5rem; }
.nav-dropdown-subs a { padding: .2rem 0; font-size: .88rem; color: var(--text-muted); font-weight: 500; }
.nav-dropdown-subs a:hover { color: var(--brand-primary); }

/* Hamburguesa (oculta en escritorio) */
.nav-toggle { display: none; flex-direction: column; justify-content: center; gap: 5px; width: 44px; height: 44px; background: var(--bg-soft); border: 1px solid var(--border); border-radius: 10px; cursor: pointer; padding: 0; }
.nav-toggle span { display: block; width: 20px; height: 2px; margin: 0 auto; background: var(--text-dark); border-radius: 2px; transition: transform .2s ease, opacity .2s ease; }
.nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
.nav-mobile-cart { display: none; }

/* ---------- Buttons ---------- */
.btn-primary, .btn, .btn-outline, .btn-ghost {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  padding: .7rem 1.4rem; border-radius: 10px; font-weight: 700; cursor: pointer; border: 2px solid transparent;
  font-size: .95rem; transition: transform .15s ease, box-shadow .15s ease;
}
.btn-primary, .btn { background: var(--brand-primary); color: #fff; }
.btn-primary:hover, .btn:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.btn-accent { background: var(--brand-accent); color: #fff; }
.btn-ghost, .btn-outline { background: transparent; border-color: var(--brand-primary); color: var(--brand-primary); }
.btn-danger { background: var(--danger); color: #fff; }
.btn.full, .btn-primary.full, .btn-ghost.full { width: 100%; }
.btn-sm { padding: .4rem .8rem; font-size: .82rem; border-radius: 8px; }

/* ---------- Layout sections ---------- */
.section { padding: 3rem 0; }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1.4rem; flex-wrap: wrap; }
.hero { display: grid; grid-template-columns: 1.2fr .8fr; gap: 2rem; padding: 3rem 0; align-items: center; }
.eyebrow { color: var(--brand-accent); font-weight: 700; text-transform: uppercase; font-size: .8rem; letter-spacing: .06em; }
.hero-actions { display: flex; gap: .8rem; margin-top: 1.2rem; flex-wrap: wrap; }
.hero-card { background: var(--brand-secondary); color: #fff; border-radius: var(--radius); padding: 2rem; box-shadow: var(--shadow); }
.stats-strip { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; text-align: center; }
.stats-strip strong { display: block; font-size: 1.6rem; color: var(--brand-primary); }

/* ---------- Cards / grid ---------- */
.card { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 1.4rem; box-shadow: var(--shadow); }
.product-grid, .service-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 1.2rem; }
.product-card { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; transition: transform .15s ease; }
.product-card:hover { transform: translateY(-4px); box-shadow: var(--shadow); }
.product-card .thumb { aspect-ratio: 1/1; background: var(--bg-soft); display: flex; align-items: center; justify-content: center; padding: 1rem; }
.product-card .body { padding: 1rem; display: flex; flex-direction: column; gap: .4rem; flex: 1; }
.product-card .price-row { display: flex; align-items: baseline; gap: .5rem; }
.price-old { text-decoration: line-through; color: var(--text-muted); font-size: .85rem; }
.price-new { color: var(--brand-primary); font-weight: 800; font-size: 1.15rem; }
.badge { display: inline-block; padding: .15rem .6rem; border-radius: 999px; font-size: .72rem; font-weight: 700; }
.badge-offer { background: #ffe3cc; color: var(--brand-accent); }
.badge-new { background: #d9f2e0; color: var(--success); }
.badge-out { background: #fbdada; color: var(--danger); }
.badge-featured { background: #dbe6ff; color: var(--brand-primary); }

/* ---------- Forms ---------- */
label { display: flex; flex-direction: column; gap: .3rem; font-weight: 600; font-size: .88rem; margin-bottom: .8rem; }
input, select, textarea {
  padding: .65rem .8rem; border: 1px solid var(--border); border-radius: 8px; font-family: inherit; font-size: .95rem; width: 100%;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand-primary); outline-offset: 1px; }
.form-message { min-height: 1.2em; font-size: .85rem; color: var(--danger); }
.form-message.success { color: var(--success); }
.form-grid { display: grid; gap: 0; }

/* ---------- Alerts / toasts ---------- */
.alert { padding: .9rem 1.1rem; border-radius: 10px; margin-bottom: 1rem; font-weight: 600; }
.alert-success { background: #d9f2e0; color: var(--success); }
.alert-error { background: #fbdada; color: var(--danger); }
.alert-info { background: #dbe6ff; color: var(--brand-primary); }
.toast { position: fixed; bottom: 1.2rem; left: 50%; transform: translateX(-50%); background: var(--text-dark); color: #fff; padding: .7rem 1.2rem; border-radius: 999px; z-index: 90; }
.hidden { display: none !important; }

/* ---------- Cart panel ---------- */
.cart-panel { position: fixed; top: 0; right: -420px; width: min(400px, 92vw); height: 100vh; background: #fff; box-shadow: var(--shadow); z-index: 50; transition: right .25s ease; display: flex; flex-direction: column; }
.cart-panel.open { right: 0; }
.cart-header { display: flex; justify-content: space-between; padding: 1rem 1.2rem; border-bottom: 1px solid var(--border); }
.cart-items { flex: 1; overflow-y: auto; padding: 1rem 1.2rem; }
.cart-item { display: flex; gap: .8rem; padding: .8rem 0; border-bottom: 1px solid var(--border); align-items: center; }
.cart-item img { width: 56px; height: 56px; object-fit: contain; background: var(--bg-soft); border-radius: 8px; }
.cart-footer { padding: 1rem 1.2rem; border-top: 1px solid var(--border); }
.cart-summary { display: flex; justify-content: space-between; margin-bottom: .8rem; font-weight: 700; }
.overlay { position: fixed; inset: 0; background: rgba(8,29,90,.4); z-index: 40; opacity: 0; pointer-events: none; transition: opacity .2s ease; }
.overlay.show { opacity: 1; pointer-events: auto; }

/* ---------- Tables (admin) ---------- */
table { width: 100%; border-collapse: collapse; background: #fff; }
table th, table td { padding: .7rem .8rem; border-bottom: 1px solid var(--border); text-align: left; font-size: .9rem; }
table th { background: var(--bg-soft); font-weight: 700; }
.table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--border); }

/* ---------- Admin layout ---------- */
.admin-body { display: flex; min-height: 100vh; background: var(--bg-soft); }
.admin-sidebar { width: 250px; background: var(--brand-secondary); color: #fff; padding: 1.2rem; flex-shrink: 0; }
.admin-sidebar h2 { color: #fff; font-size: 1.1rem; }
.admin-sidebar nav a { display: block; padding: .6rem .8rem; border-radius: 8px; color: #cfe0ff; font-weight: 600; margin-bottom: .2rem; }
.admin-sidebar nav a:hover, .admin-sidebar nav a.active { background: rgba(255,255,255,.12); color: #fff; }
.admin-main { flex: 1; padding: 1.6rem; min-width: 0; }
.admin-topbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.4rem; flex-wrap: wrap; gap: .8rem; }
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; margin-bottom: 1.6rem; }
.kpi-card { background: #fff; border-radius: var(--radius); padding: 1.1rem; border: 1px solid var(--border); }
.kpi-card strong { display: block; font-size: 1.5rem; color: var(--brand-primary); }
.kpi-card span { color: var(--text-muted); font-size: .85rem; }
.status-pill { padding: .2rem .6rem; border-radius: 999px; font-size: .78rem; font-weight: 700; }
.status-pendiente { background: #fdf1cf; color: var(--warning); }
.status-confirmado, .status-preparando { background: #dbe6ff; color: var(--brand-primary); }
.status-pagado, .status-entregado { background: #d9f2e0; color: var(--success); }
.status-enviado { background: #e4d9fb; color: #6a3fc7; }
.status-cancelado { background: #fbdada; color: var(--danger); }

/* ---------- Footer ---------- */
.footer { background: var(--brand-secondary); color: #dfe8ff; margin-top: 3rem; }
.footer-main { display: grid; grid-template-columns: repeat(5, 1fr); gap: 1.6rem; padding: 2.2rem 0; }
.footer-col h4 { color: #fff; font-size: .95rem; margin-bottom: .7rem; letter-spacing: .03em; }
.footer-col p { font-size: .88rem; line-height: 1.5; color: #c3d1f0; }
.footer-nav { list-style: none; padding: 0; margin: 0; }
.footer-nav li { margin-bottom: .35rem; }
.footer-nav a { font-size: .88rem; color: #c3d1f0; }
.footer-nav a:hover { color: #fff; }
.footer-bottom { border-top: 1px solid rgba(255,255,255,.12); padding: 1.1rem 0 1.6rem; font-size: .82rem; }
.footer-bottom-inner { display: flex; flex-direction: column; align-items: center; gap: .7rem; text-align: center; }
.payment-badges { display: flex; gap: .4rem; flex-wrap: wrap; justify-content: center; }
.pay-badge { padding: .18rem .55rem; border-radius: 4px; font-size: .68rem; font-weight: 800; letter-spacing: .04em; border: 1px solid rgba(255,255,255,.15); color: #fff; white-space: nowrap; }
.pay-badge.visa { background: #1a1f71; }
.pay-badge.mc { background: #eb001b; }
.pay-badge.paypal { background: #003087; }
.pay-badge.transfer { background: #2e7d32; }
.pay-badge.deposit { background: #6a4c93; }
.pay-badge.cod { background: #455a64; }

@media (min-width: 769px) {
  .footer-bottom-inner { flex-direction: row; justify-content: space-between; text-align: left; }
}

/* ---------- WhatsApp float ---------- */
.whatsapp-float { position: fixed; bottom: 1.2rem; left: 1.2rem; background: #25d366; color: #fff; padding: .7rem 1.1rem; border-radius: 999px; display: inline-flex; align-items: center; gap: .5rem; font-weight: 700; z-index: 45; box-shadow: var(--shadow); transition: bottom .2s ease; }

.cta-banner { display: flex; justify-content: space-between; align-items: center; gap: 1.4rem; background: linear-gradient(135deg, var(--brand-secondary) 0%, var(--brand-primary) 100%); color: #fff; border-radius: var(--radius); padding: 2.2rem; flex-wrap: wrap; box-shadow: var(--shadow); }
.cta-banner h2 { color: #fff; }
.cta-banner .btn-ghost { background: rgba(255,255,255,.12); border-color: rgba(255,255,255,.5); color: #fff; }
.service-icon-badge { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; border-radius: 12px; background: #dbe6ff; color: var(--brand-primary); margin-bottom: .6rem; }
.service-content ul { padding-left: 1.2rem; margin: .4rem 0 0; }
.service-content li { margin-bottom: .3rem; }

/* ---------- Trust section (Por que TecnoFix Computer) ---------- */
.trust-section { background: linear-gradient(135deg, var(--brand-secondary) 0%, #1c4fc4 100%); border-radius: 24px; padding: 3rem 2.4rem; box-shadow: var(--shadow); position: relative; overflow: hidden; }
.trust-section::before { content: ""; position: absolute; inset: 0; background: radial-gradient(circle at 85% 15%, rgba(255,111,0,.18), transparent 55%); pointer-events: none; }
.trust-head { text-align: center; max-width: 720px; margin: 0 auto 2.2rem; position: relative; }
.trust-head h2 { color: #fff; font-size: 1.9rem; }
.trust-head p { color: #dfe8ff; margin: 0; }
.trust-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 1.4rem; position: relative; }
.trust-card { background: #f4f8ff; border-radius: 16px; padding: 1.8rem 1.4rem; text-align: center; box-shadow: 0 10px 24px rgba(8,29,90,.25); }
.trust-icon { width: 66px; height: 66px; border-radius: 50%; background: linear-gradient(135deg, var(--brand-accent), #ff9142); color: #fff; display: flex; align-items: center; justify-content: center; margin: 0 auto .9rem; box-shadow: 0 8px 18px rgba(255,111,0,.4); }
.trust-card h3 { color: var(--brand-secondary); font-size: 1.05rem; }
.trust-card p { color: var(--text-muted); font-size: .92rem; margin: 0; }

/* ---------- Brands cloud (redesign) ---------- */
.brands-section .section-head h2, .brands-section .section-head p { text-align: left; }
.brands-cloud.card { display: flex; flex-wrap: wrap; gap: .8rem; justify-content: center; padding: 1.8rem; background: linear-gradient(180deg, #fff, var(--bg-soft)); }
.brands-cloud a { background: #fff; border: 1px solid var(--border); border-radius: 999px; padding: .55rem 1.3rem; font-weight: 700; color: var(--brand-primary); box-shadow: 0 4px 10px rgba(15,42,69,.06); transition: all .15s ease; }
.brands-cloud a:hover { background: var(--brand-primary); color: #fff; transform: translateY(-2px); box-shadow: 0 8px 16px rgba(18,59,165,.28); }

/* ---------- Filters (catalog) ---------- */
.catalog-layout { display: grid; grid-template-columns: 270px 1fr; gap: 1.6rem; align-items: start; }
.filters-panel { position: sticky; top: 90px; }
.filters-panel fieldset { border: 1px solid var(--border); border-radius: 10px; margin-bottom: 1rem; padding: .8rem .9rem 1rem; }
.filters-panel legend { font-weight: 700; color: var(--brand-primary); padding: 0 .4rem; }
.filters-panel select { width: 100%; padding: .55rem .7rem; border-radius: 8px; border: 1px solid var(--border); font-weight: 600; background: #fff; }

/* ---------- Utility grids (2/3/4 columnas, colapsan en movil) ---------- */
.grid-2, .grid-2-wide, .grid-3, .grid-4 { display: grid; gap: 1.2rem; }
.grid-2 { grid-template-columns: 1fr 1fr; }
.grid-2-wide { grid-template-columns: 2fr 1fr; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

/* ---------- Responsive (mobile-first) ---------- */
@media (max-width: 1024px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .footer-main { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; }
  .catalog-layout { grid-template-columns: 1fr; }
  .filters-panel { position: static; }
  .admin-body { flex-direction: column; }
  .admin-sidebar { width: 100%; }
  .grid-2, .grid-2-wide, .grid-3 { grid-template-columns: 1fr; }
  .trust-section { padding: 2.2rem 1.4rem; }
}
@media (max-width: 768px) {
  .container { width: min(720px, 94%); }
  .stats-strip { grid-template-columns: repeat(2, 1fr); }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .footer-main { grid-template-columns: repeat(2, 1fr); text-align: left; }
}
@media (max-width: 640px) {
  /* Evitar zoom automatico de iOS al enfocar campos */
  input, select, textarea { font-size: 16px; }

  /* Header / menu hamburguesa */
  .nav { min-height: 64px; padding: .5rem 0; flex-wrap: nowrap; }
  .nav-toggle { display: inline-flex; order: 3; }
  .nav-mobile-cart { display: inline-flex; order: 2; margin-left: auto; }
  .nav-desktop-cart { display: none; }
  .nav-collapse {
    display: none; position: absolute; top: 100%; left: 0; right: 0;
    background: #fff; border-top: 1px solid var(--border); box-shadow: var(--shadow);
    flex-direction: column; align-items: stretch; padding: 1.2rem; gap: 1rem; z-index: 60;
    max-height: calc(100vh - 64px); overflow-y: auto;
  }
  .nav-collapse.open { display: flex; }
  .nav-links { flex-direction: column; gap: 0; align-items: stretch; width: 100%; }
  .nav-links a { padding: .7rem .2rem; border-bottom: 1px solid var(--border); }
  .nav-dropdown { width: 100%; }
  .nav-dropdown-toggle { width: 100%; justify-content: space-between; padding: .7rem .2rem; border-bottom: 1px solid var(--border); }
  .nav-dropdown-menu {
    display: none; position: static; box-shadow: none; border: none; border-radius: 0;
    background: var(--bg-soft); max-width: none; min-width: 0; margin: 0; padding: .4rem .2rem .6rem 1rem;
  }
  .nav-dropdown.open .nav-dropdown-menu { display: block; }
  .search-wrap { max-width: none; }
  .nav-actions { flex-direction: column; align-items: stretch; }
  .nav-actions a { justify-content: center; }

  /* Tipografia y espaciados */
  .section { padding: 2rem 0; }
  .hero { padding: 1.6rem 0; }
  .hero-text h1 { font-size: 1.6rem; }
  .stats-strip { grid-template-columns: repeat(2, 1fr); gap: .7rem; }
  .stats-strip article { padding: 1rem; }
  .section-head { flex-direction: column; align-items: flex-start; }
  .kpi-grid { grid-template-columns: 1fr; }

  /* Botones con area de toque adecuada */
  .btn-primary, .btn, .btn-outline, .btn-ghost { width: 100%; padding: .85rem 1.2rem; font-size: 1rem; }
  .hero-actions, .cta-banner .hero-actions { flex-direction: column; }
  .hero-actions a, .cta-banner .hero-actions a { width: 100%; }
  .product-card .btn-primary, .product-card .btn-ghost, table .btn-sm, .cart-item .btn-sm { width: auto; }

  /* Tablas: scroll horizontal contenido, no rompe el layout */
  .table-wrap { -webkit-overflow-scrolling: touch; }
  table { min-width: 560px; }

  /* Carrito / producto / footer */
  .cart-item { flex-wrap: wrap; }
  .cart-item img { width: 64px; height: 64px; }
  .product-gallery-main img { max-height: 260px; object-fit: contain; }
  .footer-main { grid-template-columns: 1fr 1fr; text-align: left; }
  .whatsapp-float { left: .8rem; bottom: .8rem; padding: .6rem .9rem; font-size: .85rem; }
  .cta-banner { flex-direction: column; text-align: center; padding: 1.6rem; }
  .brands-cloud.card { padding: 1.2rem; }
  .trust-card { padding: 1.4rem 1rem; }
}
@media (max-width: 380px) {
  .container { width: min(360px, 95%); }
  .stats-strip { grid-template-columns: 1fr 1fr; }
}
