/* =====================================================
   PeruPymes — overrides y componentes propios
   ===================================================== */

:root {
  --pp-primary: #0a4d8c;
  --pp-primary-dark: #06325c;
  --pp-accent: #e63946;
  --pp-accent-2: #f1c40f;
  --pp-text: #2c3e50;
  --pp-muted: #6b7c8e;
  --pp-bg: #f7f9fb;
  --pp-card: #ffffff;
  --pp-border: #e3e8ee;
}

body { color: var(--pp-text); background: var(--pp-bg); font-family: 'Nunito', Arial, sans-serif; }
a { color: var(--pp-primary); }
a:hover { color: var(--pp-accent); text-decoration: none; }

/* ----- Header ----- */
.header { background: #fff; box-shadow: 0 2px 8px rgba(0,0,0,0.06); padding: 10px 0;
  position: sticky; top: 0; z-index: 100; }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.header .logo img,
.header .logo svg { height: 38px; width: auto; display: block; }
.btn-hamburger {
  background: transparent; border: 0; padding: 8px 10px; cursor: pointer;
  font-size: 22px; color: var(--pp-text); line-height: 1;
}
.btn-hamburger:hover { color: var(--pp-primary); }

/* Menú desktop */
.mainnav .menu {
  list-style: none; padding: 0; margin: 0;
  display: flex; align-items: center; gap: 4px;
}
.mainnav .menu > li > a {
  color: var(--pp-text); font-weight: 600; padding: 10px 14px;
  text-transform: none; font-size: 14px; display: inline-block;
}
.mainnav .menu > li > a:hover { color: var(--pp-primary); }
.btn-add-listing {
  background: var(--pp-accent); color: #fff !important; padding: 9px 16px !important;
  border-radius: 6px; font-weight: 700;
  display: inline-block; transition: background 0.18s;
}
.btn-add-listing:hover { background: var(--pp-primary-dark); color: #fff; }

/* Drawer mobile */
.nav-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.5);
  opacity: 0; visibility: hidden; transition: opacity 0.25s;
  z-index: 200;
}
body.menu-open .nav-overlay { opacity: 1; visibility: visible; }
body.menu-open { overflow: hidden; }

.nav-drawer {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: min(82vw, 340px); background: #fff;
  transform: translateX(100%); transition: transform 0.28s ease;
  z-index: 201; display: flex; flex-direction: column;
  box-shadow: -8px 0 24px rgba(0,0,0,0.18);
}
body.menu-open .nav-drawer { transform: translateX(0); }
.nav-drawer-head {
  padding: 16px; border-bottom: 1px solid var(--pp-border);
  display: flex; align-items: center; justify-content: space-between;
}
.nav-drawer-head .logo img,
.nav-drawer-head .logo svg { height: 32px; }
.nav-drawer-close {
  background: transparent; border: 0; font-size: 22px; color: var(--pp-text);
  padding: 4px 8px; cursor: pointer; line-height: 1;
}
.nav-drawer-body { flex: 1; overflow-y: auto; padding: 8px 0; }
.nav-drawer-body ul { list-style: none; padding: 0; margin: 0; }
.nav-drawer-body li a {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 20px; color: var(--pp-text); font-weight: 600; font-size: 15px;
  border-bottom: 1px solid var(--pp-border);
}
.nav-drawer-body li a:hover, .nav-drawer-body li a:focus {
  background: var(--pp-bg); color: var(--pp-primary);
}
.nav-drawer-body li a i { color: var(--pp-primary); width: 18px; }
.nav-drawer-foot {
  padding: 16px; border-top: 1px solid var(--pp-border);
}
.nav-drawer-foot .btn-add-listing { display: block; text-align: center; padding: 12px 16px !important; }

/* Mostrar/ocultar segun viewport */
@media (max-width: 991px) {
  .mainnav { display: none; }
}
@media (min-width: 992px) {
  .btn-hamburger { display: none; }
  .nav-drawer, .nav-overlay { display: none !important; }
}

