/*
  site.css
  =========================================================
  Public site global styles for eCambialo
  Clean, stable, classic layout
  All comments in English
*/

/* =========================================================
   BASIC RESET
   ========================================================= */

:root{
  --ecx-brand: #084a6d;
  --ecx-bg: #f6f7f9;
  --ecx-surface: #f6f7f9;
  --ecx-border: #e3e8ef;
  --ecx-text: #111827;
  --ecx-muted: #6b7280;
}




* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
}

body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  background: #f6f7f9;
  color: #222;
  line-height: 1.4;
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  max-width: 100%;
  display: block;
}

/* =========================================================
   HEADER
   ========================================================= */

.site-header {
  width: 100%;
  background: #ffffff;
  border-bottom: 1px solid #d7dde3;
}

/* ---------- Header top ---------- */

.header-top {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 15px;
  padding: 10px 20px;
}

.logo img {
  height: 72px;
  width: auto;
}

/* ---------- Global search ---------- */

.header-search {
  flex: 1;
  display: flex;
  gap: 8px;
  max-width: 600px;
}

.header-search input {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid #cfd6dc;
  border-radius: 4px;
  font-size: 14px;
}

.header-search button {
  padding: 8px 16px;
  background: #0c7c3c;
  color: #fff;
  border: none;
  border-radius: 4px;
  font-weight: 600;
  cursor: pointer;
}

.header-search button:hover {
  background: #096a33;
}

/* ---------- Location selector ---------- */

.location-btn {
  background: #eef4f8;
  border: 1px solid #cfdbe5;
  padding: 8px 12px;
  border-radius: 4px;
  cursor: pointer;
  white-space: nowrap;
  font-size: 14px;
}

/* ---------- Messages bubble ---------- */

.header-messages {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #fff3cd;
  color: #856404;
  padding: 8px 14px;
  border-radius: 20px;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0,0,0,.12);
  font-size: 14px;
}

/* ---------- User info ---------- */

.header-info-box {
  background: #e8f1f8;
  padding: 10px 18px;
  border-radius: 8px;
  text-align: right;
  font-size: 13px;
}

.header-info-box a {
  font-weight: 600;
}

/* =========================================================
   LANGUAGE SWITCH (header)
   ========================================================= */

.header-account{
  display: inline-flex;
  align-items: flex-end;
  gap: 12px;
}

/* Compact pill-style language switch with flags */
.header-lang-switch{
  display: inline-flex;
  align-items: flex-end;
  gap: 6px;
  padding: 4px;
  border-radius: 999px;
  background: #ffffff;
  border: 1px solid #d1d7dc;
  box-shadow: 0 2px 6px rgba(0,0,0,.06);
  white-space: nowrap;
}

.lang-pill{
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  color: #1f2937;
  background: transparent;
  line-height: 1;
  user-select: none;
}

.lang-pill img{
  width: 18px;
  height: 13px;
  border-radius: 2px;
  box-shadow: 0 0 0 1px rgba(0,0,0,.10);
}

.lang-pill:hover{
  background: #f3f4f6;
}

.lang-pill:focus{
  outline: 2px solid #2563eb;
  outline-offset: 2px;
}

