/*
 * LA WEB EN EL MOVIL, COMO UNA APP (includes/movil-app.php).
 * Todo esto solo existe por debajo de 769 px: en tablet y ordenador no cambia nada.
 */
.ma-barra, .ma-hoja, .ma-fondo { display: none; }

@media (max-width: 768px) {
  :root { --ma-alto: 64px; --ma-seguro: env(safe-area-inset-bottom, 0px); }

  /*
   * Hueco para la barra al final de cada pagina. Va en el pie (lo ultimo de todas) y no en el body:
   * algunas paginas fijan el body a una pantalla de alto y su margen no caeria al final. +26: el
   * boton central sobresale por encima de la barra.
   */
  footer { padding-bottom: calc(var(--ma-alto) + var(--ma-seguro) + 26px) !important; }

  /* El menu de arriba ya esta en la barra: fuera la hamburguesa y su desplegable. */
  header .menu-toggle, header #main-nav { display: none !important; }

  /* ── La barra ── */
  .ma-barra {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    align-items: end;
    position: fixed;
    left: 0; right: 0; bottom: 0;
    top: auto !important;            /* header.php pone «top: 70px» a todos los <nav> del movil */
    width: auto !important;
    flex-direction: initial;
    z-index: 9000;
    height: calc(var(--ma-alto) + var(--ma-seguro));
    padding: 0 6px var(--ma-seguro);
    background: rgba(255, 255, 255, 0.94);
    -webkit-backdrop-filter: saturate(160%) blur(14px);
    backdrop-filter: saturate(160%) blur(14px);
    border-top: 1px solid rgba(3, 2, 2, 0.08);
    box-shadow: 0 -6px 24px rgba(3, 2, 2, 0.08);
    font-family: var(--font-primary, Roboto, sans-serif);
  }

  .ma-tab, .ma-centro {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 3px;
    height: var(--ma-alto);
    background: none; border: 0; padding: 0;
    color: #6b6b6b;
    text-decoration: none;
    font-size: 11px; font-weight: 600; letter-spacing: .01em;
    -webkit-tap-highlight-color: transparent;
    cursor: pointer;
  }
  .ma-tab i { font-size: 19px; transition: transform .2s; }
  .ma-tab:active i { transform: scale(.88); }
  .ma-tab.activa { color: #229e8b; }
  .ma-tab.activa i { color: #2dbaa5; }

  .ma-centro { color: #030202; justify-content: flex-end; padding-bottom: 7px; }
  .ma-centro-boton {
    display: grid; place-items: center;
    width: 52px; height: 52px;
    margin-top: -22px; margin-bottom: 2px;
    border-radius: 50%;
    background: linear-gradient(145deg, #3fcab5, #229e8b);
    color: #fff; font-size: 20px;
    box-shadow: 0 8px 18px rgba(34, 158, 139, .38), 0 0 0 5px #fff;
    transition: transform .2s;
  }
  .ma-centro:active .ma-centro-boton { transform: scale(.92); }

  /* ── La hoja del menu ── */
  .ma-fondo {
    display: block;
    position: fixed; inset: 0; z-index: 9500;
    background: rgba(3, 2, 2, .38);
    opacity: 0; transition: opacity .25s;
  }
  .ma-fondo.abierta { opacity: 1; }
  .ma-fondo[hidden], .ma-hoja[hidden] { display: none; }

  .ma-hoja {
    display: block;
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 9600;
    max-height: 86vh; overflow-y: auto; overscroll-behavior: contain;
    padding: 8px 18px calc(18px + var(--ma-seguro));
    background: #fff;
    border-radius: 22px 22px 0 0;
    box-shadow: 0 -12px 40px rgba(3, 2, 2, .18);
    transform: translateY(100%);
    transition: transform .32s cubic-bezier(.2, .8, .2, 1);
    font-family: var(--font-primary, Roboto, sans-serif);
  }
  .ma-hoja.abierta { transform: translateY(0); }

  .ma-asa { width: 42px; height: 5px; border-radius: 3px; background: #ddd; margin: 4px auto 12px; }

  .ma-hoja-cab { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
  .ma-hoja-cab img { width: 44px; height: 44px; object-fit: contain; }
  .ma-hoja-cab div { flex: 1; display: flex; flex-direction: column; line-height: 1.2; }
  .ma-hoja-cab strong { font-family: var(--font-headings, Anton, sans-serif); font-weight: 400; font-size: 1.35rem; color: #030202; }
  .ma-hoja-cab span { font-size: .85rem; color: #777; }
  .ma-cerrar {
    width: 38px; height: 38px; border-radius: 50%;
    border: 0; background: #f2f2f2; color: #333; font-size: 16px;
  }

  .ma-rejilla { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 18px; }
  .ma-rejilla a, .ma-rejilla button {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
    min-height: 86px; padding: 10px 6px;
    border-radius: 16px;
    background: #faf7f0; border: 1px solid #f0e8d6;
    color: #030202; text-decoration: none;
    font-size: .82rem; font-weight: 600; text-align: center;
    -webkit-tap-highlight-color: transparent;
  }
  .ma-rejilla i { font-size: 21px; color: #e7b435; }
  .ma-rejilla a.activa { background: #e9f7f4; border-color: #bfe6de; }
  .ma-rejilla a.activa i { color: #2dbaa5; }
  .ma-rejilla a:active, .ma-rejilla button:active { transform: scale(.97); }

  .ma-cuenta { display: flex; flex-direction: column; gap: 10px; margin-bottom: 18px; }
  .ma-cuenta-fila { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
  .ma-boton {
    display: flex; align-items: center; justify-content: center; gap: 8px;
    min-height: 48px; padding: 12px 14px;
    border-radius: 14px;
    border: 1px solid #e3d9c6; background: #fff;
    color: #030202; text-decoration: none;
    font-size: .95rem; font-weight: 700;
  }
  .ma-boton--principal { background: #2dbaa5; border-color: #2dbaa5; color: #fff; }
  .ma-salir { text-align: center; color: #bb3636; font-size: .9rem; font-weight: 600; text-decoration: none; padding: 6px; }

  .ma-pie { display: flex; flex-direction: column; align-items: center; gap: 10px; padding-top: 6px; border-top: 1px solid #f0f0f0; }
  .ma-redes { display: flex; gap: 12px; margin-top: 12px; }
  .ma-redes a {
    display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%;
    background: #f5f5f5; color: #333; text-decoration: none;
  }
  .ma-legal { font-size: .8rem; color: #999; }
  .ma-legal a { color: #777; text-decoration: none; }

  body.ma-sin-scroll { overflow: hidden; }

  /* ── El pie de pagina, compacto ── */
  footer .footer-main { gap: 12px !important; }
  footer .footer-section { padding: 18px !important; border-radius: 16px !important; }
  footer .footer-section:nth-child(2) { display: none !important; }      /* enlaces: ya estan en el menu */
  footer .footer-section h3 { font-size: 1.1rem !important; margin-bottom: 10px !important; }
  footer .footer-section p { font-size: .92rem !important; }
  footer .contact-info { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
  footer .contact-info p { margin: 0 !important; }
  footer .contact-info p:nth-child(n+3) { display: none !important; }     /* «España» y «24 horas» sobran aqui */
  footer .contact-info p a {
    display: inline-flex; align-items: center;
    padding: 9px 14px; border-radius: 999px;
    background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .14);
  }
  footer .footer-bottom-content { flex-direction: column; gap: 8px; text-align: center; }
}

@media (max-width: 768px) and (prefers-reduced-motion: reduce) {
  .ma-hoja, .ma-fondo { transition: none; }
}
