/*
    Estilos de la pagina de Remesas bancarias y de sus vistas de pestana (carpeta Views).
    Se cargan de forma global (no como CSS aislado .razor.css) porque el contenido de cada
    pestana vive en componentes hijos independientes y el CSS aislado no llega a los hijos.
    Las clases estan namespaceadas (remesas-*, rb-*) para evitar colisiones.
*/

.remesas-page,
.remesas-page *,
.remesas-page *::before,
.remesas-page *::after {
    box-sizing: border-box;
}

.remesas-page {
    height: 100%;
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
    overflow: hidden;
    animation: remesasPageIn 0.28s cubic-bezier(0.16, 1, 0.3, 1) both;
}

/* CABECERA */

.remesas-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    min-width: 0;
    flex: 0 0 auto;
}

    /* Bloque de título (fase 1): se mantiene en una línea y NO cede; los botones del CommandBar
       se repliegan primero. Solo cede cuando el CommandBar ya está totalmente replegado (fase 2,
       clase command-bar-host-collapsed que añade el propio CommandBar). */
    .remesas-header > div:first-child {
        flex: 0 0 auto;
        min-width: 0;
    }

    .remesas-header.command-bar-host-collapsed > div:first-child {
        flex: 1 1 auto;
    }

.remesas-title {
    margin: 0;
    font-size: 22px;
    line-height: 1.15;
    font-weight: 850;
    color: #1f2937;
    letter-spacing: -0.02em;
    /* Fase 1: una línea. */
    white-space: nowrap;
}

.remesas-subtitle {
    margin-top: 4px;
    font-size: 13px;
    color: #6b7280;
    line-height: 1.35;
    /* Fase 1: una línea (sin envolver). */
    white-space: nowrap;
}

/* Fase 2: el CommandBar ya está totalmente replegado -> el texto del título cede y envuelve. */
.remesas-header.command-bar-host-collapsed .remesas-title,
.remesas-header.command-bar-host-collapsed .remesas-subtitle {
    white-space: normal;
    overflow-wrap: break-word;
}

/* CommandBar de la cabecera: conserva su ancho natural y se alinea a la derecha, igual que en el
   listado de remesas y en Clientes. Usa las variantes `cmdbar-inline cmdbar-plain` de la ficha de
   cliente (icono al lado del texto, sin caja hasta el hover). Al no colgar de `.cform-page`, los
   tokens --cf-* de esas reglas resuelven por sus fallbacks, que son los mismos valores. */
.remesas-header-actions {
    flex: 0 0 auto;
    min-width: 0;
    justify-content: flex-end;
    align-self: center;
}

.rb-header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 0 0 auto;
    flex-wrap: wrap;
}

/* PANEL GENERAL */

.card-panel {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    padding: 14px;
    box-shadow: 0 8px 22px rgba(15, 23, 42, 0.045);
}

/* TABS
   El rail inferior y las flechas de desbordamiento los dibuja <ScrollableTabs> (su propio CSS);
   aquí solo los botones, con el mismo lenguaje visual que la ficha de cliente (.cform-tab):
   subrayado del activo sobre el rail, sin cajas. */

.remesas-tabs {
    min-width: 0;
    flex: 0 0 auto;
}

.remesas-tab {
    flex: 0 0 auto;
    height: 38px;
    margin-bottom: -1px;    /* el subrayado activo solapa el rail de 1px */
    padding: 0 10px;
    border: 0;
    border-bottom: 2px solid transparent;
    border-radius: 0;
    background: transparent;
    color: #6b7280;
    font-size: 13px;
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
    cursor: pointer;
    transition: color 0.15s ease, border-color 0.15s ease;
}

    .remesas-tab:hover {
        color: #374151;
    }

    .remesas-tab.active {
        color: #1d4ed8;
        border-bottom-color: #2563eb;
    }

    .remesas-tab:focus-visible {
        outline: 2px solid #bfdbfe;
        outline-offset: -2px;
    }

/* CONTENIDO */

.remesas-content-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 0.9fr);
    gap: 12px;
    align-items: start;
}

