/* ══════════════════════════════════════════════════════════════
   app-movil.css — Estilo APP en el celular + componentes v10.14
   (CimaTech · AGENDAMIENTO)
   · En computador la app se ve igual que antes.
   · En el celular (≤ 767 px): barra superior compacta, barra de
     navegación inferior, botón de ayuda redondo, toques grandes,
     sin rebote ni zoom accidental. Funciona en tema claro y oscuro.
   · Componentes nuevos: hoja "Cambiar horario" (cx-*) y Notas (nt-*).
   Todo usa las variables de estilos.css (--surface, --text, --theme-color…).
   ══════════════════════════════════════════════════════════════ */

/* ───────────── Componentes compartidos (todas las pantallas) ───────────── */
/* Los avisos (mostrarModal) siempre por encima de las hojas nuevas. */
#custom-modal { z-index: 9600 !important; }
.cx-overlay { position: fixed; inset: 0; z-index: 9500; background: rgba(8, 10, 24, .5); display: none; align-items: center; justify-content: center; padding: 16px; backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); }
.cx-overlay.open { display: flex; animation: cxFade .18s ease; }
.cx-sheet { width: 100%; max-width: 460px; max-height: calc(100dvh - 32px); overflow-y: auto; overscroll-behavior: contain; background: var(--menu-solid); color: var(--text); border: 1px solid var(--border); border-radius: 22px; box-shadow: 0 24px 60px rgba(0, 0, 0, .28); padding: 18px 18px 16px; }
.cx-grab { display: none; width: 40px; height: 5px; border-radius: 99px; background: var(--border-strong); margin: -6px auto 10px; }
.cx-bloqueo-scroll { overflow: hidden; }
@keyframes cxFade { from { opacity: 0; } to { opacity: 1; } }
@keyframes cxSube { from { transform: translateY(100%); } to { transform: translateY(0); } }

.cx-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.cx-titulo { font-family: var(--font-display); font-size: 18px; font-weight: 700; color: var(--text-strong); margin: 0; }
.cx-sub { font-size: 12.5px; color: var(--text-soft); margin-top: 2px; }
.cx-x { width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--border); background: var(--surface-inset); color: var(--text-soft); font-size: 14px; cursor: pointer; flex-shrink: 0; }
.cx-actual { font-size: 12.5px; color: var(--text); background: var(--surface-inset); border-radius: 12px; padding: 9px 12px; margin-bottom: 12px; }
.cx-campos { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }
.cx-lbl { display: block; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--text-soft); }
.cx-lbl .cx-input { margin-top: 5px; }
.cx-input { width: 100%; min-width: 0; padding: 10px 12px; border: 1px solid var(--border-strong); border-radius: 12px; background: var(--surface); color: var(--text-strong); font-size: 14px; font-family: inherit; outline: none; text-transform: none; letter-spacing: 0; font-weight: 500; }
.cx-input:focus { border-color: var(--theme-color); box-shadow: 0 0 0 3px rgba(var(--theme-rgb), .2); }
select.cx-input { appearance: auto; }

