/* ═══════════════════════════════════════════════════════════════════════════
   selectMovilTheme.css — Hoja inferior para elegir en pantallas táctiles
   Comportamiento: js/selectMovilTheme.js
   ---------------------------------------------------------------------------
   En un dispositivo táctil el <select> deja de desplegar la lista de Select2 y
   sube esta hoja desde abajo: nombre del campo, buscador, opciones de dedo y
   botón de cerrar. Es una ventana, no un desplegable, y se lee como tal.

   El desplegable de Select2 sigue intacto para el ratón; aquí no hay ni una
   regla que lo toque.

   COLOR
     Hereda el color de marca (--sgi-color). Si el sistema se retematiza, la
     hoja cambia sola.
   ═══════════════════════════════════════════════════════════════════════════ */

.app-selm {
    --selm-accent: var(--sgi-color, #0a6ed1);
    --selm-soft:   var(--sgi-color-soft, #e7f0fb);
    --selm-texto:  #1f2d3d;
    --selm-tenue:  #64748b;
    --selm-borde:  #e9eef5;

    position: fixed;
    top: 0; right: 0; bottom: 0; left: 0;
    /* Por encima del desplegable de Select2 (9999) y de los modales de
       Bootstrap (1050): la hoja es lo último que se abre y lo primero que se
       toca. */
    z-index: 10050;
    display: flex;
    align-items: flex-end;
}

/* ── Fondo ──────────────────────────────────────────────────────────────────
   Apaga la pantalla de atrás para que se entienda que, mientras la hoja está
   abierta, no hay nada más con lo que interactuar. */
.app-selm__fondo {
    position: absolute;
    top: 0; right: 0; bottom: 0; left: 0;
    background: rgba(15, 23, 42, .45);
    opacity: 0;
    transition: opacity .22s ease;
}

/* ── Hoja ─────────────────────────────────────────────────────────────────── */
.app-selm__hoja {
    position: relative;
    width: 100%;
    max-height: 88vh;
    display: flex;
    flex-direction: column;
    background: #fff;
    border-radius: 18px 18px 0 0;
    box-shadow: 0 -8px 32px rgba(15, 23, 42, .22);
    /* Los teléfonos con gesto de inicio se comen la última franja. */
    padding-bottom: env(safe-area-inset-bottom, 0px);
    transform: translateY(100%);
    transition: transform .24s cubic-bezier(.32, .72, 0, 1);
}

.app-selm--visible .app-selm__fondo { opacity: 1; }
.app-selm--visible .app-selm__hoja  { transform: translateY(0); }

/* La rayita de arriba: dice «esto sube y baja» sin escribirlo. */
.app-selm__asa {
    width: 38px;
    height: 4px;
    margin: 8px auto 0;
    border-radius: 2px;
    background: #d7dee8;
    flex: none;
}

/* ── Cabecera ─────────────────────────────────────────────────────────────── */
.app-selm__cab {
    display: flex;
    align-items: center;
    padding: 10px 14px 8px;
    flex: none;
}

.app-selm__titulo {
    flex: 1 1 auto;
    min-width: 0;
    font-size: 15px;
    font-weight: 700;
    color: var(--selm-texto);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.app-selm__quitar {
    flex: none;
    margin-right: 6px;
    border: 0;
    background: transparent;
    padding: 6px 8px;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--selm-accent);
    cursor: pointer;
}

.app-selm__cerrar {
    flex: none;
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 50%;
    background: #f1f5f9;
    color: var(--selm-tenue);
    font-size: 19px;
    line-height: 1;
    cursor: pointer;
}
.app-selm__cerrar:active { background: #e2e8f0; }

/* ── Buscador ─────────────────────────────────────────────────────────────── */
.app-selm__buscar {
    padding: 2px 14px 10px;
    flex: none;
}

/* 16px es el mínimo que Safari en iOS acepta sin acercar la página al enfocar;
   con menos hace zoom y ya no vuelve. */
.app-selm__buscar input {
    width: 100%;
    height: 44px;
    padding: 0 12px 0 38px;
    font-size: 16px;
    color: var(--selm-texto);
    border: 1px solid var(--selm-borde);
    border-radius: 10px;
    background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16' fill='none' stroke='%2394a3b8' stroke-width='1.8' stroke-linecap='round'%3E%3Ccircle cx='7' cy='7' r='4.6'/%3E%3Cpath d='M10.6 10.6 14.4 14.4'/%3E%3C/svg%3E") no-repeat left 12px center;
    background-size: 16px 16px;
    -webkit-appearance: none;
    appearance: none;
}
.app-selm__buscar input:focus {
    outline: none;
    border-color: var(--selm-accent);
    box-shadow: 0 0 0 3px rgba(var(--sgi-color-rgb, 10, 110, 209), .14);
}

/* ── Lista ────────────────────────────────────────────────────────────────── */
.app-selm__lista {
    flex: 1 1 auto;
    min-height: 80px;
    margin: 0;
    padding: 0 8px 8px;
    list-style: none;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}

.app-selm__op {
    display: flex;
    align-items: center;
    min-height: 52px;
    padding: 10px 12px;
    border-radius: 10px;
    font-size: 15px;
    line-height: 1.35;
    color: var(--selm-texto);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
.app-selm__op + .app-selm__op { box-shadow: inset 0 1px 0 var(--selm-borde); }
.app-selm__op:active { background: #f5f8fc; }

.app-selm__texto {
    flex: 1 1 auto;
    min-width: 0;
    /* Los nombres largos (socios, comprobantes) se leen enteros en dos líneas
       antes que cortados con puntos suspensivos. */
    word-break: break-word;
}

/* Segundo renglón de la opción, para las listas que arma una vista a mano con
   appSelectMovil.abrirLista (número de cuenta, moneda, saldo…). */
.app-selm__sub {
    display: block;
    margin-top: 2px;
    font-size: 12.5px;
    font-weight: 400;
    color: var(--selm-tenue);
}

.app-selm__op--elegida {
    background: var(--selm-soft);
    font-weight: 600;
    box-shadow: none;
}

/* Palomita del select simple. */
.app-selm__marca {
    flex: none;
    width: 20px;
    height: 20px;
    margin-left: 10px;
    opacity: 0;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16' fill='none' stroke='%230a6ed1' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2.8 8.4 6.2 11.8 13.2 4.8'/%3E%3C/svg%3E") center center no-repeat;
    background-size: 16px 16px;
}
.app-selm__op--elegida .app-selm__marca { opacity: 1; }

/* Casilla del select múltiple: va a la izquierda, como cualquier lista de
   selección múltiple del teléfono. */
.app-selm__casilla {
    flex: none;
    order: -1;
    width: 22px;
    height: 22px;
    margin-right: 12px;
    border: 1.5px solid #cbd5e1;
    border-radius: 6px;
    background: #fff;
}
.app-selm__op--elegida .app-selm__casilla {
    border-color: var(--selm-accent);
    background: var(--selm-accent) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 16 16' fill='none' stroke='%23ffffff' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2.8 8.4 6.2 11.8 13.2 4.8'/%3E%3C/svg%3E") center center no-repeat;
    background-size: 14px 14px;
}

.app-selm__op--bloqueada { opacity: .45; cursor: default; }
.app-selm__op--bloqueada:active { background: transparent; }

/* Cabecera de grupo (<optgroup>). */
.app-selm__grupo {
    padding: 14px 12px 6px;
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--selm-tenue);
}

/* Avisos: sin resultados, escriba más, cargando. */
.app-selm__aviso {
    padding: 22px 12px;
    text-align: center;
    font-size: 14px;
    color: var(--selm-tenue);
}

/* ── Pie (sólo múltiple) ──────────────────────────────────────────────────── */
.app-selm__pie {
    display: flex;
    align-items: center;
    padding: 10px 14px;
    border-top: 1px solid var(--selm-borde);
    background: #fff;
    flex: none;
}

.app-selm__cuenta {
    flex: 1 1 auto;
    font-size: 13px;
    color: var(--selm-tenue);
}

.app-selm__btn {
    flex: none;
    height: 42px;
    margin-left: 10px;
    padding: 0 20px;
    border: 0;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}
.app-selm__btn--claro { background: #f1f5f9; color: var(--selm-texto); }
.app-selm__btn--marca { background: var(--selm-accent); color: #fff; }
.app-selm__btn:active { filter: brightness(.94); }

/* Con la hoja abierta el fondo no se desplaza: si no, al arrastrar sobre la
   lista se termina moviendo la página de atrás. */
html.app-selm-abierto, body.app-selm-abierto {
    overflow: hidden !important;
}