/* La seccion de contenido de la pestana activa rellena el espacio restante y desplaza en vertical */
.remesas-page > .remesas-content-grid,
.remesas-page > .rb-panel {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 4px;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 transparent;
}

    .remesas-page > .remesas-content-grid::-webkit-scrollbar,
    .remesas-page > .rb-panel::-webkit-scrollbar {
        width: 6px;
    }

    .remesas-page > .remesas-content-grid::-webkit-scrollbar-track,
    .remesas-page > .rb-panel::-webkit-scrollbar-track {
        background: transparent;
    }

    .remesas-page > .remesas-content-grid::-webkit-scrollbar-thumb,
    .remesas-page > .rb-panel::-webkit-scrollbar-thumb {
        background: #cbd5e1;
        border-radius: 999px;
    }

.rb-panel {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.rb-panel-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    min-width: 0;
}

    .rb-panel-header > div:first-child {
        min-width: 0;
    }

.section-title {
    font-size: 16px;
    line-height: 1.2;
    font-weight: 850;
    color: #1f2937;
}

.no-margin {
    margin: 0;
}

.rb-panel-subtitle {
    margin-top: 4px;
    font-size: 12px;
    color: #6b7280;
    line-height: 1.35;
}

/* FORMULARIOS */

.rb-form-grid {
    display: grid;
    gap: 12px;
    width: 100%;
    min-width: 0;
}

.rb-form-grid-4 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.rb-form-grid-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.rb-form-grid-single {
    grid-template-columns: 1fr;
}

