/* ============================================================
   Panel/Admin sidebar menu button — hidden on desktop
   ============================================================ */
/* Panel/Admin menu button — hidden on desktop */
.panel-menu-btn,
.adm-menu-btn {
  display: none;
}

/* Admin sidebar — desktop */
.admin-sidebar-nav {
  width: 240px;
  flex-shrink: 0;
  background: #111;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  transition: transform 0.3s cubic-bezier(.25,.46,.45,.94);
}

/* ============================================================
   MIL MULTIVERSOS — Responsive CSS
   Mobile-first breakpoints para celulares y tablets
   Incluir DESPUÉS de layout.css en todas las páginas

   Breakpoints:
     Tablet  : max-width: 1024px
     Mobile  : max-width: 768px
     Small   : max-width: 480px
   ============================================================ */

/* ============================================================
   1. NAVEGACIÓN PÚBLICA — hamburger menu
   ============================================================ */

/* Botón hamburguesa (oculto en desktop) */
.nav-hamburger {
  display: none;
  flex-direction: column;
  justify-content: space-between;
  width: 28px;
  height: 20px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
  z-index: 200;
}
.nav-hamburger span {
  display: block;
  height: 2px;
  background: var(--dark);
  border-radius: 2px;
  transition: all 0.3s ease;
  transform-origin: center;
}
.nav-hamburger.open span:nth-child(1) { transform: translateY(9px) rotate(45deg); }
.nav-hamburger.open span:nth-child(2) { opacity: 0; transform: scaleX(0); }
.nav-hamburger.open span:nth-child(3) { transform: translateY(-9px) rotate(-45deg); }

/* Drawer móvil */
.nav-mobile-drawer {
  display: none;
  position: fixed;
  top: var(--nav-h);
  left: 0; right: 0;
  background: rgba(250,247,242,.98);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--cream3);
  padding: 16px 20px 24px;
  z-index: 99;
  flex-direction: column;
  gap: 4px;
  box-shadow: 0 8px 32px rgba(0,0,0,.08);
  max-height: calc(100vh - var(--nav-h));
  overflow-y: auto;
}
.nav-mobile-drawer.open { display: flex; }

.nav-mobile-drawer .nav-link {
  font-size: 15px;
  padding: 12px 16px;
  border-radius: 12px;
  width: 100%;
  display: flex;
}
.nav-mobile-drawer .nav-divider {
  height: 1px;
  background: var(--cream3);
  margin: 8px 0;
}
.nav-mobile-drawer .nav-mobile-cta {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}
.nav-mobile-drawer .nav-mobile-cta .btn {
  width: 100%;
  justify-content: center;
  padding: 12px 20px;
  font-size: 14px;
}
.nav-mobile-drawer .nav-auth-item {
  border-radius: 12px;
  padding: 12px 16px;
}

/* ============================================================
   TABLET — 1024px
   ============================================================ */
@media (max-width: 1024px) {

  /* --- Contenedor base ------------------------------------ */
  .container { padding: 0 24px; }
  .section { padding: 56px 24px; }
  .section-sm { padding: 32px 24px; }

  /* --- Navegación pública -------------------------------- */
  .nav { padding: 0 20px; }
  .nav-center { display: none; } /* se mueve al drawer */
  /* Ocultar TODO en nav-right excepto hamburger */
  .nav-right > *:not(.nav-hamburger) { display: none !important; }
  .nav-hamburger { display: flex !important; }

  /* --- KPIs 2 columnas en tablet ------------------------ */
  .kpis-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
  }

  /* --- Footer ------------------------------------------- */
  .footer { padding: 48px 24px 28px; }
  .footer-grid {
    grid-template-columns: 1fr 1fr;
    gap: 32px;
  }
  .footer-brand { grid-column: 1 / -1; }

  /* --- Panel sidebar — reducir ancho -------------------- */
  .panel-layout {
    grid-template-columns: 190px 1fr;
  }
  .panel-sidebar { width: 190px; }

  .admin-layout {
    grid-template-columns: 200px 1fr;
  }

  /* --- Panel main padding ------------------------------- */
  .panel-main { padding: 24px; }

  /* --- Secciones del home ------------------------------- */
  .sec  { padding: 64px 24px; }
  .sec-sm { padding: 44px 24px; }
}

