/* =========================================================
   NOESOR - LAYOUT PRINCIPAL
   Encabezado, navegación, selector de idioma, contenido
   principal y pie de página.
   ========================================================= */

/* =========================================================
   ESTRUCTURA GENERAL
   ========================================================= */

.app-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.page-shell {
    width: 100%;
    flex: 1;
    padding-top: 42px;
    background: transparent;
}

/* =========================================================
   BARRA SUPERIOR
   ========================================================= */

.topbar {
    position: sticky;
    top: 0;
    z-index: 1000;
    width: 100%;
    padding: 14px 24px;
    background: linear-gradient( to bottom, rgba(3, 9, 20, 0.94), rgba(3, 9, 20, 0.78) );
    border-bottom: 1px solid rgba(148, 163, 184, 0.08);
    backdrop-filter: blur(22px);
    -webkit-backdrop-filter: blur(22px);
}

    .topbar::after {
        position: absolute;
        right: 0;
        bottom: -1px;
        left: 0;
        height: 1px;
        content: "";
        pointer-events: none;
        background: linear-gradient( 90deg, transparent, rgba(56, 189, 248, 0.18), rgba(99, 102, 241, 0.22), transparent );
    }

.topbar-inner {
    width: min(100%, var(--container));
    min-height: 58px;
    margin: 0 auto;
    padding: 8px 10px 8px 16px;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 28px;
    border: 1px solid rgba(148, 163, 184, 0.12);
    border-radius: 18px;
    background: linear-gradient( 145deg, rgba(15, 29, 50, 0.8), rgba(7, 17, 31, 0.76) );
    box-shadow: 0 16px 45px rgba(0, 0, 0, 0.26), inset 0 1px 0 rgba(255, 255, 255, 0.025);
    animation: topbar-appear 0.45s ease both;
}

/* =========================================================
   MARCA Y LOGO
   ========================================================= */

.brand {
    min-width: 0;
    display: inline-flex;
    align-items: center;
    transition: opacity var(--transition-fast), transform var(--transition-fast);
}

    .brand:hover {
        opacity: 0.96;
        transform: translateY(-1px);
    }

.brand-logo {
    width: auto;
    height: 38px;
    max-width: 190px;
    object-fit: contain;
    object-position: left center;
}

/* =========================================================
   NAVEGACIÓN
   ========================================================= */

.topbar-nav {
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.nav-item {
    position: relative;
    min-height: 38px;
    padding: 8px 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    color: var(--text-muted);
    font-size: 0.82rem;
    font-weight: 650;
    white-space: nowrap;
    transition: color var(--transition-fast), background-color var(--transition-fast), transform var(--transition-fast);
}

    .nav-item::after {
        position: absolute;
        right: 12px;
        bottom: 4px;
        left: 12px;
        height: 2px;
        border-radius: var(--radius-pill);
        content: "";
        opacity: 0;
        transform: scaleX(0.45);
        background: linear-gradient( 90deg, var(--primary-light), var(--cyan) );
        transition: opacity var(--transition), transform var(--transition);
    }

    .nav-item:hover {
        color: var(--text);
        background: rgba(255, 255, 255, 0.035);
        transform: translateY(-1px);
    }

    .nav-item.active {
        color: white;
        background: linear-gradient( 135deg, rgba(37, 99, 235, 0.12), rgba(34, 211, 238, 0.06) );
    }

        .nav-item.active::after {
            opacity: 1;
            transform: scaleX(1);
        }

/* =========================================================
   ACCIONES DEL ENCABEZADO
   ========================================================= */

.topbar-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
}