.cx-horas { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 7px; max-height: 260px; overflow-y: auto; padding: 2px; }
.cx-chip { position: relative; border-radius: 12px; padding: 9px 4px 8px; font-size: 13px; font-weight: 700; cursor: pointer; border: 1.5px solid var(--border-strong); background: var(--surface); color: var(--text-strong); line-height: 1.1; display: flex; flex-direction: column; align-items: center; gap: 2px; min-height: 46px; justify-content: center; }
.cx-chip small { font-size: 9.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; opacity: .85; }
.cx-chip.libre { border-color: rgba(22, 163, 74, .45); color: #15803d; background: rgba(22, 163, 74, .07); }
.cx-chip.ocupada { border-color: rgba(217, 119, 6, .5); color: #b45309; background: rgba(217, 119, 6, .08); }
.cx-chip.actual { border-style: dashed; color: var(--text-faint); background: transparent; cursor: default; }
.cx-chip.sel { background: var(--theme-color); border-color: var(--theme-color); color: #fff; box-shadow: 0 6px 16px var(--theme-glow); }
[data-tema="oscuro"] .cx-chip.libre { color: #4ade80; }
[data-tema="oscuro"] .cx-chip.ocupada { color: #fbbf24; }
.cx-leyenda { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 11px; color: var(--text-soft); margin-top: 8px; }
.cx-leyenda span { display: inline-flex; align-items: center; gap: 5px; }
.cx-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.cx-dot.libre { background: #16a34a; } .cx-dot.ocupada { background: #d97706; }
.cx-vacio { text-align: center; font-size: 13px; color: var(--text-soft); padding: 22px 12px; border: 1px dashed var(--border-strong); border-radius: 14px; }
.cx-fila-btns { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-top: 8px; }
.cx-pie { display: flex; gap: 10px; margin-top: 16px; }
.cx-pie .cx-btn-pri { flex: 1.6; } .cx-pie .cx-btn-sec { flex: 1; }
.cx-btn-pri { border: none; border-radius: 14px; padding: 12px 16px; font-weight: 800; font-size: 14px; cursor: pointer; color: #fff; background: linear-gradient(135deg, var(--theme-color), color-mix(in srgb, var(--theme-color) 70%, white)); box-shadow: 0 8px 20px var(--theme-glow); font-family: inherit; }
.cx-btn-pri:disabled { opacity: .45; box-shadow: none; cursor: not-allowed; }
.cx-btn-sec { border: 1px solid var(--border-strong); border-radius: 14px; padding: 11px 14px; font-weight: 700; font-size: 13.5px; cursor: pointer; color: var(--text); background: var(--surface); font-family: inherit; white-space: nowrap; }
.cx-cruces { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.cx-cruces li { font-size: 13px; color: var(--text); background: rgba(217, 119, 6, .1); border: 1px solid rgba(217, 119, 6, .35); border-radius: 12px; padding: 10px 12px; }
.cx-opcion { width: 100%; display: flex; gap: 12px; align-items: flex-start; text-align: left; padding: 12px 13px; margin-bottom: 8px; border-radius: 14px; border: 1.5px solid var(--border-strong); background: var(--surface); color: var(--text-strong); cursor: pointer; font-family: inherit; font-size: 14px; }
.cx-opcion:active { transform: scale(.985); }
.cx-opcion small { display: block; font-size: 12px; color: var(--text-soft); font-weight: 500; margin-top: 2px; }
.cx-op-ic { font-size: 20px; line-height: 1; margin-top: 1px; }
.cx-nota { font-size: 12px; color: var(--text-soft); background: var(--surface-inset); border-radius: 12px; padding: 9px 12px; margin-bottom: 8px; }
.cx-badge { display: inline-flex; align-items: center; justify-content: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 99px; font-size: 10.5px; font-weight: 800; background: #ef4444; color: #fff; line-height: 1; }
.cx-tag { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 99px; background: var(--surface-inset); color: var(--text); }
.cx-mini { border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); border-radius: 10px; padding: 6px 10px; font-size: 12px; font-weight: 700; cursor: pointer; font-family: inherit; }
.cx-mini.peligro { color: #dc2626; border-color: rgba(220, 38, 38, .35); }
.cx-seg { display: inline-flex; background: var(--surface-inset); border-radius: 12px; padding: 3px; gap: 2px; }
.cx-seg button { border: none; background: transparent; color: var(--text-soft); font-weight: 700; font-size: 12.5px; padding: 7px 11px; border-radius: 9px; cursor: pointer; display: inline-flex; align-items: center; gap: 5px; font-family: inherit; }
.cx-seg button.sel { background: var(--surface); color: var(--text-strong); box-shadow: 0 1px 4px rgba(0, 0, 0, .1); }
[data-tema="oscuro"] .cx-seg button.sel { background: rgba(255, 255, 255, .14); }
.cx-tipo { border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); border-radius: 99px; padding: 6px 11px; font-size: 12px; font-weight: 700; cursor: pointer; white-space: nowrap; font-family: inherit; }
.cx-tipo.sel { background: rgba(var(--theme-rgb), .12); border-color: var(--theme-color); color: var(--theme-color); }
/* Tema oscuro: el color del negocio suele ser oscuro (ej. vinotinto); se aclara para que se lea. */
[data-tema="oscuro"] .cx-tipo.sel, [data-tema="oscuro"] .app-tab.activa, [data-tema="oscuro"] .app-mas-item svg { color: color-mix(in srgb, var(--theme-color) 45%, white) !important; }
[data-tema="oscuro"] .app-tab.activa .app-tab-ic { background: rgba(var(--theme-rgb), .3) !important; }
/* v10.15.1 — El aviso se OCULTA con opacidad (antes solo se desplazaba hacia abajo y,
   en el celular, con texto de 3 líneas quedaba a la vista para siempre). Tocarlo lo cierra. */
.cx-toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 16px); opacity: 0; visibility: hidden; z-index: 9800; background: #111827; color: #fff; font-size: 13px; font-weight: 600; padding: 11px 16px; border-radius: 14px; box-shadow: 0 10px 30px rgba(0, 0, 0, .3); max-width: calc(100vw - 32px); transition: transform .25s var(--ease), opacity .2s ease, visibility 0s linear .25s; pointer-events: none; text-align: center; }
.cx-toast.ver { transform: translate(-50%, 0); opacity: 1; visibility: visible; pointer-events: auto; cursor: pointer; transition: transform .25s var(--ease), opacity .2s ease, visibility 0s; }

/* Botón "Activar" del aviso de notificaciones: bg-amber-500 no existe en tailwind.css
   (se veía blanco sobre blanco). Se define aquí. */
.bg-amber-500 { background-color: #f59e0b; }
.hover\:bg-amber-600:hover { background-color: #d97706; }

/* Colores que el código usa pero que NO estaban en tailwind.css (precompilado):
   se veían sin color. Se completan aquí con la paleta oficial de Tailwind. */
.bg-blue-500 { background-color: #3b82f6; }
.bg-rose-100 { background-color: #ffe4e6; }
.border-amber-300 { border-color: #fcd34d; }
.border-blue-300 { border-color: #93c5fd; }
.text-amber-600 { color: #d97706; }
.text-rose-400 { color: #fb7185; }
.text-rose-700 { color: #be123c; }
.text-rose-800 { color: #9f1239; }
.hover\:bg-amber-100:hover { background-color: #fef3c7; }
.hover\:bg-gray-100:hover { background-color: #f3f4f6; }
.hover\:bg-green-50:hover { background-color: #f0fdf4; }
.hover\:text-red-500:hover { color: #ef4444; }

/* ───────────── Cuaderno de notas ───────────── */
.nt-nueva { padding: 14px; margin-bottom: 14px; display: flex; flex-direction: column; gap: 10px; }
.nt-texto { resize: vertical; min-height: 74px; line-height: 1.45; }
.nt-tipos { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.nt-tipos::-webkit-scrollbar { display: none; }
.nt-fila { display: flex; gap: 8px; align-items: center; }
.nt-fila > .cx-input { flex: 1; }
.nt-fila-fin .cx-btn-pri { flex-shrink: 0; }
.nt-barra { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
#notas-lista { display: flex; flex-direction: column; gap: 9px; padding-bottom: 8px; }
.nt-item { display: flex; gap: 12px; align-items: flex-start; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 12px 13px; box-shadow: var(--glass-shadow); }
.nt-item.hecha { opacity: .72; }
.nt-item.hecha .nt-txt { text-decoration: line-through; text-decoration-color: var(--text-faint); color: var(--text-soft); }
.nt-check { width: 30px; height: 30px; border-radius: 50%; flex-shrink: 0; border: 2px solid var(--border-strong); background: var(--surface); color: #fff; font-weight: 900; font-size: 15px; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: transform .12s, background .15s; margin-top: 1px; }
.nt-check:active { transform: scale(.88); }
.nt-item.hecha .nt-check { background: #16a34a; border-color: #16a34a; }
.nt-cuerpo { flex: 1; min-width: 0; }
.nt-txt { font-size: 14px; color: var(--text-strong); white-space: pre-wrap; word-break: break-word; line-height: 1.45; }
.nt-meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 11.5px; color: var(--text-soft); margin-top: 7px; }
.nt-hecha { font-size: 11.5px; color: #16a34a; font-weight: 700; margin-top: 5px; }
.nt-acc { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; justify-content: flex-end; }

/* ══════════════════════════════════════════════════════════════
   MODO APP — solo celular
   ══════════════════════════════════════════════════════════════ */
.app-tabbar, .app-mas { display: none; }

@media (max-width: 767px) {
    html, body { overscroll-behavior-y: none; }
    body { -webkit-text-size-adjust: 100%; touch-action: manipulation; }
    button, a, .admin-tab { -webkit-user-select: none; user-select: none; }
    button:active, .press:active { transform: scale(.97); }

    /* Barra superior tipo app (respeta el notch del iPhone) */
    nav.sticky { padding-top: env(safe-area-inset-top, 0px); backdrop-filter: blur(18px) saturate(170%); -webkit-backdrop-filter: blur(18px) saturate(170%); background: var(--glass-bg-strong) !important; border-bottom: 1px solid var(--border); box-shadow: none !important; }
    nav.sticky > div { padding-top: 8px !important; padding-bottom: 8px !important; }
    #nav-title { font-size: 16px !important; }
    .nav-txt-cliente, .nav-txt-salir { display: none; }
    nav a[href="index.html"], #btn-cerrar-sesion { width: 36px; height: 36px; padding: 0 !important; justify-content: center; border-radius: 50% !important; }
    #tema-toggle { width: 36px !important; height: 36px !important; box-shadow: none !important; }

    /* Hojas (modales nuevos) suben desde abajo, como en una app */
    .cx-overlay { align-items: flex-end; padding: 0; }
    .cx-overlay.open .cx-sheet { animation: cxSube .26s var(--ease); }
    .cx-sheet { max-width: none; border-radius: 22px 22px 0 0; max-height: 92dvh; padding: 14px 16px calc(16px + env(safe-area-inset-bottom, 0px)); border-bottom: none; }
    .cx-grab { display: block; }
    .cx-campos { grid-template-columns: 1fr; }
    .cx-horas { grid-template-columns: repeat(4, 1fr); max-height: 38dvh; }
    .cx-toast { bottom: calc(86px + env(safe-area-inset-bottom, 0px)); }

    /* Barra de navegación inferior (la arma app-movil.js) */
    .app-tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 60; display: none; justify-content: space-around; align-items: stretch; height: calc(62px + env(safe-area-inset-bottom, 0px)); padding: 0 4px env(safe-area-inset-bottom, 0px); background: var(--glass-bg-strong); backdrop-filter: blur(22px) saturate(180%); -webkit-backdrop-filter: blur(22px) saturate(180%); border-top: 1px solid var(--border); box-shadow: 0 -6px 24px rgba(20, 24, 60, .07); }
    body.con-tabbar .app-tabbar { display: flex; }
    .app-tab { position: relative; flex: 1; min-width: 0; border: none; background: transparent; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--text-soft); font-size: 10.5px; font-weight: 700; font-family: inherit; cursor: pointer; padding: 6px 2px 4px; }
    .app-tab svg, .app-tab i { width: 22px; height: 22px; }
    .app-tab .app-tab-ic { display: flex; align-items: center; justify-content: center; width: 52px; height: 30px; border-radius: 99px; transition: background .2s; }
    .app-tab.activa { color: var(--theme-color); }
    .app-tab.activa .app-tab-ic { background: rgba(var(--theme-rgb), .14); }
    .app-tab .cx-badge { position: absolute; top: 4px; left: calc(50% + 6px); }
    .app-tab span.app-tab-txt { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }

    body.con-tabbar main { padding-bottom: calc(96px + env(safe-area-inset-bottom, 0px)) !important; }
    body.con-tabbar #btn-flotante-wa { bottom: calc(74px + env(safe-area-inset-bottom, 0px)) !important; right: 14px !important; width: 52px; height: 52px; padding: 0 !important; border-width: 2px !important; }
    body.con-tabbar #btn-flotante-wa span { display: none; }
    /* En el celular el contador de días vive en la hoja "Más" (flotando tapaba el contenido). */
    body.con-tabbar #susc-contador { display: none !important; }
    body.con-tabbar #susc-banner { bottom: calc(62px + env(safe-area-inset-bottom, 0px)) !important; padding-bottom: 10px !important; font-size: 12px !important; }

    /* Hoja "Más" del panel admin */
    .app-mas { position: fixed; inset: 0; z-index: 9400; background: rgba(8, 10, 24, .45); display: none; align-items: flex-end; }
    .app-mas.open { display: flex; animation: cxFade .18s ease; }
    .app-mas-hoja { width: 100%; background: var(--menu-solid); border-radius: 22px 22px 0 0; padding: 10px 14px calc(18px + env(safe-area-inset-bottom, 0px)); animation: cxSube .26s var(--ease); max-height: 85dvh; overflow-y: auto; }
    .app-mas-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 6px 0 12px; }
    .app-mas-item { position: relative; border: 1px solid var(--border); background: var(--surface); border-radius: 16px; padding: 14px 6px 12px; display: flex; flex-direction: column; align-items: center; gap: 7px; font-size: 12px; font-weight: 700; color: var(--text-strong); cursor: pointer; font-family: inherit; }
    .app-mas-item svg { width: 22px; height: 22px; color: var(--theme-color); }
    .app-mas-item.activa { border-color: var(--theme-color); background: rgba(var(--theme-rgb), .08); }
    .app-mas-item .app-lock { position: absolute; top: 6px; right: 8px; font-size: 11px; }
    .app-mas-pie { display: flex; gap: 8px; align-items: center; justify-content: space-between; border-top: 1px solid var(--border); padding-top: 12px; flex-wrap: wrap; }
    .app-mas-pie .cx-mini { padding: 9px 12px; }

    /* ── Panel admin dentro del celular ── */
    body.con-tabbar #view-admin > .admin-tabs-bar { display: none !important; }
    body.con-tabbar .admin-panel > div:first-child h2 { font-size: 22px !important; }

    /* ── Página del cliente: pantalla completa tipo app ── */
    body.cliente-app main { padding: 10px 10px calc(96px + env(safe-area-inset-bottom, 0px)) !important; }
    body.cliente-app #view-client > .glass { border-radius: 22px; margin-bottom: 12px; }
    body.cliente-app #view-client > .glass > .bg-theme { padding: 18px 16px !important; }
    body.cliente-app #client-biz-name { font-size: 20px !important; }
    body.cliente-app #view-client > .glass > .bg-gray-50 { display: none !important; } /* pestañas → barra inferior */
    body.cliente-app #client-form-section { padding: 16px 14px !important; }
    body.cliente-app #btn-flotante-wa { display: none !important; } /* la ayuda pasa a la barra inferior */
}