.lang-pill.is-active{
  background: var(--ecx-brand, #084a6d);
  color: #ffffff;
}

.lang-pill.is-active img{
  box-shadow: 0 0 0 1px rgba(255,255,255,.35);
}

/* Responsive: keep the right block readable when wrapping */
@media (max-width: 980px){
  .header-account{
    margin-left: auto;
  }
}


/* =========================================================
   MAIN NAVIGATION
   ========================================================= */

.main-nav {
  background: #084a6d;
  padding: 10px 0;
}

.main-nav-inner {
  padding: 0 20px;
}

.main-menu {
  display: flex;
  gap: 25px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.main-menu li {
  flex-shrink: 0;
}

.main-menu a {
  color: #ffffff;
  font-weight: 600;
  font-size: 14px;
}

.main-menu a:hover {
  text-decoration: underline;
}

/* =========================================================
   GENERAL LAYOUT
   ========================================================= */

.container {
  max-width: 1200px;
  margin: 20px auto;
  padding: 0 15px;
}

.grid-layout {
  display: grid;
  grid-template-columns: 280px 1fr 300px;
  gap: 16px;
  align-items: start;
}

/* =========================================================
   SIDEBAR (PORTAL)
   ========================================================= */

.sidebar {
  background: #ffffff;
  border: 1px solid #e0e6ea;
  border-radius: 6px;
  padding: 12px;
}

.form-group {
  margin-bottom: 12px;
}

.form-group label {
  display: block;
  font-size: 13px;
  margin-bottom: 6px;
  color: #333;
}

.form-group select,
.form-group input {
  width: 100%;
  padding: 8px;
  border: 1px solid #d1d7dc;
  border-radius: 4px;
  font-size: 14px;
}

/* =========================================================
   MAIN CONTENT
   ========================================================= */

.col-main .promo-strip {
  background: #e9f3fb;
  padding: 12px;
  border-radius: 6px;
  margin-bottom: 12px;
}

.cards-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin-top: 12px;
}

/* ===========================
   CATEGORIES MEGA MENU
   =========================== */

.menu-categories {
	position: relative;
}

/* Hidden by default */
.categories-mega {
	display: none;
	position: absolute;
	top: 100%;
	left: 0;

	width: 100vw;
	max-width: 1200px;

	background: #fff;
	border: 1px solid #ddd;
	box-shadow: 0 6px 20px rgba(0,0,0,.15);

	padding: 20px;
	z-index: 10000;
}

/* Show when JS adds .open */
.categories-mega.open {
	display: block;
}

/* Layout */
.categories-columns {
	display: flex;
	gap: 30px;
}

.categories-col {
	min-width: 180px;
}

.categories-col h4 {
	margin: 0 0 8px;
	font-size: 15px;
}

.categories-col ul {
	list-style: none;
	padding: 0;
	margin: 0;
}

.categories-col li {
	margin-bottom: 6px;
}

.categories-col a {
	text-decoration: none;
	color: #333;
}

.categories-col a:hover {
	text-decoration: underline;
}

/* Third level */
.categories-col ul.sublevel {
	margin-left: 12px;
	margin-top: 4px;
}


/* =========================================================
   ARTICLE VIEW
   ========================================================= */

.article-container {
  background: #ffffff;
  border: 1px solid #e0e6ea;
  border-radius: 6px;
  padding: 20px;
}

.article-container h1 {
  margin-top: 0;
}

.article-container .subtitle {
  color: #666;
  font-size: 16px;
}

.article-meta {
  font-size: 13px;
  color: #555;
  margin-bottom: 10px;
}

.description {
  font-size: 14px;
  line-height: 1.6;
}

/* =========================================================
   LOCATION MODAL
   ========================================================= */

.select-wrapper {
  position: relative;
  margin-bottom: 10px;
}

.select-wrapper select {
  width: 100%;
  padding: 8px;
  appearance: none;
  border: 1px solid #cfd6dc;
  border-radius: 4px;
  font-size: 14px;
}

.select-spinner {
  position: absolute;
  right: 12px;
  top: 50%;
  width: 18px;
  height: 18px;
  margin-top: -9px;
  border: 3px solid #cfdbe5;
  border-top-color: #084a6d;
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
  display: none;
}

.select-wrapper.loading .select-spinner {
  display: block;
}

.select-wrapper.loading select {
  opacity: 0.6;
  pointer-events: none;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* =========================================================
   BUTTONS (GLOBAL)
   ========================================================= */

.btn {
  display: inline-block;
  background: #007bff;
  color: #ffffff;
  padding: 8px 14px;
  border-radius: 4px;
  border: none;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.btn:hover {
  opacity: 0.9;
}

.btn-secondary {
  background: #6c757d;
}

.btn-warning {
  background: #f0ad4e;
  color: #222;
}

.btn-outline {
  background: #ffffff;
  border: 1px solid #ccc;
  color: #333;
}

/* =========================================================
   FOOTER
   ========================================================= */

.site-footer {
  margin-top: 30px;
  background: #ffffff;
  border-top: 1px solid #e1e6ea;
  padding: 16px;
  text-align: center;
  font-size: 14px;
}

.footer-categories ul {
  list-style: none;
  padding: 0;
  margin: 10px 0 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
}

.footer-categories a {
  color: #084a6d;
}



.search-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 24px;
}

.search-filters {
  background: #f7f7f7;
  padding: 16px;
  border-radius: 6px;
}

.filter-block {
  margin-bottom: 14px;
}

/* ---------- Search results ---------- */
.search-results .cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}

.pagination button {
  margin: 0 4px;
}

.pagination button.active {
  font-weight: bold;
}

/* =========================================================
   RESPONSIVE
   ========================================================= */

@media (max-width: 980px) {

  .grid-layout {
    grid-template-columns: 1fr;
  }

  .header-top {
    flex-wrap: wrap;
    align-items: center;
  }

  .header-search {
    max-width: none;
  }

  .main-menu {
    flex-wrap: wrap;
    gap: 15px;
  }
}

body{
  background: var(--ecx-bg);
}

/* =========================================================
   FORCE HIDE CATEGORIES MEGA MENU (DEFAULT STATE)
   ========================================================= */

.menu-categories > .categories-mega {
  display: none !important;
}

.menu-categories > .categories-mega.open {
  display: block !important;
}

/* =========================================================
   CATEGORIES MEGA MENU – COLOR & HIERARCHY
   ========================================================= */

/* NIVEL 1 – Categorías principales */
.categories-col h4 a {
	color: var(--main-blue, #0a58ca);
	font-weight: 600;
	font-size: 15px;
}

/* Línea sutil separadora */
.categories-col h4 {
	padding-bottom: 6px;
	margin-bottom: 8px;
	border-bottom: 1px solid rgba(10,88,202,.15);
}

/* NIVEL 2 – Subcategorías */
.categories-col > ul > li > a {
	color: var(--main-blue, #0a58ca);
	font-weight: 500;
	font-size: 14px;
}

/* NIVEL 3 – Sub-subcategorías */
.categories-col ul.sublevel a {
	color: #444;
	font-weight: 400;
	font-size: 13px;
}

/* Hover */
.categories-col a:hover {
	color: #083e8c;
	text-decoration: underline;
}

/* =========================
   SEARCH LAYOUT
   ========================= */

.search-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 24px;
  margin-top: 24px;
}

/* =========================
   FILTERS SIDEBAR
   ========================= */

.search-filters {
  background: #ffffff;
  border: 1px solid #e3e6ea;
  border-radius: 8px;
  padding: 16px;
  font-size: 14px;
}

.search-filters h3 {
  margin: 0 0 12px;
  font-size: 16px;
  font-weight: 600;
}

.filter-block {
  margin-bottom: 14px;
}

.filter-block label {
  display: block;
  font-weight: 500;
  margin-bottom: 6px;
  color: #444;
}

.filter-block select,
.filter-block input {
  width: 100%;
  padding: 8px 10px;
  border-radius: 6px;
  border: 1px solid #ccd1d9;
  font-size: 14px;
}

#applyFilters {
  width: 100%;
  margin-top: 12px;
  padding: 10px;
  border-radius: 6px;
  border: none;
  background: #0a5bd3;
  color: #fff;
  font-weight: 600;
  cursor: pointer;
}

#applyFilters:hover {
  background: #084cb3;
}