.topbar-cta {
    min-height: 42px;
    padding: 10px 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    border: 1px solid rgba(96, 165, 250, 0.26);
    border-radius: 12px;
    color: white;
    background: linear-gradient( 135deg, #2563eb 0%, #4f46e5 52%, #7c3aed 100% );
    box-shadow: 0 12px 30px rgba(37, 99, 235, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.14);
    font-size: 0.82rem;
    font-weight: 750;
    white-space: nowrap;
    transition: transform var(--transition-fast), box-shadow var(--transition), filter var(--transition-fast);
}

    .topbar-cta:hover {
        transform: translateY(-2px);
        filter: brightness(1.07);
        box-shadow: 0 16px 38px rgba(37, 99, 235, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.16);
    }

    .topbar-cta:active {
        transform: translateY(0);
    }

.topbar-cta-arrow {
    display: inline-block;
    font-size: 1rem;
    line-height: 1;
    transition: transform var(--transition-fast);
}

.topbar-cta:hover .topbar-cta-arrow {
    transform: translateX(3px);
}

/* =========================================================
   SELECTOR DE IDIOMA
   ========================================================= */

.language-selector {
    position: relative;
    min-height: 42px;
    display: inline-flex;
    align-items: center;
    border: 1px solid rgba(148, 163, 184, 0.14);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.025);
    transition: border-color var(--transition-fast), background-color var(--transition-fast), box-shadow var(--transition-fast);
}

    .language-selector:hover {
        border-color: rgba(96, 165, 250, 0.24);
        background: rgba(255, 255, 255, 0.04);
    }

    .language-selector:focus-within {
        border-color: rgba(34, 211, 238, 0.38);
        box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.08);
    }

.language-selector-icon {
    position: absolute;
    left: 11px;
    z-index: 1;
    display: inline-flex;
    align-items: center;
    pointer-events: none;
    font-size: 0.85rem;
    filter: saturate(0.75);
}

.language-select {
    min-width: 116px;
    height: 40px;
    padding: 0 30px 0 34px;
    border: 0;
    border-radius: 11px;
    outline: none;
    appearance: none;
    -webkit-appearance: none;
    color: var(--text-soft);
    background: linear-gradient( 45deg, transparent 50%, var(--text-muted) 50% ) calc(100% - 15px) 17px / 5px 5px no-repeat, linear-gradient( 135deg, var(--text-muted) 50%, transparent 50% ) calc(100% - 10px) 17px / 5px 5px no-repeat;
    font-size: 0.78rem;
    font-weight: 650;
    cursor: pointer;
}

    .language-select:hover {
        color: white;
    }

    .language-select option {
        color: var(--text);
        background: var(--background-soft);
    }

/* =========================================================
   PIE DE PÁGINA
   ========================================================= */

.site-footer {
    width: 100%;
    color: var(--text);
    margin-top: auto;
    padding: 32px 24px 26px;
    border-top: 1px solid rgba(148, 163, 184, 0.08);
    background: linear-gradient( to bottom, rgba(3, 9, 20, 0.25), rgba(3, 9, 20, 0.78) );
}

.footer-inner {
    width: min(100%, var(--container));
    margin: 0 auto;
    padding-top: 26px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 28px;
}

.footer-brand {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 13px;
}

.footer-logo {
    width: 42px;
    height: 42px;
    flex: 0 0 auto;
    object-fit: contain;
    filter: drop-shadow( 0 8px 18px rgba(37, 99, 235, 0.2) );
}

.footer-brand-content {
    min-width: 0;
}

    .footer-brand-content strong {
        display: block;
        color: white;
        font-family: "Plus Jakarta Sans", Inter, sans-serif;
        font-size: 0.95rem;
        font-weight: 750;
    }

    .footer-brand-content p {
        max-width: 470px;
        margin: 4px 0 0;
        color: var(--text-muted);
        font-size: 0.76rem;
        line-height: 1.55;
    }

.footer-meta {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
    color: var(--text-muted);
    font-size: 0.72rem;
    line-height: 1.45;
}

.footer-links {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    margin-bottom: 3px;
}

.footer-links a {
    color: #a9c8ff;
    font-weight: 750;
    text-decoration: none;
}

