/* =====================================================================
 * BancNet — Fase 1 (especificación 31/10/2026)
 * Componentes nuevos: perfil y país en el registro, paquetes con importe
 * libre, selector EN/PT del admin, aviso de instalación (PWA),
 * Marketplace y BancNet Assist. Usa los tokens --zn-* de app.css.
 * ===================================================================== */

/* ---- País y bandera ------------------------------------------------- */
.country-flag {
    width: 1.33em;
    height: 1em;
    border-radius: 3px;
    margin-right: 6px;
    vertical-align: -2px;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, .12);
}

/* ---- Perfil en el registro ----------------------------------------- */
.profile-choice {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.profile-option {
    position: relative;
    cursor: pointer;
    margin: 0;
}

.profile-option input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.profile-option > span {
    display: grid;
    gap: 4px;
    height: 100%;
    padding: 14px 16px;
    border-radius: 15px;
    border: 1px solid var(--zn-border);
    background: rgba(255, 255, 255, .04);
    transition: border-color .2s ease, background .2s ease;
}

.profile-option i {
    color: var(--zn-blue-2);
    font-size: 1.1rem;
}

.profile-option strong {
    color: var(--zn-text);
}

.profile-option small {
    color: var(--zn-muted);
    line-height: 1.35;
}

.profile-option input:checked + span {
    border-color: var(--zn-border-gold);
    background: rgba(212, 175, 55, .08);
    box-shadow: 0 0 0 1px var(--zn-border-gold) inset;
}

.profile-option input:focus-visible + span {
    outline: 2px solid var(--zn-blue-2);
    outline-offset: 2px;
}

@media (max-width: 575px) {
    .profile-choice { grid-template-columns: 1fr; }
}

/* ---- Selector de idioma del admin ---------------------------------- */
.admin-lang-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.admin-lang-switch {
    display: inline-flex;
    border: 1px solid var(--zn-border);
    border-radius: 999px;
    overflow: hidden;
    letter-spacing: .5px;
}

.admin-lang-switch a {
    padding: 2px 9px;
    color: var(--zn-muted);
    text-decoration: none;
    font-size: .66rem;
}

.admin-lang-switch a.active {
    background: rgba(212, 175, 55, .18);
    color: var(--zn-gold-2);
}

/* ---- Paquetes con importe libre ------------------------------------ */
.package-amount-input {
    position: relative;
}

.package-amount-input span {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--zn-gold-2);
    font-weight: 800;
}

.package-amount-input input {
    padding-left: 34px;
    font-size: 1.25rem;
    font-weight: 800;
}

.package-amount-range {
    display: flex;
    justify-content: space-between;
    margin-top: 6px;
    color: var(--zn-muted);
    font-size: .78rem;
}