/* =========================
   RESULTS AREA
   ========================= */

.search-results {
  min-width: 0;
}

.search-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 12px;
}

#resultsCount {
  color: #666;
  font-size: 14px;
}

/* Igualar títulos de filtros y resultados */
.search-filters h3 {
  font-size: 20px;       /* igual que h2 */
  font-weight: 600;
  margin-bottom: 12px;
  line-height: 1.2;
}

/* =========================================================
   FOOTER · eCambialo
   ========================================================= */

.site-footer {
  background: #1f2933;
  color: #d1d5db;
  margin-top: 48px;
  font-size: 14px;
}

/* ---------- INNER GRID ---------- */

.footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 36px 20px;
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr 1fr;
  gap: 28px;
}

.footer-block h4 {
  color: #ffffff;
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 12px;
}

.footer-block p {
  margin: 0;
  line-height: 1.6;
  color: #cbd5e1;
}

/* ---------- LINKS ---------- */

.footer-block ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.footer-block li {
  margin-bottom: 8px;
}

.footer-block a {
  color: #cbd5e1;
  text-decoration: none;
  transition: color .2s ease;
}

.footer-block a:hover {
  color: #ffffff;
  text-decoration: underline;
}

/* ---------- ABOUT ---------- */

.footer-about p {
  max-width: 360px;
}

