:root {
    --page-bg: #ebedf2;
    --surface: #ffffff;
    --surface-soft: #e9f1ff;
    --text: #152033;
    --muted: #667085;
    --line: #d8deea;
    --brand: #093a8e;
    --brand-dark: #062a67;
    --brand-soft: #dfeaff;
    --danger: #e11d48;
    --success: #0f8f66;
    --warning: #a66512;
    --shadow: 0 10px 28px rgba(21, 32, 51, 0.12);
}

* {
    box-sizing: border-box;
}

.visually-hidden {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

body {
    min-height: 100vh;
    margin: 0;
    background: var(--page-bg);
    color: var(--text);
    font-family: "Nunito", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    overflow-x: hidden;
}

body.auth-open {
    overflow: hidden;
}

a {
    color: inherit;
    text-decoration: none;
}

a:hover {
    color: var(--brand);
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 40;
    display: grid;
    grid-template-columns: 160px minmax(280px, 740px) auto;
    gap: 18px;
    align-items: center;
    min-height: 72px;
    padding: 12px clamp(16px, 4vw, 42px);
    background: var(--brand);
    box-shadow: 0 6px 18px rgba(6, 42, 103, 0.2);
}

.brand-wrap,
.top-actions,
.brand {
    display: flex;
    align-items: center;
}

.brand img {
    width: 92px;
    height: auto;
    display: block;
    filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.18));
}

.search-box {
    display: grid;
    grid-template-columns: 1fr 58px;
    min-height: 46px;
    border: 0;
    border-radius: 6px;
    overflow: hidden;
    background: var(--surface);
    box-shadow: 0 4px 12px rgba(6, 42, 103, 0.22);
}

.search-box:focus-within {
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.28), 0 4px 12px rgba(6, 42, 103, 0.22);
}

.search-box input {
    width: 100%;
    border: 0;
    outline: 0;
    padding: 0 18px;
    background: transparent;
    color: var(--text);
    font-size: 15px;
}

.search-box button {
    border: 0;
    border-left: 1px solid var(--line);
    background: #f7f8fb;
    color: var(--brand);
}

.search-box svg {
    width: 22px;
    height: 22px;
    fill: currentColor;
}

.top-actions {
    position: relative;
    gap: 8px;
    justify-content: flex-end;
}

.master-apps-action {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 38px;
    padding: 0 15px;
    border: 1px solid #f6db82;
    border-radius: 999px;
    background: linear-gradient(135deg, #f7d96d, #c99519);
    color: #513900;
    box-shadow: 0 5px 16px rgba(73, 48, 0, 0.28);
    font-size: 13px;
    font-weight: 900;
    white-space: nowrap;
}

.master-apps-action[hidden] {
    display: none;
}

.master-apps-action:hover,
.master-apps-action[aria-expanded="true"] {
    color: #3f2b00;
    background: linear-gradient(135deg, #ffe997, #d7a52d);
}

.master-apps-action svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
}

.primary-action {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 38px;
    padding: 0 16px;
    border: 1px solid rgba(255, 255, 255, 0.45);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    font-size: 13px;
    font-weight: 900;
    white-space: nowrap;
}

.primary-action.is-authenticated {
    max-width: 220px;
    padding: 0 12px 0 14px;
    background: rgba(255, 255, 255, 0.18);
}

.primary-action:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.22);
}

.account-chevron {
    display: inline-flex;
    color: rgba(255, 255, 255, 0.86);
}

.account-chevron svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
}

.account-name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

.app-menu {
    position: absolute;
    top: calc(100% + 14px);
    right: 0;
    z-index: 70;
    width: min(360px, calc(100vw - 28px));
    border: 1px solid rgba(216, 222, 234, 0.95);
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 22px 55px rgba(15, 23, 42, 0.24);
}

.app-menu[hidden] {
    display: none;
}

.app-menu::before {
    content: "";
    position: absolute;
    top: -9px;
    right: 28px;
    width: 18px;
    height: 18px;
    background: #fff;
    transform: rotate(45deg);
}

.master-apps-menu {
    right: 0;
    max-height: min(620px, calc(100vh - 100px));
    overflow-y: auto;
    border-color: #e2bd55;
}

.master-apps-menu::before {
    right: 170px;
    background: #fff8df;
}

