/* ============================================================
   CafeHabitue - Tema vintage sobre Bootstrap
   Paleta: crema, espresso, marrón, terracota, naranja, salvia
   ============================================================ */
:root {
  --ch-cream: #F5ECD9;
  --ch-cream-dk: #EADBBF;
  --ch-espresso: #4A3528;
  --ch-brown: #7B5230;
  --ch-brown-lt: #9C6B3F;
  --ch-terra: #C8703B;
  --ch-orange: #E0995B;
  --ch-sage: #9CAE7E;
  --ch-white: #FBF6EC;

  /* Overrides de Bootstrap */
  --bs-primary: #C8703B;
  --bs-primary-rgb: 200, 112, 59;
  --bs-body-bg: #F5ECD9;
  --bs-body-color: #4A3528;
  --bs-link-color: #C8703B;
  --bs-link-hover-color: #9C6B3F;
  --bs-border-color: #EADBBF;

  /* Redondeo global — interfaz más suave/moderna (como el mockup).
     La mayoría de los componentes de Bootstrap derivan de estos tokens. */
  --bs-border-radius: .8rem;
  --bs-border-radius-sm: .55rem;
  --bs-border-radius-lg: 1.15rem;
  --bs-border-radius-xl: 1.5rem;
  --bs-border-radius-xxl: 2rem;
}

body { background-color: var(--ch-cream); color: var(--ch-espresso); }

/* Ajustes finos de redondeo donde conviene un radio propio */
.card { border-radius: 1.15rem; }
.card .card-header:first-child { border-radius: 1.15rem 1.15rem 0 0; }
.card .card-img-top { border-radius: 1.15rem 1.15rem 0 0; }
.modal-content { border-radius: 1.35rem; }
.dropdown-menu { border-radius: 1rem; }
.list-group { border-radius: 1rem; }
.form-control, .form-select { border-radius: .8rem; }
.alert { border-radius: 1rem; }
.btn { border-radius: .8rem; }
.btn-sm { border-radius: .6rem; }
.input-group-text { border-radius: .8rem; }

/* Botones primarios en terracota */
.btn-primary {
  --bs-btn-bg: var(--ch-terra); --bs-btn-border-color: var(--ch-terra);
  --bs-btn-hover-bg: var(--ch-brown); --bs-btn-hover-border-color: var(--ch-brown);
  --bs-btn-active-bg: var(--ch-brown); --bs-btn-active-border-color: var(--ch-brown);
}
.btn-outline-primary {
  --bs-btn-color: var(--ch-brown); --bs-btn-border-color: var(--ch-brown-lt);
  --bs-btn-hover-bg: var(--ch-terra); --bs-btn-hover-border-color: var(--ch-terra);
}
a { text-decoration: none; }

/* ---- Layout dashboard ---- */
.ch-shell { min-height: 100vh; }