/* ---------- TRUST / BADGES ---------- */

.footer-trust {
  margin-top: 18px;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.footer-trust img {
  height: 34px;
  width: auto;
  filter: grayscale(100%);
  opacity: 0.85;
  transition: filter .2s ease, opacity .2s ease;
}

.footer-trust img:hover {
  filter: grayscale(0%);
  opacity: 1;
}

/* ---------- BOTTOM BAR ---------- */

.footer-bottom {
  border-top: 1px solid rgba(255,255,255,0.08);
  padding: 14px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.footer-copy small,
.footer-status small {
  color: #9ca3af;
  font-size: 13px;
}

/* ---------- RESPONSIVE ---------- */

@media (max-width: 900px) {
  .footer-inner {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 520px) {
  .footer-inner {
    grid-template-columns: 1fr;
  }

  .footer-bottom {
    flex-direction: column;
    text-align: center;
  }
}

/* =========================================================
   FEATURED ROWS – FIX OVERFLOW
   ========================================================= */

.cards-row {
  display: flex;
  flex-wrap: wrap;              /* ⬅️ CLAVE */
  gap: 16px;
  align-items: stretch;
  width: 100%;
  overflow-x: hidden;           /* ⬅️ evita scroll lateral */
}

/* Tarjetas compactas */
.cards-row .ecx-card {
  flex: 0 1 220px;               /* se adaptan al ancho */
  max-width: 100%;
}

/* =========================================================
   HOME MAP · fixed size + centered render
   ========================================================= */

/* The map container must have an explicit height or it collapses */
#map-container.map-wrapper{
  width: 100%;
  height: 810px;
  min-height: 400px;
  background: #fff;
  border-radius: 12px;
  overflow: hidden;

  /* Center whatever the map library injects (svg / wrapper div) */
  display: flex;
  align-items: center;
  justify-content: center;
}

/* FlaMap usually injects a wrapper node; center it too */
#map-container.map-wrapper > *{
  margin: 0 auto;
}

/* Center the SVG and keep it within the container */
#map-container.map-wrapper svg{
  display: block;
  margin: 0 auto;

  /* Ensure it fits the container */
  max-width: 100%;
  max-height: 100%;
}

/* If the library sets explicit pixel size on the wrapper, let it scale */
#map-container.map-wrapper .flamap,
#map-container.map-wrapper .FlaMap,
#map-container.map-wrapper .map,
#map-container.map-wrapper > div{
  max-width: 100%;
  max-height: 100%;
}

#map-container.map-wrapper svg,
#map-container.map-wrapper .flamap,
#map-container.map-wrapper > div{
  left: auto !important;
  right: auto !important;
}

/* Home map container */
.map-wrapper{
  width: 100%;
  height: 400px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #ffffff;
  border: 1px solid var(--ecx-border);
  border-radius: 10px;
  overflow: hidden;
  position: relative;
}

/* Tooltip */
.ecx-map-tooltip{
  position: absolute;
  z-index: 20;
  background: rgba(17,24,39,0.92);
  color: #ffffff;
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.2;
  white-space: nowrap;
  pointer-events: none;
}

.search-header{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  flex-wrap:wrap;
}

.search-header__controls{
  margin-left:auto;
  display:flex;
  align-items:center;
  gap:10px;
  flex-wrap:wrap;
}

.sort-label{
  font-size:13px;
  color:#666;
  white-space:nowrap;
}

.sort-select{
  padding:6px 10px;
  border:1px solid #ddd;
  border-radius:8px;
  background:#fff;
  font-size:13px;
}