/* ============================================================
   MOBILE — 768px
   ============================================================ */
@media (max-width: 768px) {

  /* --- Contenedor base ------------------------------------ */
  :root { --nav-h: 56px; }
  .container { padding: 0 16px; }
  .section { padding: 48px 16px; }
  .section-sm { padding: 28px 16px; }

  /* --- Navegación pública -------------------------------- */
  .nav { padding: 0 16px; height: var(--nav-h); }
  .nav-right { gap: 8px; }
  /* En móvil: ocultar todo en nav-right excepto hamburger */
  .nav-right > *:not(.nav-hamburger) { display: none; }
  .nav-hamburger { display: flex !important; }

  /* Sidebar oculto por defecto en móvil — guía Y admin */
  #panelSidebar,
  .panel-sidebar,
  .panel-sidebar-nav,
  .admin-sidebar-nav {
    width: 260px !important;
    position: fixed !important;
    top: 0; left: 0;
    height: 100vh !important;
    z-index: 300;
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(.25,.46,.45,.94);
    box-shadow: none;
  }
  #panelSidebar.sidebar-open,
  .panel-sidebar.sidebar-open,
  .panel-sidebar-nav.sidebar-open,
  .admin-sidebar-nav.sidebar-open {
    transform: translateX(0);
    box-shadow: 4px 0 32px rgba(0,0,0,.25);
  }

  /* El wrapper flex externo ocupa todo el ancho */
  body > div[style*="display:flex"],
  .panel-layout,
  .admin-layout {
    display: block !important;
  }

  /* adm-main ocupa todo el ancho cuando sidebar está oculto */
  .adm-main {
    width: 100% !important;
    min-width: 0 !important;
  }

  /* Overlay oscuro cuando sidebar está abierto */
  .sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.45);
    z-index: 299;
  }
  .sidebar-overlay.active { display: block; }

  /* Botón hamburguesa en topbar del panel */
  .panel-menu-btn,
  .adm-menu-btn {
    display: flex !important;
    align-items: center;
    justify-content: center;
    width: 36px; height: 36px;
    background: none;
    border: 1px solid var(--cream3);
    border-radius: 8px;
    cursor: pointer;
    color: var(--mid);
    font-size: 15px;
    flex-shrink: 0;
  }


  /* Panel main ocupa todo el ancho */
  .panel-main { padding: 16px; }

  /* Topbars de panel */
  .panel-topbar { padding: 0 16px; }
  .adm-content { padding: 16px; }
  .adm-topbar {
    padding: 0 16px !important;
    padding-top: calc(env(safe-area-inset-top, 0px) + 8px) !important;
    height: auto !important;
    min-height: 54px !important;
  }

  /* --- KPIs 2 columnas en móvil ---- */
  .kpis-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }
  .kpi-card { padding: 16px 18px; }
  .kpi-val { font-size: 26px; }

  /* --- Footer ------------------------------------------- */
  .footer { padding: 40px 20px 24px; }
  .footer-grid {
    grid-template-columns: 1fr;
    gap: 24px;
  }
  .footer-brand { grid-column: auto; }
  .footer-brand p { max-width: 100%; }
  .footer-bottom {
    flex-direction: column;
    gap: 8px;
    text-align: center;
    padding-top: 20px;
  }

  /* --- Tablas de datos — scroll horizontal -------------- */
  .data-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .data-table {
    min-width: 600px;
  }
  .data-table-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    padding: 16px;
  }

  /* --- Grids de servicios / guías ----------------------- */
  .services-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 14px;
  }
  .therapists-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 12px;
  }

  /* --- Modales ------------------------------------------ */
  .modal-overlay { padding: 12px; align-items: flex-end; }
  .modal {
    max-width: 100%;
    max-height: 88vh;
    border-radius: var(--r2) var(--r2) 0 0;
  }
  .modal-header { padding: 20px 20px 0; }
  .modal-body { padding: 16px 20px 24px; }

  /* --- Toast en móvil ----------------------------------- */
  .toast-container {
    bottom: 16px;
    right: 16px;
    left: 16px;
  }
  .toast { min-width: unset; max-width: 100%; }

  /* --- Secciones del home ------------------------------- */
  .sec  { padding: 52px 16px; }
  .sec-sm { padding: 36px 16px; }
  .sec-wrap { max-width: 100%; }
  .sec-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 28px;
  }
  .sec-title { font-size: clamp(24px, 6vw, 32px); }

  /* ---- HERO -------------------------------------------- */
  .hero {
    min-height: 520px;
    max-height: none;
    height: auto;
    padding-top: 80px;
    padding-bottom: 100px;
  }
  .hero-content {
    padding: 0 16px;
    margin-top: 0;
  }
  .hero h1 {
    font-size: clamp(36px, 10vw, 54px);
    letter-spacing: -0.5px;
  }
  .hero-subtitle {
    font-size: 14px;
    margin-bottom: 32px;
  }
  .hero-badge { font-size: 9px; padding: 7px 14px; margin-bottom: 24px; }
  .hero-btns { gap: 10px; }
  .btn-hero-primary,
  .btn-hero-outline {
    padding: 12px 22px;
    font-size: 13px;
  }

  .hero-stats-bar {
    flex-wrap: wrap;
    gap: 0;
    padding: 20px 0;
  }
  .hero-stat {
    padding: 8px 24px;
    flex: 1;
    min-width: 33%;
    border-right: 1px solid rgba(255,255,255,.12);
  }
  .hero-stat:nth-child(3) { border-right: none; }
  .hero-stat .val { font-size: 22px; }
  .hero-stat .lbl { font-size: 9px; }

  /* ---- Discovery / Search bar ------------------------- */
  .discovery-bar { padding: 24px 16px 20px; }
  .search-section { padding: 16px; }
  .search-inner { flex-wrap: wrap; gap: 10px; }
  .filter-chips { overflow-x: auto; flex-wrap: nowrap; padding-bottom: 4px; }

  /* ---- Carrusel wheel ---------------------------------- */
  .wheel-btn-prev { left: 6px; }
  .wheel-btn-next { right: 6px; }
  .wheel-card { flex: 0 0 220px; }

  /* ---- Unveiling footer -------------------------------- */
  #main-content {
    border-bottom-left-radius: 18px;
    border-bottom-right-radius: 18px;
  }

  /* ---- Formularios ------------------------------------ */
  .form-grid-2 {
    grid-template-columns: 1fr !important;
  }
}