.master-apps-header {
    background: linear-gradient(135deg, #fff8df, #fffdf5);
}

.master-apps-kicker {
    display: block;
    margin-bottom: 5px;
    color: #9a6b00;
    font-size: 11px;
    font-weight: 900;
    letter-spacing: .12em;
    text-transform: uppercase;
}

.master-app-link-icon {
    width: 11px;
    height: 11px;
    flex: 0 0 auto;
    border-radius: 3px;
    background: linear-gradient(135deg, #f3d470, #bc8610);
    box-shadow: 0 0 0 3px #fff5cf;
}

.master-apps-menu .app-menu-list a:hover {
    background: #fff9e8;
    color: #8a6000;
}

.app-menu-header {
    position: relative;
    z-index: 1;
    padding: 22px 24px 18px;
    border-bottom: 1px solid var(--line);
}

.app-menu-header strong,
.app-menu-header span[data-auth-email] {
    display: block;
}

.app-menu-header strong {
    color: var(--text);
    font-size: 20px;
    line-height: 1.1;
    font-weight: 900;
}

.app-menu-header span[data-auth-email] {
    margin-top: 4px;
    color: var(--muted);
    font-size: 14px;
    word-break: break-word;
}

.app-menu-list {
    display: grid;
    padding: 10px 0;
}

.app-menu-list a,
.app-menu-empty,
.app-menu-logout {
    margin: 0;
    padding: 13px 24px;
    font-size: 16px;
}

.app-menu-list a {
    display: flex;
    gap: 12px;
    align-items: center;
    color: #303846;
    font-weight: 800;
}

.app-menu-list a:hover {
    background: #f4f7ff;
    color: var(--brand);
}

.app-icon {
    position: relative;
    display: inline-block;
    flex: 0 0 auto;
    width: 18px;
    height: 18px;
    background: var(--brand);
}

.app-icon-cuadrado {
    border-radius: 4px;
}

.app-icon-semicirculo {
    border-radius: 18px 18px 4px 4px;
}

.app-icon-rectangulo {
    width: 22px;
    height: 14px;
    border-radius: 4px;
}

.app-icon-triangulo {
    width: 0;
    height: 0;
    border-right: 10px solid transparent;
    border-bottom: 18px solid var(--brand);
    border-left: 10px solid transparent;
    background: transparent;
}

.app-menu-empty {
    color: var(--muted);
    line-height: 1.35;
}

.app-menu-logout {
    width: 100%;
    border: 0;
    border-top: 1px solid var(--line);
    background: #fff;
    color: var(--muted);
    text-align: left;
    font-weight: 900;
}

.app-menu-logout:hover {
    background: #fff5f6;
    color: var(--danger);
}

.filter-row {
    position: sticky;
    top: 72px;
    z-index: 35;
    display: flex;
    gap: 10px;
    padding: 10px clamp(16px, 4vw, 42px);
    overflow-x: auto;
    background: var(--brand-dark);
    box-shadow: 0 4px 14px rgba(6, 42, 103, 0.16);
    scrollbar-width: none;
}

.filter-row::-webkit-scrollbar {
    display: none;
}

.filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 999px;
    padding: 8px 15px;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    font-size: 14px;
    font-weight: 900;
    white-space: nowrap;
}

.filter-chip:hover,
.filter-chip.active {
    background: #fff;
    color: var(--brand);
}

.filter-chip-icon {
    width: 20px;
    height: 20px;
    object-fit: contain;
    flex: 0 0 20px;
    background: #fff;
    border-radius: 5px;
    padding: 2px;
}

.subcategory-chip-icon {
    width: 20px;
    height: 20px;
    object-fit: contain;
    flex: 0 0 20px;
}

.app-shell {
    display: block;
}

.content {
    width: min(100%, 1480px);
    min-width: 0;
    margin: 0 auto;
    padding: 0 clamp(14px, 3vw, 28px) 34px;
}

.hero-carousel {
    position: relative;
    min-width: 0;
    aspect-ratio: 5 / 1;
    height: auto;
    margin: 0 calc(clamp(14px, 3vw, 28px) * -1) 18px;
    overflow: hidden;
    background: #cfd7e7;
}

.eyebrow {
    margin: 0 0 8px;
    color: var(--brand);
    font-size: 13px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.12em;
}

.carousel-track,
.carousel-slide {
    position: absolute;
    inset: 0;
}

.carousel-slide {
    margin: 0;
    opacity: 0;
    transition: opacity 300ms ease;
}

.carousel-slide.active {
    opacity: 1;
}

.carousel-slide img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: contain;
}

.carousel-controls {
    position: absolute;
    left: 50%;
    bottom: 18px;
    z-index: 2;
    display: flex;
    gap: 8px;
    transform: translateX(-50%);
}

.carousel-controls button {
    width: 34px;
    height: 5px;
    border: 0;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.52);
}

.carousel-controls button.active {
    background: #fff;
}

.landing-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 18px;
}

.landing-card {
    min-width: 0;
    overflow: hidden;
    border: 1px solid rgba(216, 222, 234, 0.78);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: 0 8px 20px rgba(21, 32, 51, 0.07);
    transition: transform 160ms ease, box-shadow 160ms ease;
}

