/* =========================================================
   REVOLT Portal: diseño responsivo, panel de inicio,
   filtros, perfil e impresión del estado de cuenta.
   Cargar DESPUÉS de portal.css y portal-modulos.css.

   Celular (por defecto): barra arriba + pestañas abajo.
   Tableta (640px+): contenido más ancho, tarjetas en 2 columnas.
   PC (960px+): menú lateral fijo, sin pestañas.
   ========================================================= */

/* ---------- Estructura base (celular) ---------- */

.rv-content { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.rv-side { display: none; }

.rv-tabs { grid-template-columns: repeat(var(--rv-tabs-n, 4), 1fr); }
.rv-tab span { white-space: nowrap; }

/* Las pestañas viejas con aria-pressed booleano también se marcan. */
.rv-seg button[aria-pressed]:not([aria-pressed="false"]) {
    background: var(--rv-surface); color: var(--rv-ink); font-weight: 700;
}

/* ---------- Utilidades ---------- */

.rv-block { display: block; }
.rv-mt { margin-top: 12px; }
.rv-btn--auto { width: auto; padding-inline: 24px; }
.rv-hint--block { margin: 8px 0 16px; }
.rv-link--btn { background: none; border: 0; padding: 0; font: inherit; cursor: pointer; text-decoration: underline; }
.rv-print-only { display: none; }

button.rv-head__action { border: 0; font: inherit; font-weight: 700; font-size: .95rem; cursor: pointer; }
.rv-head__action--ghost { background: var(--rv-surface); color: var(--rv-nav); }

/* ---------- Avatar ---------- */

.rv-avatar {
    flex: none; display: grid; place-items: center;
    width: 40px; height: 40px; border-radius: 50%;
    background: var(--rv-accent); color: var(--rv-nav);
    font-weight: 700; font-size: .95rem; letter-spacing: .02em;
}
.rv-avatar--lg { width: 72px; height: 72px; font-size: 1.6rem; }

/* ---------- Inicio ---------- */

.rv-dash { display: grid; gap: 16px; }
.rv-dash__col { display: grid; gap: 16px; align-content: start; min-width: 0; }

.rv-balance { margin-bottom: 0; }
.rv-balance--link { display: block; color: #FFFFFF; text-decoration: none; }
.rv-balance--link:active { transform: scale(.99); }
.rv-balance--ok { background: #145A3A; }
.rv-balance--wait { background: var(--rv-surface); color: var(--rv-muted); }
.rv-balance__cta {
    display: inline-flex; align-items: center; gap: 8px; margin-top: 14px;
    padding: 8px 14px; border-radius: 999px;
    background: var(--rv-accent); color: var(--rv-nav); font-weight: 700; font-size: .95rem;
}
.rv-balance--ok .rv-balance__cta { background: #FFFFFF; color: #145A3A; }

.rv-quick { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.rv-quick a {
    display: flex; flex-direction: column; justify-content: space-between; gap: 10px;
    min-height: 92px; padding: 14px;
    background: var(--rv-surface); color: var(--rv-ink);
    border-radius: var(--rv-radius); text-decoration: none; font-weight: 700; line-height: 1.25;
}
.rv-quick a i { font-size: 1.35rem; color: var(--rv-nav); }
.rv-quick a:active { background: #F4F7FB; }

.rv-panel { background: var(--rv-surface); border-radius: var(--rv-radius); padding: 16px; }
.rv-panel__head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 4px; }
.rv-panel__head h2 { font-size: 1.1rem; margin: 0; }
.rv-panel__empty { margin: 8px 0 0; color: var(--rv-muted); }

.rv-mini { list-style: none; margin: 0; padding: 0; }
.rv-mini li + li { border-top: 1px solid var(--rv-line); }
.rv-mini a {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    min-height: 56px; padding: 10px 0; color: var(--rv-ink); text-decoration: none;
}
.rv-mini__main { min-width: 0; }
.rv-mini__main strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rv-mini__main small { display: block; color: var(--rv-muted); font-size: .88rem; }

/* ---------- Listas con filtros ---------- */

.rv-toolbar { display: grid; gap: 0; }

.rv-search { position: relative; display: block; margin-bottom: 12px; }
.rv-search i { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--rv-muted); }
.rv-search input {
    width: 100%; min-height: 48px; padding: 10px 14px 10px 42px;
    background: var(--rv-surface); color: var(--rv-ink);
    border: 2px solid var(--rv-line); border-radius: 999px; font: inherit;
}
.rv-search input:focus { border-color: var(--rv-accent); outline: none; }

.rv-chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 12px; scrollbar-width: none; }
.rv-chips::-webkit-scrollbar { display: none; }
.rv-chips button {
    flex: none; display: inline-flex; align-items: center; gap: 6px;
    min-height: 38px; padding: 6px 14px;
    background: var(--rv-surface); color: var(--rv-ink);
    border: 2px solid var(--rv-line); border-radius: 999px;
    font: inherit; font-size: .92rem; cursor: pointer;
}
.rv-chips button span { color: var(--rv-muted); font-size: .85rem; }
.rv-chips button[aria-pressed="true"] { background: var(--rv-nav); border-color: var(--rv-nav); color: #FFFFFF; font-weight: 700; }
.rv-chips button[aria-pressed="true"] span { color: rgba(255, 255, 255, .8); }

.rv-grid-cards { display: grid; gap: 12px; }
.rv-grid-cards > .rv-card { margin: 0; }
.rv-card__body { min-width: 0; }
.rv-card__meta i { width: 1.1em; text-align: center; margin-right: 4px; color: var(--rv-nav); opacity: .7; }
.rv-card--ok { color: var(--rv-ok); font-weight: 700; }

/* ---------- Estado de cuenta ---------- */

.rv-cuenta { display: grid; gap: 16px; }
.rv-cuenta__aside, .rv-cuenta__main { min-width: 0; }
.rv-cuenta__aside { display: grid; gap: 12px; align-content: start; }
.rv-cuenta__aside .rv-seg { margin-bottom: 0; }
.rv-cuenta__aside .rv-facts { margin-bottom: 0; }

.rv-invoice--late { box-shadow: inset 4px 0 0 var(--rv-danger); }
.rv-invoice .rv-badge { margin-top: 6px; }
.rv-select-all { text-align: right; margin: 4px 0 12px; }
.rv-section-title--top { margin-top: 0; }

.rv-movs__right { text-align: right; flex: none; }
.rv-movs__right small { display: block; color: var(--rv-muted); font-size: .82rem; white-space: nowrap; }

.rv-solo-impresion { display: none; }

/* ---------- Perfil ---------- */

.rv-profile {
    display: flex; align-items: center; gap: 16px;
    background: var(--rv-surface); border-radius: var(--rv-radius-lg); padding: 20px; margin-bottom: 16px;
}
.rv-profile__name { font-size: 1.3rem; font-weight: 700; margin: 0; }
.rv-profile__role { margin: 2px 0 0; color: var(--rv-muted); }
.rv-facts--one { grid-template-columns: 1fr; }

/* =========================================================
   Tableta
   ========================================================= */
@media (min-width: 640px) {
    .rv-main { max-width: 760px; }
    .rv-grid-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .rv-quick { grid-template-columns: repeat(4, 1fr); }
    .rv-toolbar { grid-template-columns: auto minmax(0, 1fr); gap: 12px; align-items: start; }
    .rv-toolbar .rv-seg { min-width: 300px; }
}

/* =========================================================
   PC: menú lateral
   ========================================================= */
@media (min-width: 960px) {
    .rv-shell { flex-direction: row; }
    .rv-top, .rv-tabs { display: none; }

    .rv-side {
        display: flex; flex-direction: column; gap: 8px;
        position: sticky; top: 0; flex: none;
        width: 264px; height: 100dvh; padding: 28px 16px 20px;
        background: var(--rv-nav); color: #FFFFFF;
    }
    .rv-side__brand { padding: 0 12px 20px; border-bottom: 1px solid rgba(255, 255, 255, .15); margin-bottom: 12px; }
    .rv-side__community { display: block; font-size: 1.2rem; font-weight: 700; line-height: 1.25; }
    .rv-side__product { display: block; margin-top: 2px; font-size: .88rem; opacity: .75; }

    .rv-side__nav { display: grid; gap: 4px; flex: 1; align-content: start; }
    .rv-side__link {
        display: flex; align-items: center; gap: 14px;
        min-height: 48px; padding: 10px 14px; border-radius: 10px;
        color: rgba(255, 255, 255, .82); text-decoration: none;
    }
    .rv-side__link i { width: 22px; text-align: center; font-size: 1.1rem; }
    .rv-side__link:hover { background: rgba(255, 255, 255, .08); color: #FFFFFF; }
    .rv-side__link.active {
        background: rgba(255, 255, 255, .14); color: #FFFFFF; font-weight: 700;
        box-shadow: inset 4px 0 0 var(--rv-accent);
    }

    .rv-side__user {
        display: flex; align-items: center; gap: 12px;
        padding: 12px; border-radius: 10px; color: #FFFFFF; text-decoration: none;
        background: rgba(255, 255, 255, .06);
    }
    .rv-side__user:hover { background: rgba(255, 255, 255, .12); }
    .rv-side__who { min-width: 0; }
    .rv-side__who strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .rv-side__who small { display: block; opacity: .75; }

    .rv-side__out {
        display: flex; align-items: center; justify-content: center; gap: 8px;
        min-height: 40px; margin-top: 4px;
        background: transparent; color: rgba(255, 255, 255, .85);
        border: 1px solid rgba(255, 255, 255, .3); border-radius: 10px;
        font: inherit; font-size: .92rem; cursor: pointer;
    }
    .rv-side__out:hover { color: #FFFFFF; border-color: rgba(255, 255, 255, .6); }

    .rv-main { max-width: 1120px; padding: 36px 40px 48px; }

    .rv-greeting h1 { font-size: 2rem; }

    .rv-dash { grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 20px; align-items: start; }
    .rv-quick { grid-template-columns: 1fr 1fr; }

    .rv-grid-cards { grid-template-columns: repeat(3, minmax(0, 1fr)); }

    .rv-cuenta { grid-template-columns: 340px minmax(0, 1fr); gap: 24px; align-items: start; }
    .rv-cuenta__aside { position: sticky; top: 24px; }

    .rv-paybar { bottom: 16px; }

    .rv-profile-layout { display: grid; grid-template-columns: 340px minmax(0, 560px); gap: 24px; align-items: start; }
    .rv-profile { flex-direction: column; text-align: center; margin-bottom: 0; }

    /* Formularios de una columna no deben estirarse a todo el ancho. */
    .rv-main > form, .rv-main > .rv-form { max-width: 640px; }
}

@media (min-width: 1280px) {
    .rv-quick { grid-template-columns: repeat(4, 1fr); }
}

/* =========================================================
   Impresión / Guardar como PDF (estado de cuenta)
   ========================================================= */
@media print {
    @page { margin: 14mm; }

    html, body { background: #FFFFFF; font-size: 11pt; }
    .rv-side, .rv-top, .rv-tabs, .rv-noprint, .rv-paybar, #blazor-error-ui { display: none !important; }
    .rv-main { max-width: none; padding: 0; }

    .rv-print-only { display: block !important; }
    .rv-solo-impresion { display: block !important; }

    .rv-print-head { display: grid !important; gap: 2px; margin-bottom: 12px; padding-bottom: 8px; border-bottom: 2px solid #000; }
    .rv-print-head strong { font-size: 14pt; }

    .rv-cuenta { display: block; }
    .rv-cuenta__aside { position: static; margin-bottom: 12px; }
    .rv-balance { background: #FFFFFF !important; color: #000 !important; border: 1px solid #000; }
    .rv-balance__sub strong { color: #000; }

    .rv-invoice, .rv-movs, .rv-card, .rv-facts > div { border: 1px solid #BBB; box-shadow: none; }
    .rv-invoice, .rv-movs li { break-inside: avoid; }
    .rv-badge { border: 1px solid currentColor; }
    a { color: #000; text-decoration: none; }
}

/* =========================================================
   Logo del residencial, tarjeta del QR y conduces
   ========================================================= */

.rv-top__brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.rv-top__logo {
    flex: none; width: 34px; height: 34px; object-fit: contain;
    background: #FFFFFF; border-radius: 8px; padding: 3px;
}
.rv-side__logo {
    display: block; max-width: 120px; max-height: 80px; object-fit: contain;
    margin-bottom: 14px; background: #FFFFFF; border-radius: 12px; padding: 8px;
}

/* Navegación entre Pases y Conduces (en el celular no hay pestaña de Conduces). */
.rv-seg--nav a {
    flex: 1; display: flex; align-items: center; justify-content: center;
    min-height: 44px; padding: 8px 10px; border-radius: 999px;
    color: var(--rv-muted); text-decoration: none; text-align: center; font-weight: 600;
}
.rv-seg--nav a[aria-current="page"] { background: var(--rv-surface); color: var(--rv-ink); font-weight: 700; }

/* Detalle de pase o conduce: la tarjeta y los datos. */
.rv-detalle { display: grid; gap: 16px; }
.rv-detalle__tarjeta { min-width: 0; }
.rv-tarjeta {
    display: block; width: 100%; max-width: 420px; height: auto; margin: 0 auto;
    border-radius: var(--rv-radius-lg); box-shadow: 0 6px 24px rgba(19, 42, 62, .12);
}
.rv-espera {
    display: grid; place-items: center; gap: 8px; text-align: center;
    min-height: 260px; padding: 24px; border-radius: var(--rv-radius-lg);
    background: var(--rv-surface); color: var(--rv-muted);
}
.rv-espera i { font-size: 2.2rem; color: var(--rv-nav); }

.rv-clamp {
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}

@media (min-width: 960px) {
    .rv-detalle { grid-template-columns: minmax(0, 420px) minmax(0, 1fr); gap: 32px; align-items: start; }
    .rv-detalle__tarjeta { position: sticky; top: 24px; }
    .rv-seg--nav { display: none; }   /* en la PC está en el menú lateral */
}

.rv-form .rv-grid2 { margin-bottom: 16px; }
.rv-form > .rv-seg { margin-bottom: 16px; }
.rv-form textarea { min-height: 110px; resize: vertical; }


/* =========================================================
   Avisos y eventos
   ========================================================= */

.rv-contador {
    display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px;
    margin-left: auto; border-radius: 999px;
    background: #D92D20; color: #FFFFFF; font-size: .75rem; font-weight: 700; line-height: 1;
}
.rv-tab__icono { position: relative; display: inline-block; }
.rv-contador--tab { position: absolute; top: -6px; right: -12px; min-width: 18px; height: 18px; font-size: .7rem; margin: 0; }

.rv-top__perfil { flex: none; text-decoration: none; }
.rv-avatar--sm { width: 34px; height: 34px; font-size: .85rem; }

.rv-avisos { display: grid; gap: 12px; }
.rv-aviso {
    display: flex; flex-direction: column; overflow: hidden;
    background: var(--rv-surface); color: var(--rv-ink); text-decoration: none;
    border-radius: var(--rv-radius); box-shadow: inset 4px 0 0 transparent;
}
.rv-aviso--nuevo { box-shadow: inset 4px 0 0 var(--rv-nav); }
.rv-aviso--urgente { box-shadow: inset 4px 0 0 #D92D20; }
.rv-aviso__img { width: 100%; max-height: 180px; object-fit: cover; }
.rv-aviso__body { padding: 14px 16px; }
.rv-aviso__tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.rv-aviso__nuevo { color: var(--rv-nav); font-weight: 700; font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; align-self: center; }
.rv-aviso__titulo { margin: 0 0 4px; font-size: 1.08rem; font-weight: 700; line-height: 1.3; }
.rv-aviso--nuevo .rv-aviso__titulo { color: var(--rv-nav); }
.rv-aviso__resumen { margin: 4px 0 0; color: var(--rv-ink); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.rv-aviso__fecha { margin: 8px 0 0; color: var(--rv-muted); font-size: .85rem; }

.rv-aviso-detalle { max-width: 760px; }
.rv-aviso-detalle .rv-title { margin-bottom: 4px; }
.rv-aviso-detalle__img { display: block; width: 100%; max-height: 360px; object-fit: cover; border-radius: var(--rv-radius-lg); margin: 16px 0; }
.rv-aviso-detalle__contenido { margin: 16px 0; font-size: 1.05rem; line-height: 1.6; overflow-wrap: anywhere; }
.rv-aviso-detalle__contenido img { max-width: 100%; height: auto; }

@media (min-width: 640px) {
    .rv-avisos { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 960px) {
    .rv-top__perfil { display: none; }
}

/* =========================================================
   Carnet, dependientes, reglas y mi perfil
   ========================================================= */

.rv-reglas { white-space: pre-line; line-height: 1.6; font-size: 1.02rem; overflow-wrap: anywhere; }

.rv-mini__fila { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 56px; padding: 10px 0; }

.rv-opciones { list-style: none; margin: 16px 0; padding: 0; background: var(--rv-surface); border-radius: var(--rv-radius); }
.rv-opciones li + li { border-top: 1px solid var(--rv-line); }
.rv-opciones a {
    display: flex; align-items: center; gap: 14px; min-height: 56px; padding: 10px 16px;
    color: var(--rv-ink); text-decoration: none; font-weight: 600;
}
.rv-opciones a i:first-child { width: 22px; text-align: center; color: var(--rv-nav); }
.rv-opciones a i:last-child { margin-left: auto; color: var(--rv-muted); }

.rv-peligro { margin-top: 32px; padding: 16px; border: 1px solid #F4C7C3; border-radius: var(--rv-radius); background: #FEF3F2; }
.rv-peligro h2 { font-size: 1rem; margin: 0 0 6px; color: #B42318; }

/* Logo de REVOLT en la entrada */
.rv-login__logo { display: block; width: 168px; max-width: 60%; height: auto; margin: 0 0 4px; }


/* =========================================================
   Pantalla de entrada: foto de la garita con el azul de REVOLT encima.
   Computadora: foto horizontal. Teléfono y app: foto vertical.
   El azul es más fuerte arriba (logo y texto) y deja ver la garita abajo.
   ========================================================= */

.rv-login {
    background-color: #0F4C81;
    background-image:
        linear-gradient(180deg, rgba(15, 76, 129, .90) 0%, rgba(15, 76, 129, .86) 38%, rgba(15, 76, 129, .68) 100%),
        url("../img/fondo-entrada-horizontal.webp");
    background-size: cover;
    background-position: center 62%;
    background-repeat: no-repeat;
}

@media (max-width: 767px), (orientation: portrait) {
    .rv-login {
        background-image:
            linear-gradient(180deg, rgba(15, 76, 129, .90) 0%, rgba(15, 76, 129, .86) 38%, rgba(15, 76, 129, .66) 100%),
            url("../img/fondo-entrada-vertical.webp");
        background-position: center 70%;
    }
}

.rv-login__lead { text-shadow: 0 1px 2px rgba(0, 0, 0, .25); }