/* ============================================================
   SMALL MOBILE — 480px
   ============================================================ */
@media (max-width: 480px) {

  /* --- KPIs 1 columna en móvil pequeño ---- */
  .kpis-grid { grid-template-columns: 1fr 1fr; gap: 8px; }

  /* --- Servicios: 1 columna ----------------------------- */
  .services-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .therapists-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  /* --- Hero más compacto -------------------------------- */
  .hero { padding-top: 60px; padding-bottom: 80px; }
  .hero h1 { font-size: clamp(32px, 11vw, 44px); }
  .hero-btns { flex-direction: column; align-items: center; }
  .btn-hero-primary,
  .btn-hero-outline { width: 100%; max-width: 300px; justify-content: center; }

  /* --- Carrusel wheel ----------------------------------- */
  .wheel-card { flex: 0 0 88vw; max-width: 320px; }
  .wheel-fade { width: 60px; }

  /* --- Footer ------------------------------------------- */
  .footer-grid { grid-template-columns: 1fr; }

  /* --- Tabla -------------------------------------------- */
  .data-table { min-width: 520px; }

  /* --- Botones del panel -------------------------------- */
  .btn-lg, .btn-xl {
    padding: 12px 22px;
    font-size: 12px;
  }
}

/* ============================================================
   2. PÁGINAS PÚBLICAS — clases inline comunes
   Manejo de los grids escritos como style="display:grid;..."
   usando clases más genéricas
   ============================================================ */