.footer-links a:hover {
    color: white;
}

/* =========================================================
   ANIMACIONES
   ========================================================= */

@keyframes topbar-appear {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.logout-form{margin:0}.account-nav-link{max-width:150px;overflow:hidden;text-overflow:ellipsis}.topbar-actions authorizeview{display:contents}

/* =========================================================
   ENCABEZADO RESPONSIVE
   ========================================================= */

.brand-logo-mobile {
    display: none;
}

.topbar-auth {
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
}

@media (max-width: 900px) {
    .topbar {
        padding: 10px 14px;
    }

    .topbar-inner {
        gap: 12px;
        padding: 8px 10px;
    }

    .brand-logo-desktop {
        max-width: 145px;
        height: 34px;
    }

    .topbar-nav {
        gap: 2px;
    }

    .nav-item {
        padding-inline: 9px;
        font-size: .76rem;
    }

    .language-select {
        min-width: 86px;
        padding-right: 25px;
    }

    .topbar-cta {
        padding-inline: 12px;
    }
}

@media (max-width: 700px) {
    .topbar {
        position: sticky;
        padding: 8px;
    }

    .topbar-inner {
        grid-template-columns: minmax(0, 1fr) auto;
        grid-template-areas:
            "brand actions"
            "nav nav";
        gap: 7px 10px;
        min-height: 0;
        padding: 7px 8px;
        border-radius: 15px;
    }

    .brand {
        grid-area: brand;
        width: fit-content;
    }

    .brand-logo-desktop {
        display: none;
    }

    .brand-logo-mobile {
        display: block;
        width: 36px;
        height: 36px;
    }

    .topbar-nav {
        grid-area: nav;
        width: 100%;
        padding-top: 6px;
        border-top: 1px solid rgba(148, 163, 184, .09);
        justify-content: center;
        flex-wrap: wrap;
    }

    .topbar-actions {
        grid-area: actions;
        min-width: 0;
        gap: 7px;
    }

    .topbar-auth {
        gap: 7px;
    }

    .language-selector,
    .topbar-cta,
    .topbar-auth > .nav-item,
    .account-menu-trigger {
        min-height: 38px;
    }

    .language-selector-icon {
        display: none;
    }

    .language-select {
        min-width: 58px;
        height: 36px;
        padding: 0 23px 0 10px;
        background-position: calc(100% - 12px) 15px, calc(100% - 7px) 15px;
        font-size: .72rem;
    }

    .topbar-auth > .nav-item {
        padding: 7px 8px;
        font-size: .72rem;
    }

    .topbar-cta {
        padding: 8px 11px;
        gap: 6px;
        font-size: .72rem;
    }

    .topbar-cta-arrow {
        font-size: .84rem;
    }

    .page-shell {
        padding-top: 22px;
    }
}

@media (max-width: 430px) {
    .topbar-inner {
        grid-template-columns: auto minmax(0, 1fr);
        grid-template-areas:
            "brand actions"
            "nav nav";
    }

    .topbar-actions {
        justify-content: flex-end;
    }

    .topbar-auth > .nav-item {
        max-width: 82px;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .topbar-cta {
        max-width: 128px;
    }

    .topbar-cta > span:first-child {
        overflow: hidden;
        text-overflow: ellipsis;
    }
}

@media (max-width: 360px) {
    .topbar {
        padding-inline: 5px;
    }

    .topbar-inner {
        gap: 6px;
        padding-inline: 6px;
    }

    .brand-logo-mobile {
        width: 32px;
        height: 32px;
    }

    .language-select {
        min-width: 52px;
        padding-left: 8px;
    }

    .topbar-auth > .nav-item {
        max-width: 68px;
        padding-inline: 5px;
    }

    .topbar-cta {
        max-width: 112px;
        padding-inline: 8px;
    }

    .nav-item {
        padding-inline: 8px;
        font-size: .72rem;
    }
}

/* Ajuste final de proximidad entre las acciones de acceso. */
@media (min-width: 993px) {
    .topbar-auth {
        gap: 2px;
    }
}

/* =========================================================
   FLUJO VERTICAL Y NAVEGACIÓN ENTRE SECCIONES
   ========================================================= */

/* Compensa la barra superior sticky al navegar a anclas o hacer scroll programático. */
html {
    scroll-padding-top: 108px;
}

.page-shell section[id],
.page-shell [tabindex="-1"] {
    scroll-margin-top: 108px;
}

/* En el Home el pie se conecta visualmente con la sección de capacidades. */
.page-shell:has(> .noesor-home) + .site-footer {
    margin-top: 0;
    padding-top: 18px;
}

.page-shell:has(> .noesor-home) + .site-footer .footer-inner {
    padding-top: 18px;
}

@media (max-width: 992px) {
    html {
        scroll-padding-top: 96px;
    }

    .page-shell section[id],
    .page-shell [tabindex="-1"] {
        scroll-margin-top: 96px;
    }
}

@media (max-width: 640px) {
    .page-shell:has(> .noesor-home) + .site-footer {
        padding-top: 16px;
        padding-bottom: 20px;
    }
}

/* =========================================================
   AJUSTE DE ESTRUCTURA · PÁGINA ANALIZAR
   La propia página ya controla su separación superior e inferior.
   ========================================================= */

.page-shell:has(> .analyze-page) {
    flex: 0 0 auto;
    padding-top: 0;
}

.page-shell:has(> .analyze-page) + .site-footer {
    margin-top: 0;
    padding-top: 18px;
    padding-bottom: 20px;
}

.page-shell:has(> .analyze-page) + .site-footer .footer-inner {
    padding-top: 16px;
}

/* =========================================================
   IDENTIDAD VISUAL DEL PLAN EN EL ENCABEZADO
   ========================================================= */
.account-menu-identity {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.account-menu-name {
    max-width: 235px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.account-plan-badge {
    flex: 0 0 auto;
    padding: 4px 8px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    border: 1px solid rgba(167, 139, 250, .34);
    border-radius: 999px;
    color: #ddd6fe;
    background: linear-gradient(135deg, rgba(124, 58, 237, .2), rgba(37, 99, 235, .16));
    box-shadow: inset 0 1px 0 rgba(255,255,255,.06);
    font-size: .66rem;
    font-weight: 850;
    letter-spacing: .06em;
    text-transform: uppercase;
}

.account-plan-badge.plan-enterprise {
    border-color: rgba(250, 204, 21, .34);
    color: #fef3c7;
    background: linear-gradient(135deg, rgba(161, 98, 7, .24), rgba(124, 58, 237, .16));
}

.account-menu-plan-summary {
    margin: 4px 6px 8px;
    padding: 11px 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    border: 1px solid rgba(148,163,184,.12);
    border-radius: 11px;
    background: rgba(255,255,255,.025);
}

.account-menu-plan-summary span { color: var(--text-muted); font-size: .72rem; }
.account-menu-plan-summary strong { color: var(--text); font-size: .78rem; }
.account-menu-plan-summary.plan-pro strong { color: #c4b5fd; }
.account-menu-plan-summary.plan-enterprise strong { color: #fde68a; }

@media (max-width: 1450px) {
    /* Evita que el nombre largo del usuario empuje o cubra el selector de idioma.
       El avatar y la insignia del plan permanecen visibles. */
    .account-menu-name { display: none; }
    .account-menu-identity { gap: 4px; }
}

@media (max-width: 1180px) {
    .topbar-inner { gap: 18px; }
    .nav-item { padding-inline: 10px; }
}

@media (max-width: 760px) {
    .account-menu-name { display: none; }
    .account-menu-identity { gap: 4px; }
    .account-plan-badge { padding: 3px 6px; font-size: .6rem; }
}