.landing-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.landing-card-link {
    display: block;
    height: 100%;
    color: inherit;
}

.landing-card-link:hover {
    color: inherit;
}

.thumb-link {
    position: relative;
    display: block;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background: #dfe4f4;
}

.thumb-link img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
    transition: transform 180ms ease, filter 180ms ease;
}

.landing-card:hover .thumb-link img {
    transform: scale(1.025);
    filter: saturate(1.06);
}

.card-copy {
    min-width: 0;
    padding: 14px;
}

.card-copy h2 {
    margin: 0;
    color: var(--text);
    font-size: 16px;
    line-height: 1.25;
    font-weight: 900;
}

.client-line,
.description {
    margin: 4px 0 0;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.35;
}

.description {
    display: -webkit-box;
    min-height: 35px;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.disabled-link {
    cursor: default;
}

.disabled-link:hover {
    color: inherit;
}

.empty-state {
    width: 100%;
    max-width: 520px;
    margin: 70px auto 0;
    padding: 34px;
    border: 1px dashed #c7cfdd;
    border-radius: 8px;
    background: #fff;
    text-align: center;
}

.empty-state h2 {
    margin: 0 0 8px;
    font-size: 22px;
    font-weight: 900;
}

.empty-state p {
    margin: 0;
    color: var(--muted);
}

.auth-modal {
    position: fixed;
    inset: 0;
    z-index: 80;
    display: grid;
    place-items: center;
    padding: 20px;
}

.auth-modal[hidden] {
    display: none;
}

.auth-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.52);
    backdrop-filter: blur(6px);
}

.auth-dialog {
    position: relative;
    z-index: 1;
    width: min(100%, 460px);
    padding: 28px;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 24px 70px rgba(15, 23, 42, 0.25);
}

.auth-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 50%;
    background: #eef1f8;
    color: var(--text);
    font-size: 24px;
    line-height: 1;
}

.auth-copy h2 {
    margin: 0;
    font-size: 26px;
    font-weight: 900;
}

.auth-copy p:not(.eyebrow) {
    margin: 8px 0 0;
    color: var(--muted);
    line-height: 1.45;
}

.auth-switch {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
    margin-top: 20px;
    padding: 4px;
    border-radius: 10px;
    background: #eef3fb;
}

.auth-switch button {
    min-height: 40px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #475467;
    font-weight: 900;
}

.auth-switch button.active {
    background: #fff;
    color: var(--brand);
    box-shadow: 0 4px 12px rgba(21, 32, 51, 0.12);
}

.auth-form {
    display: grid;
    gap: 10px;
    margin-top: 18px;
}

.auth-field {
    display: grid;
    gap: 10px;
}

.auth-field[hidden] {
    display: none;
}

.auth-form label {
    margin-top: 6px;
    font-size: 13px;
    font-weight: 900;
    color: #344054;
}

.auth-form input {
    width: 100%;
    min-height: 44px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 0 12px;
    outline: 0;
}

.auth-form input:focus {
    border-color: rgba(9, 58, 142, 0.5);
    box-shadow: 0 0 0 4px rgba(9, 58, 142, 0.08);
}

.auth-message {
    margin: 8px 0 0;
    padding: 10px 12px;
    border-radius: 8px;
    background: rgba(225, 29, 72, 0.1);
    color: var(--danger);
    font-size: 13px;
    font-weight: 800;
}

.auth-submit {
    min-height: 44px;
    border: 0;
    border-radius: 8px;
    font-weight: 900;
}

.auth-submit {
    margin-top: 8px;
    background: var(--brand);
    color: #fff;
}

.auth-submit:disabled {
    opacity: 0.7;
}

@media (max-width: 860px) {
    .topbar {
        grid-template-columns: 1fr auto;
        gap: 10px 14px;
        padding: 10px 14px 12px;
    }

    .brand img {
        width: 76px;
    }

    .search-box {
        grid-column: 1 / -1;
        grid-row: 2;
        min-height: 44px;
    }

    .filter-row {
        top: 114px;
        padding-inline: 14px;
    }

    .app-menu {
        top: calc(100% + 12px);
        right: 0;
    }

}

@media (max-width: 620px) {
    .content {
        padding-inline: 12px;
    }

    .hero-carousel {
        margin-inline: -12px;
    }

    .landing-grid {
        grid-template-columns: 1fr;
    }

    .auth-dialog {
        padding: 24px;
    }

    .primary-action.is-authenticated {
        max-width: 150px;
        padding-inline: 12px 8px;
    }

    .master-apps-action {
        width: 38px;
        padding: 0;
        justify-content: center;
    }

    .master-apps-action span {
        display: none;
    }

    .app-menu {
        right: -2px;
    }

    .master-apps-menu::before {
        right: 142px;
    }
}