@media (max-width: 768px) {

  /* Checkout de 2 columnas → 1 columna */
  .checkout-grid {
    grid-template-columns: 1fr !important;
    gap: 20px;
  }

  /* Blog grid */
  .blog-grid {
    grid-template-columns: 1fr !important;
  }

  /* Grid 2 columnas inline en formularios / cards */
  [style*="grid-template-columns:1fr 1fr"],
  [style*="grid-template-columns: 1fr 1fr"] {
    grid-template-columns: 1fr !important;
  }

  /* Grids de 3 o más columnas → 1 o 2 */
  [style*="grid-template-columns:repeat(3"],
  [style*="grid-template-columns: repeat(3"] {
    grid-template-columns: repeat(2, 1fr) !important;
  }
  [style*="grid-template-columns:repeat(4"],
  [style*="grid-template-columns: repeat(4"] {
    grid-template-columns: repeat(2, 1fr) !important;
  }

  /* Flex rows con gap que deberían wrappear */
  [style*="display:flex"][style*="gap"],
  [style*="display: flex"][style*="gap"] {
    flex-wrap: wrap;
  }

  /* Page headers (secciones superiores de páginas) */
  .page-header {
    padding: 36px 20px !important;
  }
  .page-header-inner { padding: 0; }

  /* Sección de cómo funciona: 3 pasos en vertical */
  .how-grid,
  .steps-grid {
    grid-template-columns: 1fr !important;
  }

  /* Terapeuta / detalle: layout 2 columnas → 1 */
  .det-layout,
  .det-grid,
  .th-detail-layout,
  .content-grid {
    grid-template-columns: 1fr !important;
    gap: 24px !important;
  }

  /* Sección CTA split */
  .cta-split {
    grid-template-columns: 1fr !important;
    text-align: center;
  }

  /* Cursos grid */
  .courses-grid,
  .cg {
    grid-template-columns: 1fr 1fr !important;
  }
}

@media (max-width: 480px) {
  .courses-grid,
  .cg {
    grid-template-columns: 1fr !important;
  }

  /* Detalle de servicio: sticky sidebar en móvil */
  .det-sidebar,
  .booking-sidebar {
    position: static !important;
    top: auto !important;
  }

  /* Tabs que no caben en horizontal */
  .tabs-row,
  .filter-row {
    flex-wrap: wrap;
    gap: 6px !important;
  }
}

/* ============================================================
   3. PANEL DE GUÍA Y ADMIN — topbar con botón de menú
   ============================================================ */

@media (max-width: 768px) {

  /* Topbar del panel guía */
  .panel-topbar {
    padding: 0 14px;
    height: 54px;
  }
  .panel-topbar-left { gap: 10px; }

  /* Esconder texto en topbar actions que no caben */
  .panel-topbar .btn span,
  .adm-topbar .btn span {
    display: none;
  }

  /* Grids del panel en 1 columna */
  .panel-grid-2,
  .adm-grid-2 {
    grid-template-columns: 1fr !important;
  }

  /* Cards de stats: 2 por fila máximo */
  .stats-row {
    flex-wrap: wrap;
    gap: 10px;
  }
  .stats-row > * {
    flex: 1 1 calc(50% - 5px);
    min-width: 0;
  }

  /* Tablas en panel - siempre scroll */
  .data-table-wrap {
    border-radius: 12px;
  }

  /* Panel welcome header */
  .panel-welcome-inner {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 16px;
  }

  /* Mensajes / inbox — layout split */
  .messages-layout,
  .inbox-layout {
    flex-direction: column !important;
    height: auto !important;
  }
  .messages-list,
  .inbox-list {
    width: 100% !important;
    max-height: 300px;
    border-right: none !important;
    border-bottom: 1px solid var(--cream3);
    overflow-y: auto;
  }
  .messages-view,
  .inbox-view {
    width: 100% !important;
  }

  /* Agenda / calendario */
  .agenda-grid {
    grid-template-columns: 1fr !important;
  }

  /* Perfil del guía: formulario en 1 columna */
  .perfil-form-grid {
    grid-template-columns: 1fr !important;
  }
}