/* ----- Hero (horizontal, ratio 4:1) ----- */
.hero-home {
  position: relative;
  background: #2a1738 url('../img/hero-home.svg') center/cover no-repeat;
  color: #fff; text-align: center;
  padding: 56px 0 40px;
  overflow: hidden;
}
.hero-home::before {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(20,10,30,0.10) 0%, rgba(20,10,30,0.55) 100%);
}
.hero-home .container { position: relative; z-index: 1; max-width: 900px; }
.hero-title {
  font-size: clamp(22px, 4.4vw, 38px); font-weight: 800;
  margin-bottom: 8px; line-height: 1.2;
  text-shadow: 0 2px 12px rgba(0,0,0,0.35);
}
.hero-sub {
  font-size: clamp(14px, 1.8vw, 17px); color: #ffe9c5; margin-bottom: 24px;
  text-shadow: 0 1px 8px rgba(0,0,0,0.35);
}

/* ----- Search form ----- */
.search-form-wrap {
  background: #fff; border-radius: 10px; padding: 6px;
  box-shadow: 0 8px 28px rgba(0,0,0,0.22);
  display: flex; flex-wrap: wrap; gap: 4px;
}
.search-form-wrap input,
.search-form-wrap select {
  flex: 1 1 200px; border: 0; padding: 13px 14px; font-size: 15px;
  background: transparent; color: var(--pp-text);
  outline: none; min-width: 0; -webkit-appearance: none; appearance: none;
}
.search-form-wrap select { background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path d='M0 0l5 6 5-6z' fill='%23667789'/></svg>"); background-repeat: no-repeat; background-position: right 14px center; padding-right: 32px; }
.search-form-wrap input + input,
.search-form-wrap input + select { border-left: 1px solid var(--pp-border); }
.search-form-wrap button {
  background: var(--pp-accent); color: #fff; border: 0;
  padding: 13px 24px; border-radius: 8px; font-weight: 700;
  cursor: pointer; transition: background 0.18s; font-size: 15px;
  flex: 1 1 100%;
}
.search-form-wrap button:hover { background: var(--pp-primary); }

/* En desktop, el botón vuelve a su tamaño */
@media (min-width: 768px) {
  .search-form-wrap { padding: 8px; }
  .search-form-wrap button { flex: 0 0 auto; padding: 13px 28px; }
}

/* En mobile cada input full width */
@media (max-width: 767px) {
  .search-form-wrap { flex-direction: column; }
  .search-form-wrap input,
  .search-form-wrap select,
  .search-form-wrap button { flex: 1 1 100%; }
  .search-form-wrap input + input,
  .search-form-wrap input + select { border-left: 0; border-top: 1px solid var(--pp-border); }
}

/* ----- Breadcrumbs ----- */
.breadcrumbs { background: #fff; border-bottom: 1px solid var(--pp-border); padding: 14px 0; font-size: 13px; }
.breadcrumbs ol { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.breadcrumbs li { color: var(--pp-muted); }
.breadcrumbs li + li::before { content: '/'; margin-right: 8px; color: var(--pp-border); }
.breadcrumbs a { color: var(--pp-primary); }
.breadcrumbs li:last-child a,
.breadcrumbs li:last-child { color: var(--pp-muted); }

/* ----- Cards genéricas ----- */
.pp-card {
  background: var(--pp-card); border-radius: 8px; overflow: hidden;
  box-shadow: 0 2px 6px rgba(0,0,0,0.05); transition: transform 0.18s, box-shadow 0.18s;
}
.pp-card:hover { transform: translateY(-3px); box-shadow: 0 8px 18px rgba(0,0,0,0.1); }

/* Empresa card */
.empresa-card { display: flex; flex-direction: column; height: 100%; }
.empresa-card .img { aspect-ratio: 4/3; background: #eef2f6; position: relative; overflow: hidden; display: block; }
.empresa-card .img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.empresa-card .img .badge-premium {
  position: absolute; top: 10px; right: 10px; background: var(--pp-accent-2); color: #1f1f1f;
  font-size: 11px; font-weight: 700; padding: 4px 8px; border-radius: 4px;
}
.empresa-card .body { padding: 16px; flex: 1; display: flex; flex-direction: column; }
.empresa-card .rubro { font-size: 12px; color: var(--pp-primary); text-transform: uppercase; font-weight: 600; }
.empresa-card .titulo { font-size: 18px; font-weight: 700; color: var(--pp-text); margin: 4px 0 8px; line-height: 1.25; }
.empresa-card .titulo a { color: inherit; }
.empresa-card .titulo a:hover { color: var(--pp-primary); }
.empresa-card .desc { font-size: 14px; color: var(--pp-muted); margin-bottom: 12px; line-height: 1.5;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.empresa-card .meta { font-size: 12px; color: var(--pp-muted); display: flex; gap: 12px; margin-top: auto; }
.empresa-card .meta i { color: var(--pp-primary); margin-right: 4px; }

/* Articulo card */
.articulo-card { display: flex; flex-direction: column; height: 100%; }
.articulo-card .img { aspect-ratio: 16/9; background: #eef2f6; overflow: hidden; display: block; }
.articulo-card .img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.articulo-card .body { padding: 18px; }
.articulo-card .meta { font-size: 12px; color: var(--pp-muted); margin-bottom: 8px; }
.articulo-card .titulo { font-size: 18px; font-weight: 700; line-height: 1.3; margin-bottom: 8px; }
.articulo-card .titulo a { color: var(--pp-text); }
.articulo-card .titulo a:hover { color: var(--pp-primary); }
.articulo-card .extracto { font-size: 14px; color: var(--pp-muted); line-height: 1.5;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

/* Rubro card (featured) */
.rubro-card { display: block; padding: 24px 18px; text-align: center; background: #fff;
  border-radius: 8px; transition: transform 0.18s, box-shadow 0.18s; height: 100%; }
.rubro-card:hover { transform: translateY(-3px); box-shadow: 0 8px 18px rgba(0,0,0,0.1); color: inherit; }
.rubro-card .icon { width: 60px; height: 60px; line-height: 60px; margin: 0 auto 12px;
  background: rgba(10,77,140,0.1); border-radius: 50%; color: var(--pp-primary); font-size: 24px; }
.rubro-card .nombre { font-weight: 700; color: var(--pp-text); margin-bottom: 4px; }
.rubro-card .count  { font-size: 12px; color: var(--pp-muted); }

/* ----- Sections ----- */
.section { padding: 60px 0; }
.section-title { text-align: center; margin-bottom: 40px; }
.section-title h2 { font-size: 28px; font-weight: 700; color: var(--pp-text); margin-bottom: 8px; }
.section-title p  { color: var(--pp-muted); font-size: 15px; max-width: 600px; margin: 0 auto; }

/* ----- AdSense slots ----- */
.ad-slot, .ad-block {
  display: block; margin: 24px 0; text-align: center; overflow: hidden;
  background: #fafbfc; border: 1px dashed #d6dde5; border-radius: 4px;
  position: relative;
}
.ad-slot::before, .ad-block::before {
  content: 'Publicidad'; position: absolute; top: 6px; left: 10px;
  font-size: 10px; color: #aab; letter-spacing: 0.04em; text-transform: uppercase;
}
@media (min-width: 768px) {
  .ad-slot.sticky { position: sticky; top: 90px; }
}

/* ----- Footer ----- */
.footer { background: var(--pp-primary-dark); color: #cfe1f3; padding: 50px 0 20px; margin-top: 60px; }
.footer h5 { color: #fff; font-size: 15px; font-weight: 700; margin-bottom: 18px;
  text-transform: uppercase; letter-spacing: 0.04em; }
.footer ul { list-style: none; padding: 0; margin: 0; }
.footer ul li { margin-bottom: 8px; }
.footer a { color: #cfe1f3; font-size: 14px; }
.footer a:hover { color: #fff; }
.footer-bottom { border-top: 1px solid rgba(255,255,255,0.08); padding-top: 18px; margin-top: 30px;
  font-size: 13px; color: #98b3cc; text-align: center; }

/* ----- Single empresa (ficha) ----- */
.empresa-detalle { background: #fff; border-radius: 8px; padding: 24px; box-shadow: 0 2px 6px rgba(0,0,0,0.05); }
.empresa-header { display: flex; gap: 20px; align-items: center; margin-bottom: 20px; padding-bottom: 20px; border-bottom: 1px solid var(--pp-border); }
.empresa-header .logo { width: 100px; height: 100px; border-radius: 8px; background: #eef2f6; flex-shrink: 0; overflow: hidden; }
.empresa-header .logo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.empresa-header h1 { font-size: 28px; font-weight: 700; margin-bottom: 6px; }
.empresa-header .rubro { color: var(--pp-primary); font-weight: 600; font-size: 13px; text-transform: uppercase; }
.empresa-info-list { list-style: none; padding: 0; margin: 16px 0; }
.empresa-info-list li { padding: 10px 0; border-bottom: 1px solid var(--pp-border); display: flex; gap: 12px; align-items: flex-start; }
.empresa-info-list i { color: var(--pp-primary); width: 18px; }
.empresa-info-list a { color: var(--pp-text); }

/* Mapa lazy */
.empresa-map { width: 100%; height: 280px; background: #eef2f6 center/cover no-repeat; border-radius: 8px; margin: 16px 0;
  display: flex; align-items: center; justify-content: center; cursor: pointer; }
.empresa-map .open-map-btn { background: var(--pp-primary); color: #fff; padding: 10px 18px; border-radius: 6px; }

/* Galería */
.empresa-galeria { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px,1fr)); gap: 8px; margin: 16px 0; }
.empresa-galeria img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 6px; }

/* ----- Articulo detalle ----- */
.articulo-detalle .articulo-imagen { width: 100%; max-height: 480px; object-fit: cover; border-radius: 8px; margin-bottom: 24px; }
.articulo-detalle h1 { font-size: clamp(24px, 3.2vw, 36px); font-weight: 800; line-height: 1.2; margin-bottom: 12px; }
.articulo-detalle .articulo-meta { color: var(--pp-muted); font-size: 14px; margin-bottom: 24px; }
.articulo-detalle .entry { font-size: 17px; line-height: 1.7; color: #2c3e50; }
.articulo-detalle .entry h2 { font-size: 24px; font-weight: 700; margin: 32px 0 16px; }
.articulo-detalle .entry h3 { font-size: 20px; font-weight: 700; margin: 24px 0 12px; }
.articulo-detalle .entry p  { margin-bottom: 18px; }
.articulo-detalle .entry img { max-width: 100%; height: auto; border-radius: 6px; margin: 18px 0; }
.articulo-detalle .entry ul, .articulo-detalle .entry ol { margin: 0 0 18px 24px; }
.articulo-detalle .entry li { margin-bottom: 8px; }
.articulo-detalle .entry table { width: 100%; border-collapse: collapse; margin: 18px 0; font-size: 14px; }
.articulo-detalle .entry th, .articulo-detalle .entry td { border: 1px solid var(--pp-border); padding: 10px; text-align: left; }
.articulo-detalle .entry th { background: var(--pp-bg); font-weight: 700; }
.articulo-detalle .entry blockquote {
  border-left: 4px solid var(--pp-primary); padding: 12px 18px; margin: 18px 0;
  background: var(--pp-bg); color: var(--pp-text); font-style: italic;
}

/* ----- Sidebar ----- */
.pp-sidebar .widget { background: #fff; border-radius: 8px; padding: 18px; margin-bottom: 20px; box-shadow: 0 2px 6px rgba(0,0,0,0.05); }
.pp-sidebar .widget h5 { font-size: 14px; text-transform: uppercase; font-weight: 700; margin-bottom: 14px;
  padding-bottom: 10px; border-bottom: 2px solid var(--pp-primary); display: inline-block; }
.pp-sidebar .widget ul { list-style: none; padding: 0; margin: 0; }
.pp-sidebar .widget ul li { padding: 8px 0; border-bottom: 1px solid var(--pp-border); font-size: 14px; }
.pp-sidebar .widget ul li:last-child { border-bottom: 0; }

/* ----- Forms (panel empresa) ----- */
.pp-form .form-group { margin-bottom: 18px; }
.pp-form label { font-weight: 600; font-size: 13px; color: var(--pp-text); margin-bottom: 6px; display: block; }
.pp-form input[type=text], .pp-form input[type=email], .pp-form input[type=password],
.pp-form input[type=url], .pp-form input[type=tel], .pp-form select, .pp-form textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--pp-border); border-radius: 6px;
  font-size: 14px; background: #fff;
}
.pp-form input:focus, .pp-form textarea:focus, .pp-form select:focus {
  outline: none; border-color: var(--pp-primary); box-shadow: 0 0 0 3px rgba(10,77,140,0.12);
}
.pp-form textarea { min-height: 120px; resize: vertical; }
.pp-form .help { font-size: 12px; color: var(--pp-muted); margin-top: 4px; }
.pp-form .pp-btn {
  background: var(--pp-primary); color: #fff; border: 0; padding: 12px 24px;
  border-radius: 6px; font-weight: 600; cursor: pointer; font-size: 14px;
}
.pp-form .pp-btn:hover { background: var(--pp-primary-dark); }
.pp-form .slug-status.ok    { color: #1d8b4f; font-size: 12px; }
.pp-form .slug-status.warn  { color: #c9421f; font-size: 12px; }

/* Alerts */
.pp-alert { padding: 12px 16px; border-radius: 6px; margin-bottom: 16px; font-size: 14px; }
.pp-alert.ok    { background: #e6f5ec; color: #1d8b4f; border: 1px solid #b8e0c5; }
.pp-alert.error { background: #fce9e7; color: #c9421f; border: 1px solid #f4c2bc; }

/* ----- Pagination ----- */
.pp-pagination { display: flex; gap: 4px; justify-content: center; margin: 30px 0; flex-wrap: wrap; }
.pp-pagination a, .pp-pagination span {
  padding: 8px 14px; border: 1px solid var(--pp-border); border-radius: 4px;
  font-size: 14px; color: var(--pp-text); background: #fff;
}
.pp-pagination a:hover { background: var(--pp-primary); color: #fff; border-color: var(--pp-primary); }
.pp-pagination .current { background: var(--pp-primary); color: #fff; border-color: var(--pp-primary); }

/* Utilidades */
.text-muted { color: var(--pp-muted) !important; }
.mt-section { margin-top: 60px; }

@media (max-width: 767px) {
  .section { padding: 40px 0; }
  .hero-home { padding: 40px 0 32px; }
  .empresa-header { flex-direction: column; text-align: center; }
  .empresa-detalle { padding: 16px; }
  .footer { padding: 40px 0 18px; }
  .footer h5 { margin-top: 18px; }
  .breadcrumbs { font-size: 12px; padding: 10px 0; }
  .rubro-card { padding: 18px 14px; }
  .rubro-card .icon { width: 48px; height: 48px; line-height: 48px; font-size: 20px; }
  .rubro-card .nombre { font-size: 14px; }
  .articulo-detalle h1 { font-size: 24px; }
  .articulo-detalle .entry { font-size: 16px; }
  .pp-pagination a, .pp-pagination span { padding: 6px 10px; font-size: 13px; }
}

/* iOS safe area inferior */
@supports (padding: max(0px)) {
  .footer-bottom { padding-bottom: max(18px, env(safe-area-inset-bottom)); }
}