.rb-field {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.rb-field-span-2 {
    grid-column: span 2;
}

.rb-field label {
    font-size: 12px;
    font-weight: 750;
    color: #4b5563;
}

.rb-input {
    width: 100%;
    min-width: 0;
    height: 38px;
    border: 1px solid #dbe2ea;
    border-radius: 11px;
    background: #ffffff;
    padding: 0 12px;
    font-size: 13px;
    color: #1f2937;
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

select.rb-input {
    cursor: pointer;
}

.rb-input::placeholder {
    color: #9ca3af;
}

.rb-input:focus {
    border-color: #93c5fd;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
}

/* CHECKS */

.rb-check-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.rb-check-item {
    min-height: 44px;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: 10px;
    padding: 11px 12px;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    background: #f8fafc;
    font-size: 12px;
    font-weight: 800;
    color: #374151;
    cursor: pointer;
}

    .rb-check-item input {
        width: 16px;
        height: 16px;
        accent-color: #2563eb;
    }

/* AVISOS */

.rb-info-box {
    border: 1px solid #bfdbfe;
    background: #eff6ff;
    color: #1d4ed8;
    border-radius: 12px;
    padding: 12px 14px;
    font-size: 12px;
    font-weight: 800;
    line-height: 1.45;
}

.rb-warning-box {
    border: 1px solid #fde68a;
    background: #fffbeb;
    color: #92400e;
    border-radius: 12px;
    padding: 12px 14px;
    font-size: 12px;
    font-weight: 800;
    line-height: 1.45;
}

.rb-error-box {
    border: 1px solid #fecaca;
    background: #fef2f2;
    color: #b91c1c;
    border-radius: 12px;
    padding: 12px 14px;
    font-size: 12px;
    font-weight: 800;
    line-height: 1.45;
    flex: 0 0 auto;
}

.rb-success-box {
    border: 1px solid #bbf7d0;
    background: #f0fdf4;
    color: #166534;
    border-radius: 12px;
    padding: 12px 14px;
    font-size: 12px;
    font-weight: 800;
    line-height: 1.45;
    flex: 0 0 auto;
}

.rb-link {
    color: #1d4ed8;
    font-weight: 850;
    text-decoration: underline;
}

/* PILDORAS DE ESTADO (mandato) */

.rb-pill {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 850;
    line-height: 1.6;
    white-space: nowrap;
}

.rb-pill-ok {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.rb-pill-warn {
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fde68a;
}

/* LINEAS DE RESUMEN (Generacion SEPA) */

.rb-resumen-line {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 12px;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    background: #f8fafc;
    font-size: 13px;
    color: #374151;
}

    .rb-resumen-line strong {
        font-weight: 850;
        color: #1f2937;
    }

.rb-resumen-line-warn {
    background: #fffbeb;
    border-color: #fde68a;
    color: #92400e;
}

    .rb-resumen-line-warn strong {
        color: #92400e;
    }

/* GRID */

.rb-grid.e-grid {
    width: 100%;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    overflow: hidden;
    background: #ffffff;
    box-shadow: none;
}

.rb-grid .e-gridheader {
    border-bottom: 1px solid #eef2f7;
}

.rb-grid .e-headercell {
    background: #f8fafc;
    color: #475569;
    font-size: 12px;
    font-weight: 850;
    border-color: #eef2f7;
}

.rb-grid .e-headertext {
    font-size: 12px;
    font-weight: 850;
}

.rb-grid .e-rowcell {
    color: #1f2937;
    font-size: 12px;
    border-color: #eef2f7;
    padding-top: 8px;
    padding-bottom: 8px;
}

.rb-grid .e-row:hover .e-rowcell {
    background: #f8fbff;
}

.rb-grid .e-altrow .e-rowcell {
    background: #fcfdff;
}

/* BOTONES */

.rb-primary-btn,
.rb-action-btn {
    height: 38px;
    border-radius: 11px;
    padding: 0 14px;
    font-size: 13px;
    font-weight: 850;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.16s ease, border-color 0.16s ease, transform 0.16s ease, box-shadow 0.16s ease;
}

.rb-primary-btn {
    border: none;
    background: #2563eb;
    color: #ffffff;
}

    .rb-primary-btn:hover {
        background: #1d4ed8;
        transform: translateY(-1px);
        box-shadow: 0 10px 18px rgba(37, 99, 235, 0.16);
    }

.rb-action-btn {
    border: 1px solid #dbe2ea;
    background: #ffffff;
    color: #374151;
}

    .rb-action-btn:hover {
        background: #f8fafc;
        border-color: #cbd5e1;
        transform: translateY(-1px);
    }

/* ANIMACIONES */

@keyframes remesasPageIn {
    from {
        opacity: 0;
        transform: translateY(8px);
        filter: blur(2px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
        filter: blur(0);
    }
}

/* RESPONSIVE */

@media (max-width: 1280px) {

    .remesas-content-grid {
        grid-template-columns: 1fr;
    }

    .rb-form-grid-4 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 980px) {
    .remesas-page {
        height: auto;
        min-height: 0;
        overflow: visible;
    }

    .remesas-page > .remesas-content-grid {
        overflow: visible;
        min-height: 0;
        padding-right: 0;
    }

    .remesas-page > .rb-panel {
        overflow-x: auto;
        overflow-y: visible;
        min-height: 0;
        padding-right: 0;
    }

    /* La cabecera NO se apila: el CommandBar ya repliega sus comandos al menú «···» cuando falta
       ancho, así que título y acciones siguen conviviendo en una fila. */
    .rb-panel-header {
        flex-direction: column;
        align-items: stretch;
    }

    .rb-header-actions {
        justify-content: space-between;
    }

    .rb-grid.e-grid {
        min-width: 760px;
    }

    .rb-panel {
        overflow-x: auto;
    }
}

@media (max-width: 768px) {
    .rb-form-grid-4,
    .rb-form-grid-2,
    .rb-check-grid {
        grid-template-columns: 1fr;
    }

    .rb-field-span-2 {
        grid-column: auto;
    }

    /* Los tabs no se apilan: al no caber, <ScrollableTabs> los desplaza en una sola fila. */

    .rb-header-actions {
        width: 100%;
    }

        .rb-header-actions .rb-action-btn,
        .rb-header-actions .rb-primary-btn {
            flex: 1 1 auto;
        }
}

@media (max-width: 640px) {
    .remesas-title {
        font-size: 20px;
    }

    .remesas-subtitle {
        font-size: 12px;
    }

    .card-panel {
        padding: 12px;
    }

    .rb-header-actions {
        flex-direction: column;
        align-items: stretch;
    }

        .rb-header-actions .rb-action-btn,
        .rb-header-actions .rb-primary-btn {
            width: 100%;
        }
}

@media (prefers-reduced-motion: reduce) {
    .remesas-page,
    .remesas-page *,
    .remesas-page *::before,
    .remesas-page *::after {
        animation: none !important;
        transition: none !important;
    }
}