/* --- Páginas de categoría (/c/<slug>) y tarjetas sin miniatura --- */
.category-breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #7c8598;
    font-size: 14px;
    font-weight: 700;
}

.category-breadcrumb-block {
    padding: 22px 0 14px;
}

.category-breadcrumb a {
    color: #093a8e;
    text-decoration: none;
}

.category-breadcrumb a:hover {
    text-decoration: underline;
}

.category-title {
    margin: 26px 0 6px;
    font-size: clamp(28px, 4vw, 40px);
    font-weight: 800;
    color: #152033;
}

.category-intro {
    max-width: 760px;
    margin: 0 0 24px;
    color: #4b5870;
    font-size: 16px;
    line-height: 1.55;
}

a.filter-chip {
    text-decoration: none;
    display: inline-flex;
    align-items: center;
}

.thumb-placeholder {
    display: grid;
    place-items: center;
    width: 100%;
    height: 100%;
    min-height: 150px;
    background: linear-gradient(135deg, #093a8e, #4361ee);
    color: #fff;
    font-size: 44px;
    font-weight: 800;
}

/* ===== Selector de ciudad (categoría + landing envuelta) ===== */
.city-switcher {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin: 4px 0 18px;
}

.city-switcher label {
    color: var(--muted);
    font-size: 13.5px;
    font-weight: 700;
}

.city-switcher select {
    padding: 8px 14px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface);
    color: var(--text);
    font-size: 13.5px;
    font-weight: 700;
    max-width: 280px;
}

.city-suggestion-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 18px;
    padding: 10px 16px;
    border: 1px solid var(--brand-soft);
    border-radius: 12px;
    background: var(--brand-soft);
    color: var(--brand-dark);
    font-size: 14px;
}

.city-suggestion-bar a {
    color: var(--brand);
    font-weight: 800;
    text-decoration: none;
}

.city-suggestion-bar a:hover {
    text-decoration: underline;
}

.city-suggestion-bar button {
    border: 0;
    background: none;
    color: var(--muted);
    font-size: 13px;
    cursor: pointer;
}

/* ===== Landing envuelta (/categoria/ciudad/landing) ===== */
.wrapped-landing-breadcrumb {
    max-width: 1080px;
    margin: 18px auto 0;
    padding: 0 20px;
}

.wrapped-landing-switcher {
    max-width: 1080px;
    margin: 0 auto;
    padding: 0 20px;
}

.wrapped-landing-switcher .city-switcher {
    margin: 4px 0 20px;
}

.wrapped-suggestions {
    max-width: 1080px;
    margin: 0 auto 40px;
    padding: 0 20px;
}

.wrapped-suggestions h2 {
    margin: 0 0 16px;
    font-size: 22px;
    font-weight: 800;
    color: var(--text);
}

/* El footer del portal (categorías + subcategorías) es UNA sola fuente:
   asxRenderPortalFooter() en index.php, con sus estilos .asxw-footer* propios. */

/* --- Reestructura de URLs: facetas de categoria/ciudad, orden y paginacion --- */

.subcategory-menu {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0 0 18px;
}

.subcategory-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface);
    color: var(--text);
    font-size: 13.5px;
    font-weight: 700;
    text-decoration: none;
    transition: border-color .15s ease, color .15s ease;
}

.subcategory-chip:hover {
    border-color: var(--accent, #093a8e);
    color: var(--accent, #093a8e);
}

.facet-count {
    color: var(--muted);
    font-weight: 600;
}

.listing-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin: 0 0 16px;
}

.listing-total {
    color: var(--muted);
    font-size: 13.5px;
    font-weight: 700;
}

.listing-order {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13.5px;
}

.listing-order span {
    color: var(--muted);
    font-weight: 700;
}

.listing-order a {
    color: var(--text);
    text-decoration: none;
    font-weight: 600;
}

.listing-order a.active {
    color: var(--accent, #093a8e);
    font-weight: 800;
}

.listing-pagination {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin: 24px 0 8px;
    font-size: 14px;
}

.listing-pagination a,
.listing-pagination strong {
    padding: 6px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    text-decoration: none;
    color: var(--text);
}

.listing-pagination strong {
    background: var(--accent, #093a8e);
    border-color: var(--accent, #093a8e);
    color: #fff;
}

.city-facets {
    margin: 28px 0 8px;
    padding: 20px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--surface);
}

.city-facets h2 {
    margin: 0 0 12px;
    font-size: 16px;
}

.city-facets-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 6px 16px;
}

.city-facets-list a {
    color: var(--text);
    text-decoration: none;
    font-size: 13.5px;
    font-weight: 600;
}

.city-facets-list a:hover {
    color: var(--accent, #093a8e);
}