.package-amount-card .package-meta {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.package-amount-card .package-meta div {
    padding: 10px;
    border-radius: 13px;
    background: rgba(255, 255, 255, .04);
    border: 1px solid var(--zn-border);
}

.package-amount-card .package-meta span {
    display: block;
    color: var(--zn-muted);
    font-size: .7rem;
    text-transform: uppercase;
    letter-spacing: .4px;
}

.package-amount-error {
    margin-top: 10px;
    color: var(--zn-danger);
    font-size: .85rem;
    font-weight: 600;
}

@media (max-width: 575px) {
    .package-amount-card .package-meta { grid-template-columns: 1fr; }
}

/* ---- Aviso "Añadir a la pantalla de inicio" ------------------------ */
.pwa-install-banner {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    background: linear-gradient(90deg, rgba(31, 124, 255, .22), rgba(0, 194, 255, .14));
    border-bottom: 1px solid rgba(0, 194, 255, .28);
}

.pwa-install-banner[hidden] {
    display: none;
}

.pwa-install-banner img {
    border-radius: 9px;
    flex: 0 0 auto;
}

.pwa-install-banner p {
    margin: 0;
    flex: 1 1 auto;
    min-width: 0;
    line-height: 1.25;
}

.pwa-install-banner strong {
    display: block;
    color: var(--zn-text);
    font-size: .9rem;
}

.pwa-install-banner span {
    color: var(--zn-muted);
    font-size: .8rem;
}

.pwa-install-banner .btn-gold {
    height: 36px;
    padding: 0 14px;
    font-size: .82rem;
    flex: 0 0 auto;
}

.pwa-install-close {
    width: 32px;
    height: 32px;
    flex: 0 0 auto;
    border: 0;
    border-radius: 10px;
    background: rgba(255, 255, 255, .06);
    color: var(--zn-muted);
}

.pwa-install-close:hover {
    color: var(--zn-text);
}

/* ---- Marketplace: próximamente ------------------------------------- */
.marketplace-soon {
    position: relative;
    overflow: hidden;
    min-height: 62vh;
    display: grid;
    place-items: center;
    text-align: center;
    padding: 56px 24px;
}

.marketplace-glow {
    position: absolute;
    inset: -30% -10% auto;
    height: 80%;
    background:
        radial-gradient(closest-side, rgba(0, 194, 255, .22), transparent 70%),
        radial-gradient(closest-side at 70% 60%, rgba(212, 175, 55, .14), transparent 70%);
    pointer-events: none;
}

.marketplace-content {
    position: relative;
    max-width: 620px;
    display: grid;
    justify-items: center;
    gap: 16px;
}

.marketplace-brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--zn-blue-2);
    font-weight: 800;
    letter-spacing: .5px;
}

.marketplace-badge {
    padding: 6px 16px;
    border-radius: 999px;
    border: 1px solid var(--zn-border-gold);
    background: rgba(212, 175, 55, .1);
    color: var(--zn-gold-2);
    font-weight: 800;
    letter-spacing: 3px;
    font-size: .8rem;
}

.marketplace-title {
    margin: 0;
    font-weight: 800;
    font-size: clamp(1.8rem, 4vw, 2.8rem);
    color: var(--zn-text);
}

.marketplace-text {
    margin: 0;
    color: var(--zn-muted);
    font-size: 1.05rem;
}

.marketplace-launch {
    display: grid;
    gap: 2px;
    padding: 16px 28px;
    border-radius: 18px;
    border: 1px solid rgba(0, 194, 255, .3);
    background: rgba(0, 194, 255, .06);
}

.marketplace-launch span {
    color: var(--zn-muted);
    text-transform: uppercase;
    font-size: .72rem;
    letter-spacing: 1.2px;
}

.marketplace-launch strong {
    color: var(--zn-gold-2);
    font-size: 1.5rem;
}

.marketplace-note {
    margin: 0;
    color: var(--zn-muted);
}

/* ---- BancNet Assist ------------------------------------------------- */
.assist-fab {
    position: fixed;
    right: 22px;
    bottom: 22px;
    z-index: 1060;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 6px 16px 6px 6px;
    border: 1px solid rgba(0, 194, 255, .35);
    border-radius: 999px;
    background: rgba(7, 17, 31, .92);
    color: var(--zn-text);
    font-weight: 700;
    box-shadow: 0 14px 40px rgba(0, 0, 0, .45);
    backdrop-filter: blur(12px);
    transition: transform .2s ease, opacity .2s ease;
}

.assist-fab:hover {
    transform: translateY(-2px);
}

.assist-fab-icon,
.assist-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, var(--zn-blue), var(--zn-blue-2));
    color: #fff;
    font-size: 1.1rem;
    flex: 0 0 auto;
}

body.assist-open .assist-fab {
    opacity: 0;
    pointer-events: none;
}

.assist-panel {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 1070;
    width: min(400px, 100vw);
    display: flex;
    flex-direction: column;
    background: var(--zn-bg-2);
    border-left: 1px solid rgba(0, 194, 255, .22);
    box-shadow: -24px 0 60px rgba(0, 0, 0, .5);
    transform: translateX(105%);
    transition: transform .28s ease;
}

.assist-panel.open {
    transform: translateX(0);
}

