/* ============================================================
   HUF — Componente: PaymentTiles (.hd-pay-tile) — Caja (Discoteca)
   ------------------------------------------------------------
   Reemplaza el <hd-select> de "Método de pago" en los modales de cobro
   (Cobrar Mesa / Cobrar Pedido): el personal de caja no está educado en
   selects, así que cada método de pago es una tarjeta que se activa con
   un clic. Puede haber más de una activa a la vez (pago dividido entre
   varios métodos) — por eso el toggle usa aria-pressed, no un radio.

   Sí lleva acento de línea de energía (borde + tinte de fondo), el
   mismo criterio que .hd-order-card (panel-card.css): una casilla
   activa es exactamente "esto está pasando ahora mismo" (HVL §4.2).
   El tinte usa --hd-theme-accent-rgb, mismo token que el link activo
   del sidebar (nav-sidebar.css).
   ============================================================ */

.hd-pay-tiles {
    display: grid;
    /* auto-fit (no auto-fill): con menos casillas que columnas posibles, las
       existentes se reparten el ancho sobrante en vez de dejar carriles
       vacíos — evita el hueco desparejo cuando Rappi queda solo en la fila. */
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: var(--hd-space-3);
    align-items: stretch;
}

.hd-pay-tile {
    display: flex;
    flex-direction: column;
    justify-content: center;
    border-radius: var(--hd-radius-md);
    background: var(--hd-theme-surface);
    border: 1px solid var(--hd-color-border);
    overflow: hidden;
    transition: border-color var(--hd-motion-standard) var(--hd-ease),
        background var(--hd-motion-standard) var(--hd-ease),
        box-shadow var(--hd-motion-standard) var(--hd-ease);
}

.hd-pay-tile__toggle {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--hd-space-1);
    width: 100%;
    padding: var(--hd-space-3) var(--hd-space-2);
    border: none;
    background: transparent;
    color: var(--hd-theme-text-muted);
    font-family: var(--hd-theme-font, var(--hd-font-sans));
    cursor: pointer;
    transition: color var(--hd-motion-standard) var(--hd-ease);
}

.hd-pay-tile__toggle:hover {
    color: var(--hd-theme-text);
}

.hd-pay-tile__toggle:focus-visible {
    outline: var(--hd-focus-ring);
    outline-offset: -2px;
}

.hd-pay-tile__icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: var(--hd-radius-pill);
    background: rgba(148, 163, 184, 0.12);
    transition: background var(--hd-motion-standard) var(--hd-ease),
        color var(--hd-motion-standard) var(--hd-ease);
}

.hd-pay-tile__label {
    font-size: var(--hd-text-caption);
    font-weight: 600;
    text-align: center;
}

.hd-pay-tile__monto {
    font-size: var(--hd-text-meta);
    font-weight: 700;
    color: var(--hd-theme-accent-text);
    min-height: 1.2em;
}

/* ── Activa: la casilla está incluida en el cobro ─────────────────── */
.hd-pay-tile[data-activa="true"] {
    border-color: var(--hd-theme-accent-text);
    background: rgba(var(--hd-theme-accent-rgb), 0.08);
    box-shadow: var(--hd-glow-accent);
}

.hd-pay-tile[data-activa="true"] .hd-pay-tile__toggle {
    color: var(--hd-theme-text);
}

.hd-pay-tile[data-activa="true"] .hd-pay-tile__icon {
    background: var(--hd-theme-accent);
    color: var(--hd-color-accent-contrast);
}

/* ── Deshabilitada: Crédito/Rappi son exclusivos y viceversa ──────── */
.hd-pay-tile[data-disabled="true"] {
    opacity: 0.4;
}

.hd-pay-tile[data-disabled="true"] .hd-pay-tile__toggle {
    cursor: not-allowed;
    pointer-events: none;
}

/* ── Campos inline de la casilla activa (monto, canal, referencia) ── */
.hd-pay-tile__fields {
    display: flex;
    flex-direction: column;
    gap: var(--hd-space-2);
    padding: 0 var(--hd-space-3) var(--hd-space-3);
}

/* ── Franja de balance bajo la grilla ─────────────────────────────── */
.hd-pay-balance {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--hd-space-3);
    margin-top: var(--hd-space-3);
    padding: var(--hd-space-3) var(--hd-space-4);
    border-radius: var(--hd-radius-md);
    font-weight: 600;
    transition: background var(--hd-motion-standard) var(--hd-ease),
        color var(--hd-motion-standard) var(--hd-ease);
}

.hd-pay-balance[data-cuadra="true"] {
    background: rgba(34, 197, 94, 0.12);
    color: var(--hd-color-success);
}

.hd-pay-balance[data-cuadra="false"] {
    background: rgba(245, 158, 11, 0.12);
    color: var(--hd-color-warning);
}

@media (max-width: 575.98px) {
    .hd-pay-tiles {
        grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
    }
}
