/* ── Layout Global (Header & Footer) ── */

:root {
    --header-bg: #e9ecef;
    --footer-bg: #6c7e87;
    --footer-text: #f3f5f5;
    --text-main: #6c7e87;
    --text-muted: #6c7e87;
}

.main-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background-color: var(--header-bg);
    width: 100%;
    padding: 12px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 1000;
    min-height: 58px;
    box-sizing: border-box;
}

body {
    padding-top: 82px !important;
    padding-bottom: 80px !important; /* espacio para el footer fixed en desktop */
}

/* ── Botón "Escuchar instrucciones" — estilo unificado ── */
.btn-audio-instrucciones {
    width: 100%;
    background: transparent;
    border: 1.5px solid #1f785c;
    color: #1f785c;
    border-radius: 12px;
    padding: 11px;
    font-size: 0.85rem;
    font-weight: 600;
    font-family: 'Lexend', sans-serif;
    cursor: pointer;
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-sizing: border-box;
    transition: background 0.15s;
}
.btn-audio-instrucciones:hover,
.btn-audio-instrucciones:active {
    background: rgba(31, 120, 92, 0.07);
}

@media (max-width: 768px) {
    body {
        padding-bottom: 62px !important;
    }
}

.header-logo {
    height: 30px;
    display: block;
}

.header-tool-name {
    font-family: 'Lexend', sans-serif;
    font-weight: 500;
    font-size: 1.1rem;
    color: var(--text-main);
}

.main-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background-color: rgba(108, 126, 135, 0.60);
    color: var(--footer-text);
    padding: 28px 16px 12px;
    z-index: 999;
    box-shadow: 0 -2px 18px rgba(0, 0, 0, 0.12);
    backdrop-filter: blur(22px);
    -webkit-backdrop-filter: blur(22px);
    min-height: 62px;
    transition: transform 0.3s ease;
}

.main-footer.minimized {
    transform: translateY(calc(100% - 24px));
}

.footer-toggle-btn {
    position: absolute;
    top: 5px;
    left: 50%;
    transform: translateX(-50%);
    width: 44px;
    height: 18px;
    border: none;
    background: rgba(255,255,255,0.18);
    border-radius: 6px;
    color: var(--footer-text);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.8;
    transition: opacity 0.2s, background 0.2s;
    padding: 0;
}

.footer-toggle-btn:hover {
    opacity: 1;
    background: rgba(255,255,255,0.25);
}

.footer-toggle-btn svg {
    transition: transform 0.3s ease;
}

.main-footer.minimized .footer-toggle-btn svg {
    transform: rotate(180deg);
}

