/* =====================================================
   CB THEME — Header y Footer nativos
   ===================================================== */

/* ── Ocultar header/footer de Elementor si están activos ── */
.elementor-location-header,
.elementor-location-footer {
    display: none !important;
}

/* ── Header base ── */
.cb-site-header {
    font-family: var(--cb-font-family);
}

/* ── Mobile top bar (logo) ── */
.cb-header-mobile-top {
    display: none;
    align-items: center;
    justify-content: center;
    padding: 10px 16px;
    background: var(--cb-color-primario);
    position: sticky;
    top: 0;
    z-index: 9998;
    height: 60px;
}

.cb-header-mobile-top .cb-header-logo img {
    height: 36px;
    width: auto;
    object-fit: contain;
}

/* ── Desktop header base ── */
.cb-header-desktop {
    display: none;
    background: var(--cb-color-primario);
    position: sticky;
    top: 0;
    z-index: 9998;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.cb-header-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    box-sizing: border-box;
}

.cb-header-logo img {
    height: 44px;
    width: auto;
    object-fit: contain;
}

.cb-header-links {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ── Nav items desktop ── */
.cb-header-desktop .cb-nav-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    color: #fff;
    text-decoration: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    transition: background 0.2s;
    white-space: nowrap;
}

.cb-header-desktop .cb-nav-item:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
}

.cb-header-desktop .cb-nav-item svg {
    flex-shrink: 0;
    opacity: 0.9;
}

/* ── Mobile bottom navigation bar ── */
.cb-header-mobile-bottom {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 9999;
    background: var(--cb-color-primario);
    padding: 8px 0;
    padding-bottom: calc(8px + env(safe-area-inset-bottom));
    justify-content: space-around;
    align-items: center;
    box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.2);
}

.cb-header-mobile-bottom .cb-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    color: rgba(255, 255, 255, 0.75);
    text-decoration: none;
    font-size: 11px;
    font-weight: 500;
    padding: 6px 12px;
    border-radius: 8px;
    transition: color 0.2s;
    flex: 1;
    text-align: center;
    max-width: 90px;
}

.cb-header-mobile-bottom .cb-nav-item:hover,
.cb-header-mobile-bottom .cb-nav-item.cb-nav-active {
    color: var(--cb-color-secundario);
}

.cb-header-mobile-bottom .cb-nav-item svg {
    width: 22px;
    height: 22px;
}

/* ── Footer ── */
.cb-site-footer {
    background: var(--cb-color-primario);
    color: rgba(255, 255, 255, 0.8);
    font-family: var(--cb-font-family);
    margin-top: 40px;
}

.cb-footer-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 32px 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    text-align: center;
}

.cb-footer-logo img {
    height: 36px;
    width: auto;
    object-fit: contain;
    opacity: 0.9;
}

/* SVG fallback en footer (fondo oscuro) */
.cb-site-footer .cb-header-logo svg {
    color: rgba(255, 255, 255, 0.8);
}

/* Clase opcional para invertir logos oscuros en el footer */
.cb-footer-logo-invert img {
    filter: brightness(0) invert(1);
    opacity: 0.85;
}

.cb-footer-links {
    display: flex;
    gap: 24px;
    flex-wrap: wrap;
    justify-content: center;
}

.cb-footer-links a {
    display: flex;
    align-items: center;
    gap: 6px;
    color: rgba(255, 255, 255, 0.75);
    text-decoration: none;
    font-size: 13px;
    transition: color 0.2s;
}

.cb-footer-links a:hover {
    color: var(--cb-color-secundario);
}

.cb-footer-copy {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.5);
    margin: 0;
}

.cb-footer-copy a {
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
}

.cb-footer-copy a:hover {
    color: var(--cb-color-secundario);
}

/* ── Nav badge (pendientes) ── */
.cb-nav-item {
    position: relative;
}

.cb-nav-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    background: #ef4444;
    color: #fff;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 700;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    pointer-events: none;
}

/* ── Active nav item (página actual) ── */
.cb-nav-item.cb-nav-active {
    background: rgba(255, 255, 255, 0.15);
    color: var(--cb-color-secundario) !important;
}

/* ── Responsive ── */
@media (max-width: 1024px) {
    /* Ocultar desktop nav */
    .cb-header-desktop {
        display: none !important;
    }

    /* Mostrar mobile top bar */
    .cb-header-mobile-top {
        display: flex;
    }

    /* footer_cb: padding para compensar nav bottom */
    .cb-site-footer,
    .footer_cb {
        padding-bottom: calc(80px + env(safe-area-inset-bottom));
    }

    /* Contenido del body: padding para nav bottom */
    body {
        padding-bottom: calc(70px + env(safe-area-inset-bottom));
    }
}

@media (min-width: 1025px) {
    /* Ocultar mobile bars */
    .cb-header-mobile-top,
    .cb-header-mobile-bottom {
        display: none !important;
    }

    /* Mostrar desktop nav según clase del body */
    body.cb-guest             .cb-nav-desktop-guest,
    body.cb-role-cliente      .cb-nav-desktop-guest,
    body.cb-role-profesional  .cb-nav-desktop-profesional,
    body.cb-role-admin        .cb-nav-desktop-admin,
    body.cb-role-super        .cb-nav-desktop-super {
        display: block;
    }
}

/* Mobile bottom: mostrar según clase del body */
@media (max-width: 1024px) {
    body.cb-guest             .cb-nav-mobile-guest,
    body.cb-role-cliente      .cb-nav-mobile-guest,
    body.cb-role-profesional  .cb-nav-mobile-profesional,
    body.cb-role-admin        .cb-nav-mobile-admin,
    body.cb-role-super        .cb-nav-mobile-super {
        display: flex;
    }
}