/* Con el panel abierto el backoffice sigue visible al lado (spec 14.1). */
@media (min-width: 1200px) {
    body.assist-open .app-main {
        margin-right: 400px;
        transition: margin-right .28s ease;
    }
}

.assist-head {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 18px;
    border-bottom: 1px solid var(--zn-border);
}

.assist-head > div {
    flex: 1 1 auto;
    display: grid;
}

.assist-head strong {
    color: var(--zn-text);
}

.assist-head small {
    color: var(--zn-muted);
}

.assist-online {
    display: inline-block;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--zn-success);
    margin-right: 4px;
}

.assist-close {
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 10px;
    background: rgba(255, 255, 255, .06);
    color: var(--zn-muted);
}

.assist-close:hover {
    color: var(--zn-text);
}

.assist-quick {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px 18px;
    border-bottom: 1px solid var(--zn-border);
}

.assist-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 999px;
    border: 1px solid rgba(0, 194, 255, .3);
    background: rgba(0, 194, 255, .07);
    color: var(--zn-blue-2);
    font-size: .78rem;
    font-weight: 700;
    text-decoration: none;
}

.assist-chip:hover {
    background: rgba(0, 194, 255, .16);
    color: #fff;
}

.assist-messages {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.assist-msg {
    max-width: 88%;
    display: grid;
    gap: 4px;
}

.assist-msg.from-user {
    align-self: flex-end;
    justify-items: end;
}

.assist-bubble {
    padding: 10px 14px;
    border-radius: 16px;
    line-height: 1.45;
    font-size: .9rem;
    overflow-wrap: anywhere;
}

.from-ai .assist-bubble {
    background: rgba(255, 255, 255, .06);
    border: 1px solid var(--zn-border);
    border-top-left-radius: 4px;
    color: var(--zn-text);
}

.from-user .assist-bubble {
    background: linear-gradient(135deg, var(--zn-blue), #1565d8);
    border-top-right-radius: 4px;
    color: #fff;
}

.assist-msg.is-error .assist-bubble {
    border-color: rgba(255, 95, 109, .4);
    color: #ffc2c8;
}

.assist-msg time {
    color: var(--zn-muted);
    font-size: .7rem;
}

.assist-shortcuts {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.assist-typing {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 0 18px 10px;
}

.assist-typing[hidden] {
    display: none;
}

.assist-typing span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--zn-blue-2);
    animation: assist-dot 1s infinite ease-in-out;
}

.assist-typing span:nth-child(2) { animation-delay: .15s; }
.assist-typing span:nth-child(3) { animation-delay: .3s; }

.assist-typing small {
    margin-left: 6px;
    color: var(--zn-muted);
}

@keyframes assist-dot {
    0%, 80%, 100% { opacity: .3; transform: translateY(0); }
    40% { opacity: 1; transform: translateY(-3px); }
}

@media (prefers-reduced-motion: reduce) {
    .assist-typing span { animation: none; }
    .assist-panel, .assist-fab { transition: none; }
}

.assist-form {
    display: flex;
    gap: 8px;
    padding: 14px 18px 18px;
    border-top: 1px solid var(--zn-border);
}

.assist-form textarea {
    flex: 1 1 auto;
    resize: none;
    min-height: 44px;
    max-height: 120px;
    padding: 11px 14px;
    border-radius: 14px;
    border: 1px solid var(--zn-border);
    background: rgba(255, 255, 255, .055);
    color: #fff;
    font-size: .9rem;
}

.assist-form textarea:focus {
    outline: none;
    border-color: rgba(0, 194, 255, .5);
}

.assist-form button {
    width: 44px;
    height: 44px;
    border: 0;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--zn-gold), var(--zn-gold-2));
    color: #09111f;
}

.assist-form button:disabled {
    opacity: .5;
}

@media (max-width: 575px) {
    .assist-fab-label { display: none; }
    .assist-fab { padding: 6px; right: 16px; bottom: 16px; }
}

/* Espacio para que el botón flotante no tape el final de cada página. */
.app-content {
    padding-bottom: 96px;
}