.ch-topbar {
  background: var(--ch-espresso); color: var(--ch-cream);
  height: 56px; display: flex; align-items: center;
}
.ch-brand { color: var(--ch-cream); font-weight: 500; font-size: 1.1rem; display: flex; align-items: center; gap: .4rem; }
.ch-brand i { color: var(--ch-orange); }
/* Logo de la marca (reemplaza al ícono en el wordmark); escala con el texto. */
.ch-brand-logo { width: 1.5em; height: 1.5em; flex: none; display: block; }
.ch-topbar a { color: var(--ch-cream); }
/* Los ítems de los menús desplegables van sobre fondo claro: texto oscuro. */
.ch-topbar .dropdown-menu .dropdown-item { color: var(--ch-espresso); }
.ch-topbar .dropdown-menu .dropdown-item:active,
.ch-topbar .dropdown-menu .dropdown-item.active { color: #fff; background-color: var(--ch-terra); }
.ch-topbar .dropdown-menu .dropdown-header { color: var(--ch-brown-lt); }

.ch-sidebar {
  background: var(--ch-espresso); color: var(--ch-cream);
  width: 240px; min-height: calc(100vh - 56px); padding: .75rem;
}
.ch-sidebar .ch-section {
  color: var(--ch-orange); font-size: .7rem; letter-spacing: .06em;
  text-transform: uppercase; padding: 1rem .75rem .25rem;
}
.ch-nav-link {
  display: flex; align-items: center; gap: .6rem;
  color: var(--ch-cream); padding: .55rem .75rem; border-radius: .5rem;
  font-size: .95rem;
}
.ch-nav-link i { width: 1.2rem; text-align: center; }
.ch-nav-link:hover { background: var(--ch-brown); color: var(--ch-white); }
.ch-nav-link.active { background: var(--ch-terra); color: #fff; }

.ch-content { padding: 1.5rem 2rem; flex: 1; min-width: 0; }
.ch-content h1 { color: var(--ch-espresso); font-weight: 500; }

/* Tarjetas con borde crema */
.card { border-color: var(--ch-cream-dk); }
.ch-metric .label { color: var(--ch-brown-lt); font-size: .8rem; }
.ch-metric .value { color: var(--ch-espresso); font-size: 1.6rem; font-weight: 500; }

.ch-avatar {
  width: 32px; height: 32px; border-radius: 50%; background: var(--ch-terra);
  color: #fff; display: inline-flex; align-items: center; justify-content: center;
  font-size: .8rem;
}

/* ============================================================
   Landing page pública (Index sin sesión)
   ============================================================ */
.ch-landing { background: var(--ch-cream); }

.ch-land-nav {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 24px; background: var(--ch-espresso);
}
.ch-land-nav .ch-brand { color: var(--ch-white); font-size: 1.25rem; }

.ch-btn-cta {
  background: var(--ch-terra); border-color: var(--ch-terra); color: #fff;
}
.ch-btn-cta:hover { background: var(--ch-brown); border-color: var(--ch-brown); color: #fff; }

/* Hero */
.ch-hero {
  background: linear-gradient(135deg, var(--ch-espresso) 0%, var(--ch-brown) 100%);
  color: var(--ch-white);
  padding: 80px 24px 96px;
}
.ch-hero-icon { font-size: 3.5rem; color: var(--ch-orange); margin-bottom: .5rem; }
.ch-hero-title {
  font-size: clamp(2rem, 5vw, 3.2rem); font-weight: 700; max-width: 820px;
  margin: 0 auto .75rem;
}
.ch-hero-sub {
  font-size: 1.15rem; opacity: .92; max-width: 640px; margin: 0 auto;
}

/* Características */
.ch-features { padding: 72px 0; background: var(--ch-cream); }
.ch-feature {
  background: var(--ch-white); border: 1px solid var(--ch-cream-dk);
  border-radius: 14px; padding: 28px 22px; height: 100%; text-align: center;
  transition: transform .15s ease, box-shadow .15s ease;
}
.ch-feature:hover { transform: translateY(-4px); box-shadow: 0 10px 24px rgba(74,53,40,.12); }
.ch-feature i { font-size: 2.2rem; color: var(--ch-terra); }
.ch-feature h3 { font-size: 1.15rem; margin: .75rem 0 .4rem; color: var(--ch-espresso); }
.ch-feature p { color: var(--ch-brown); font-size: .95rem; margin: 0; }

/* Cómo funciona */
.ch-steps { padding: 72px 0; background: var(--ch-cream-dk); }
.ch-steps h2 { color: var(--ch-espresso); }
.ch-step-num {
  width: 56px; height: 56px; border-radius: 50%; margin: 0 auto 1rem;
  display: flex; align-items: center; justify-content: center;
  background: var(--ch-terra); color: #fff; font-size: 1.6rem; font-weight: 700;
}

/* Footer */
.ch-land-footer { background: var(--ch-espresso); color: var(--ch-white); padding: 40px 24px; }
.ch-land-footer .ch-brand { color: var(--ch-white); }

/* ============================================================
   Publicidad (banner / carrusel)
   ============================================================ */
.ch-ad { position: relative; }
.ch-ad-title { font-size: .8rem; font-weight: 600; color: var(--ch-brown); margin-bottom: .35rem; }
.ch-ad-box { border-radius: 12px; overflow: hidden; border: 1px solid var(--ch-cream-dk); background: var(--ch-white); }
.ch-ad-img { height: 150px; object-fit: cover; }
@media (max-width: 576px) { .ch-ad-img { height: 110px; } }
.ch-ad-tag {
  position: absolute; top: 6px; right: 8px; z-index: 5;
  font-size: .62rem; text-transform: uppercase; letter-spacing: .04em;
  background: rgba(74,53,40,.6); color: #fff; padding: 1px 7px; border-radius: 10px;
}
.ch-ad .carousel-indicators { margin-bottom: .25rem; }
.ch-ad .carousel-indicators [data-bs-target] { width: 8px; height: 8px; border-radius: 50%; }

/* Carrusel de promociones en la ficha: imagen apaisada compacta */
.ch-promo-img { width: 100%; height: 130px; object-fit: cover; border-radius: 12px; }
@media (max-width: 576px) { .ch-promo-img { height: 104px; } }
#promosCafe .carousel-indicators { position: static; margin: .6rem 0 0; }
#promosCafe .carousel-indicators [data-bs-target] {
  width: 8px; height: 8px; border-radius: 50%; background-color: var(--ch-cream-dk); border: 0; opacity: 1;
}
#promosCafe .carousel-indicators .active { background-color: var(--ch-terra); }

/* Iconos de redes sociales del café (ficha) */
.ch-social { display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--ch-cream-dk);
  color: var(--ch-espresso); background: #fff; font-size: 1.2rem; text-decoration: none;
  transition: background-color .15s, color .15s, border-color .15s; }
.ch-social:hover { background: var(--ch-orange); color: #fff; border-color: var(--ch-orange); }

/* Logo del café: mediano junto al nombre en la ficha, chico en el buscador */
.ch-cafe-logo { width: 48px; height: 48px; flex: none; object-fit: contain; border-radius: 10px;
  border: 1px solid var(--ch-cream-dk); background: #fff; padding: 3px; }
.ch-cafe-logo-sm { width: 40px; height: 40px; flex: none; object-fit: contain; border-radius: 8px;
  border: 1px solid var(--ch-cream-dk); background: #fff; padding: 2px; }

/* Carrusel de fotos de la ficha de comercio (más grande que la publicidad) */
.ch-foto-carousel { border-radius: 14px; overflow: hidden; border: 1px solid var(--ch-cream-dk); }
.ch-foto-img { height: 340px; object-fit: cover; }
@media (max-width: 576px) { .ch-foto-img { height: 220px; } }

/* ============================================================
   Navegación inferior estilo app (PWA mobile)
   ============================================================ */
/* Dock único flotante: contenedor redondeado despegado de los bordes. */
.ch-tabbar {
  position: fixed; z-index: 1030;
  left: 12px; right: 12px; bottom: calc(10px + env(safe-area-inset-bottom));
  display: flex; align-items: center; justify-content: space-around; gap: 2px;
  padding: 6px 10px;
  background: var(--ch-white); border: 1px solid var(--ch-cream-dk); border-radius: 1.75rem;
  box-shadow: 0 10px 28px rgba(74, 53, 40, .22);
  /* Estabiliza el fixed en iOS Safari (evita que "salte" a mitad de pantalla
     al aparecer/ocultarse la barra del navegador al hacer scroll). */
  transform: translateZ(0);
  -webkit-transform: translateZ(0);
}
.ch-tab {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 6px 2px; border-radius: 1rem;
  font-size: .62rem; line-height: 1.05; text-align: center; color: var(--ch-brown-lt);
  transition: background-color .12s ease, color .12s ease;
}
.ch-tab i { font-size: 1.3rem; }
.ch-tab:hover { color: var(--ch-brown); }
.ch-tab.active { background: rgba(200, 112, 59, .14); color: var(--ch-terra); font-weight: 600; }
.ch-tab.active i { color: var(--ch-terra); }

/* Botón central (FAB): asoma por encima del dock */
.ch-tab-fab { flex: 0 0 auto; padding: 0; }
.ch-fab {
  display: inline-flex; align-items: center; justify-content: center;
  width: 56px; height: 56px; border-radius: 50%; margin-top: -30px;
  background: linear-gradient(135deg, var(--ch-terra), #A9541F); color: #fff;
  border: 4px solid var(--ch-white); box-shadow: 0 6px 16px rgba(169, 84, 31, .45);
}
.ch-fab i { font-size: 1.55rem; }
.ch-fab-lbl { display: block; margin-top: 2px; font-size: .62rem; color: var(--ch-brown-lt); }
.ch-tab-fab.active .ch-fab-lbl { color: var(--ch-terra); font-weight: 600; }

/* El contenido no queda tapado por el dock flotante (solo mobile) */
@media (max-width: 991.98px) {
  .ch-content { padding: 1.25rem 1rem calc(98px + env(safe-area-inset-bottom)); }
}

/* Hoja "Más": menú completo, mismo tono que el sidebar */
.ch-mas.offcanvas-bottom {
  height: auto; max-height: 82vh;
  background: var(--ch-espresso); color: var(--ch-cream);
  border-radius: 18px 18px 0 0;
}
.ch-mas .ch-brand { color: var(--ch-cream); }
.ch-mas .offcanvas-body { padding: .25rem .75rem 1.25rem; overflow-y: auto; }

/* Divisor "o" para el login (separa email/contraseña de Google) */
.ch-divisor { display: flex; align-items: center; text-align: center; color: var(--ch-brown); font-size: .85rem; }
.ch-divisor::before, .ch-divisor::after { content: ''; flex: 1; border-bottom: 1px solid var(--ch-cream-dk); }
.ch-divisor span { padding: 0 .75rem; }