/* ============================================================
   4. PÁGINA DE LOGIN / REGISTRO — centrado en móvil
   ============================================================ */

@media (max-width: 768px) {
  .auth-card,
  .login-card,
  .register-card {
    margin: 0 !important;
    border-radius: 16px !important;
    padding: 28px 20px !important;
    max-width: 100% !important;
  }

  .auth-layout,
  .login-layout {
    flex-direction: column !important;
    min-height: 100vh;
    padding: 20px 16px;
  }

  .auth-aside,
  .login-aside {
    display: none !important;
  }
}

/* ============================================================
   5. PÁGINA DE BLOG Y ARTÍCULO
   ============================================================ */

@media (max-width: 768px) {
  .blog-grid {
    grid-template-columns: 1fr !important;
    gap: 16px;
  }
  .blog-article-layout {
    grid-template-columns: 1fr !important;
    gap: 24px;
  }
  .blog-sidebar {
    position: static !important;
  }
}

/* ============================================================
   6. CHECKOUT
   ============================================================ */

@media (max-width: 768px) {
  .checkout-grid {
    grid-template-columns: 1fr !important;
    gap: 20px;
  }
  .checkout-summary {
    position: static !important;
    top: auto !important;
  }
  .checkout-wrapper {
    padding: 16px !important;
  }
}

/* ============================================================
   7. TESTIMONIALES / CARRUSEL
   ============================================================ */

@media (max-width: 768px) {
  .testimonials-grid {
    grid-template-columns: 1fr !important;
  }
  .testimonial-card {
    max-width: 100%;
  }
}

/* ============================================================
   8. CATEGORÍAS Y CHIPS FILTRO
   ============================================================ */

@media (max-width: 768px) {
  .categories-grid {
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 8px;
  }
  .category-chip { font-size: 11px; padding: 8px 6px; }
}

@media (max-width: 480px) {
  .categories-grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }
}

/* ============================================================
   9. UTILIDADES RESPONSIVE
   ============================================================ */

/* Ocultar/mostrar selectivamente */
@media (max-width: 768px) {
  .hide-mobile { display: none !important; }
  .show-mobile { display: block !important; }
  .show-mobile-flex { display: flex !important; }
}

@media (min-width: 769px) {
  .show-mobile  { display: none !important; }
  .show-mobile-flex { display: none !important; }
}

@media (max-width: 1024px) {
  .hide-tablet { display: none !important; }
  .show-tablet { display: block !important; }
}

@media (min-width: 1025px) {
  .show-tablet { display: none !important; }
}

/* Textos que deben truncarse en móvil */
@media (max-width: 768px) {
  .truncate-mobile {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 180px;
  }
}

/* Padding reducido genérico para wrappers con padding inline */
@media (max-width: 768px) {
  [style*="padding:32px"],
  [style*="padding: 32px"] {
    padding: 16px !important;
  }
  [style*="padding:24px"],
  [style*="padding: 24px"] {
    padding: 14px !important;
  }
  [style*="padding:28px 32px"],
  [style*="padding: 28px 32px"] {
    padding: 16px !important;
  }
}

/* ============================================================
   10. FIX OVERFLOW GLOBAL
   ============================================================ */
@media (max-width: 768px) {
  body {
    overflow-x: hidden;
  }
  .sec-wrap,
  .container,
  #main-content {
    max-width: 100%;
  }

  /* Tables horizontales */
  .table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}