@media (max-width: 768px) {
    .main-footer {
        padding: 26px 14px 10px;
        min-height: 50px;
    }

    .footer-content {
        gap: 10px;
    }

    .footer-logo {
        height: 18px;
    }

    .kitifica-logo {
        height: 16px;
    }

    .footer-tagline {
        font-size: 0.65rem;
    }

    .footer-backed {
        font-size: 0.65rem;
        gap: 4px;
    }
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.footer-logo {
    height: 20px;
    opacity: 0.9;
}

.footer-tagline {
    font-size: 0.75rem;
    color: var(--footer-text);
    text-align: center;
    flex: 1;
    white-space: nowrap;
}

.footer-left {
    flex: 1;
    display: flex;
    align-items: center;
}

.footer-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.footer-right {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: flex-end;
}

.footer-expiry {
    font-size: 0.65rem;
    color: rgba(243, 245, 245, 0.85);
    opacity: 0.9;
    white-space: nowrap;
}

.footer-backed {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    color: var(--footer-text);
    opacity: 0.9;
}

.kitifica-logo {
    height: 18px;
}

/* ── Header Navigation (Tabs & Hamburger) ── */
.header-nav-wrapper {
    display: flex;
    align-items: center;
    gap: 15px;
    justify-content: center;
    flex: 1;
}

.header-nav-menu {
    display: flex;
    gap: 8px;
    justify-content: center;
}

.header-nav-btn {
    padding: 8px 16px;
    border-radius: 40px;
    border: none;
    background: transparent;
    color: var(--text-main);
    font-size: 0.7rem;
    font-weight: 700;
    cursor: pointer;
    text-transform: uppercase;
    transition: all 0.3s ease;
    white-space: nowrap;
    font-family: 'Lexend', sans-serif;
}

.header-nav-btn.active {
    background: #1f785c;
    color: #ffffff;
}

.header-nav-btn:hover:not(.active) {
    background: rgba(31, 120, 92, 0.1);
}

.header-hamburger {
    display: none;
    flex-direction: column;
    gap: 6px;
    cursor: pointer;
    border: none;
    background: transparent;
    padding: 8px;
}

.header-hamburger span {
    width: 24px;
    height: 2px;
    background-color: var(--text-main);
    transition: 0.3s;
    display: block;
}

.header-hamburger.active span:nth-child(1) {
    transform: translateY(8px) rotate(45deg);
}

.header-hamburger.active span:nth-child(2) {
    opacity: 0;
    transform: scaleX(0);
}

.header-hamburger.active span:nth-child(3) {
    transform: translateY(-8px) rotate(-45deg);
}

.header-logout-btn {
    padding: 8px 16px;
    border-radius: 40px;
    border: 1px solid #fecaca;
    background: #fef2f2;
    color: #b91c1c;
    font-size: 0.65rem;
    font-weight: 700;
    cursor: pointer;
    text-transform: uppercase;
    transition: 0.3s;
    font-family: 'Lexend', sans-serif;
    white-space: nowrap;
}

.header-logout-btn:hover {
    background: #fee2e2;
}

.header-nav-mobile {
    display: none;
    position: fixed;
    top: 58px;
    left: 0;
    right: 0;
    background-color: var(--header-bg);
    flex-direction: column;
    gap: 0;
    padding: 12px;
    z-index: 999;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.header-nav-mobile.active {
    display: flex;
}

.header-nav-mobile .header-nav-btn {
    width: 100%;
    text-align: left;
    border-radius: 10px;
    padding: 12px 16px;
    font-size: 0.75rem;
}

.header-nav-mobile-logout {
    width: 100%;
    text-align: left;
    border-radius: 10px;
    padding: 12px 16px;
    font-size: 0.75rem;
    font-weight: 700;
    font-family: 'Lexend', sans-serif;
    background: #fef2f2;
    color: #b91c1c;
    border: 1px solid #fecaca;
    cursor: pointer;
    margin-top: 6px;
    transition: background 0.2s;
    box-sizing: border-box;
}
.header-nav-mobile-logout:hover {
    background: #fee2e2;
}

/* ── Responsividad ── */
@media (max-width: 768px) {
    .main-header {
        padding: 12px 20px;
    }
    
    .header-logo {
        height: 25px;
    }

    .header-tool-name {
        font-size: 0.95rem;
    }

    .header-nav-wrapper {
        margin: 0;
        gap: 10px;
        justify-content: flex-end;
        flex: unset;
    }

    .header-nav-menu {
        display: none;
    }

    .header-hamburger {
        display: flex;
    }

    .header-logout-btn {
        display: none;
    }

    .footer-content {
        flex-direction: column;
        padding: 20px 0;
        gap: 15px;
    }

    .footer-tagline {
        margin: 5px 0;
    }
}

/* ── B1 — White-label branding ──────────────────────────────────
   Logos con clases brand-logo-* arrancan ocultos (display:none).
   brand.js asigna src correcto (custom o AKCESO default) y agrega
   .brand-ready al <html> → display:block reveals logos.
   Sin flash de AKCESO en primera carga. display:none no ocupa
   layout (evita el bug de layout-shift de visibility:hidden). */
img.brand-logo-principal,
img.brand-logo-compacto,
img.brand-logo-blanco,
img.brand-logo-fav,
img.brand-logo-splash {
    display: none;
}

html.brand-ready img.brand-logo-principal,
html.brand-ready img.brand-logo-compacto,
html.brand-ready img.brand-logo-blanco,
html.brand-ready img.brand-logo-fav,
html.brand-ready img.brand-logo-splash {
    display: revert;
}
