/**
 * Estilos para el Header del Sitio (site-header).
 * ACTUALIZADO: Aumentado tamaño inicial del logo/título y suavizada la transición.
 *
 * @version 1.0.3
 * @date 2025-07-12
 * @author Baxahaun
 * // PEV_REF: TAREA_LAYOUT_VibrationFix_v1
 */

.site-header {
    background-color: #fff;
    box-shadow: 0 0.5rem 1.5rem rgba(0, 0, 0, 0.1) !important;
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
    transition: padding-top var(--header-transition-duration, 0.3s) ease-in-out,
                padding-bottom var(--header-transition-duration, 0.3s) ease-in-out,
                box-shadow var(--header-transition-duration, 0.3s) ease-in-out,
                top var(--header-transition-duration, 0.3s) ease-in-out;
    position: sticky;
    left: 0;
    right: 0;
    z-index: 1020;
}

.site-header.header-scrolled {
    padding-top: 0.1rem !important;
    padding-bottom: 0.1rem !important;
    box-shadow: var(--bs-box-shadow) !important;
}

.site-header .navbar-brand {
    margin-right: 0;
    flex-shrink: 1;
    min-width: 0;
}

.site-header .navbar-brand img {
    /* Aumentado el tamaño inicial del logo */
    height: var(--header-base-height, 70px); 
    max-height: 55px;
    width: auto;
    margin-right: 0.75rem;
    transition: height var(--header-transition-duration, 0.4s) ease-in-out; /* Transición más suave */
}

.site-header.header-scrolled .navbar-brand img {
    height: var(--header-scrolled-height, 40px);
    max-height: 40px;
}

/* Contenedor del título del sitio */
.site-header .navbar-brand .site-title-container {
    display: flex;
    flex-direction: column;
    justify-content: center;
    flex-shrink: 1;
    max-width: 220px;
    overflow: hidden;
}

.site-header .navbar-brand .site-title-container .navbar-text {
    line-height: 1.2;
    font-weight: bold;
    white-space: normal;
    word-wrap: break-word;
    overflow-wrap: break-word;
    display: block;
    color: var(--bs-body-color) !important;
    /* Aumentado el tamaño de fuente inicial */
    font-size: 1.1rem; 
    transition: font-size var(--header-transition-duration, 0.4s) ease-in-out;
}
.site-header.header-scrolled .navbar-brand .site-title-container .navbar-text {
    font-size: 1rem; /* Tamaño al hacer scroll */
}

.site-header .navbar-brand .site-title-container .navbar-text.visually-hidden {
    display: none !important;
}

.site-header .navbar-brand .site-title-container small {
    font-size: 0.75rem;
    line-height: 1;
    color: var(--bs-secondary-color) !important;
}

.site-header .navbar-collapse {
    align-items: center;
}

/* Contenedor de acciones en escritorio */
.site-header .header-actions-desktop {
    align-items: center;
    gap: 0.75rem;
}

.site-header .header-actions-desktop .search-form-container-desktop {
    flex-shrink: 1;
    min-width: 150px;
    max-width: 250px;
}

.site-header .search-form-container-desktop .search-field {
    border-right: 0;
    height: var(--search-input-height, calc(1.5em + .5rem + 2px));
    padding-top: 0.25rem;
    padding-bottom: 0.25rem;
    font-size: 0.875rem;
}
.site-header .search-form-container-desktop .search-field:focus {
    border-color: var(--bs-primary);
    box-shadow: 0 0 0 0.25rem rgba(var(--bs-primary-rgb), 0.25);
    z-index: 3;
}
.site-header .search-form-container-desktop .input-group-text.search-icon-display {
    background-color: transparent;
    border-left: 0;
    padding-right: 0.75rem;
    height: var(--search-input-height, calc(1.5em + .5rem + 2px));
}
.site-header .search-form-container-desktop .input-group-text.search-icon-display .material-symbols-filled {
    font-size: 1rem;
    line-height: 1;
    color: var(--bs-secondary);
}

.site-header.header-scrolled .search-form-container-desktop .search-field,
.site-header.header-scrolled .search-form-container-desktop .input-group-text.search-icon-display {
    height: var(--search-input-height-scrolled, calc(1.5em + .3rem + 2px));
    font-size: 0.8rem;
}

/* Estilos para el botón de descarga en el header */
header.site-header .header-actions-desktop #download-pdf.btn.btn-sm {
    background-color: var(--bs-secondary) !important;
    border-color: var(--bs-secondary) !important;
    color: #fff !important;
    border-radius: var(--bs-border-radius-sm) !important;
    height: var(--search-input-height, calc(1.5em + .5rem + 2px));
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center;
    padding: 0 1rem !important;
    line-height: normal;
    position: relative;
    z-index: 1;
    overflow: hidden;
    white-space: nowrap;
    flex-shrink: 0;
    transition: color var(--btn-download-hover-duration, 0.6s) ease-out,
                border-color var(--btn-download-hover-duration, 0.6s) ease-out,
                transform 0.2s ease-in-out,
                box-shadow 0.2s ease-in-out,
                height var(--header-transition-duration, 0.3s) ease-in-out;
}
header.site-header .header-actions-desktop #download-pdf.btn.btn-sm::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 0;
    height: 100%;
    background-color: var(--pc-barn-red);
    transition: width var(--btn-download-hover-duration, 0.6s) ease-out;
    z-index: -1;
}
header.site-header .header-actions-desktop #download-pdf.btn.btn-sm .material-symbols-filled {
    font-size: 1em;
    margin-right: 0.5rem !important;
    position: relative;
    z-index: 2;
    line-height: 1;
    vertical-align: middle;
}
header.site-header .header-actions-desktop #download-pdf.btn.btn-sm span {
    display: inline-block;
    line-height: 1;
    position: relative;
    z-index: 2;
}
header.site-header .header-actions-desktop #download-pdf.btn.btn-sm:hover::before {
    width: 100%;
}
header.site-header .header-actions-desktop #download-pdf.btn.btn-sm:hover {
    border-color: var(--pc-barn-red) !important;
    color: #fff !important;
    transform: scale(1.03);
    box-shadow: var(--bs-box-shadow-sm);
}
header.site-header .header-actions-desktop #download-pdf.btn.btn-sm:focus {
    border-color: var(--pc-barn-red) !important;
    color: #fff !important;
    box-shadow: var(--bs-box-shadow-sm);
}
header.site-header .header-actions-desktop #download-pdf.btn.btn-sm:focus-visible {
    transform: none;
    outline: 2px solid rgba(var(--pc-barn-red-rgb, 193, 18, 31), 0.5);
    outline-offset: 2px;
    box-shadow: none;
    border-color: var(--pc-barn-red) !important;
    color: #fff !important;
}
.site-header.header-scrolled .header-actions-desktop #download-pdf.btn.btn-sm {
    height: var(--search-input-height-scrolled, calc(1.5em + .3rem + 2px));
}


/* Estilos para botones de acción redondos en el header (A11y Escritorio) */
.site-header #toggle-a11y-controls-desktop {
    color: var(--bs-secondary) !important;
    border-color: var(--bs-secondary) !important;
    width: var(--search-input-height, calc(1.5em + .5rem + 2px)) !important;
    height: var(--search-input-height, calc(1.5em + .5rem + 2px)) !important;
    padding: 0 !important;
    border-radius: 50% !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    line-height: 1;
    flex-shrink: 0;
    position: relative; 
    overflow: hidden;
    z-index: 1;
}
.site-header #toggle-a11y-controls-desktop::before {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 0;
    height: 100%;
    background-color: var(--bs-secondary);
    transition: width var(--btn-hover-duration, 0.4s) ease-out;
    z-index: -1;
}
.site-header #toggle-a11y-controls-desktop .material-symbols-filled {
    font-size: 1rem !important;
    position: relative;
    z-index: 2;
    color: inherit; 
    display: inline-flex; 
    align-items: center;
    justify-content: center;
}
.site-header #toggle-a11y-controls-desktop:hover,
.site-header #toggle-a11y-controls-desktop:focus,
.site-header #toggle-a11y-controls-desktop.a11y-active {
    color: var(--bs-white) !important;
    border-color: var(--bs-secondary) !important;
}
.site-header #toggle-a11y-controls-desktop:hover::before,
.site-header #toggle-a11y-controls-desktop:focus::before,
.site-header #toggle-a11y-controls-desktop.a11y-active::before {
    width: 100%;
}
.site-header #toggle-a11y-controls-desktop:focus-visible {
    outline-color: rgba(var(--bs-secondary-rgb), 0.5);
    transform: none;
    box-shadow: none;
}
.site-header.header-scrolled #toggle-a11y-controls-desktop {
    width: var(--search-input-height-scrolled, calc(1.5em + .3rem + 2px)) !important;
    height: var(--search-input-height-scrolled, calc(1.5em + .3rem + 2px)) !important;
}
.site-header.header-scrolled #toggle-a11y-controls-desktop .material-symbols-filled {
    font-size: 0.9rem !important;
}

/* Estilos para el toggler del menú móvil (hamburguesa) */
.navbar-toggler {
    padding: 0.2rem 0.5rem;
    font-size: 1rem;
}
.navbar-toggler:focus {
    box-shadow: 0 0 0 0.25rem rgba(var(--bs-primary-rgb),0.25);
}

/* Contenedor de acciones móviles en el header */
.mobile-actions-container {
    gap: 0.5rem;
}

/* NUEVA CLASE COMÚN para botones de acción en header móvil (Lupa, A11y) */
.site-header .mobile-header-action-btn {
    color: var(--bs-secondary) !important;
    border-color: var(--bs-secondary) !important;
    background-color: transparent !important;
    width: 38px !important;  /* Tamaño unificado */
    height: 38px !important; /* Tamaño unificado */
    padding: 0 !important;
    border-radius: 50% !important;
    border-width: 1px !important;
    display: inline-flex !important; 
    align-items: center !important;
    justify-content: center !important;
    line-height: 1;
    flex-shrink: 0;
    position: relative;
    overflow: hidden;
    z-index: 1;
    transition: background-color 0.2s ease-in-out, color 0.2s ease-in-out;
}
.site-header .mobile-header-action-btn::before {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 0;
    height: 100%;
    background-color: var(--bs-secondary);
    transition: width var(--btn-hover-duration, 0.4s) ease-out;
    z-index: -1;
}
.site-header .mobile-header-action-btn .material-symbols-filled {
    font-size: 1.1rem !important; /* Tamaño de icono unificado */
    position: relative;
    z-index: 2;
    color: inherit;
    display: inline-flex; 
    align-items: center;
    justify-content: center;
}
.site-header .mobile-header-action-btn:hover,
.site-header .mobile-header-action-btn:focus,
.site-header .mobile-header-action-btn.a11y-active {
    color: var(--bs-white) !important;
    border-color: var(--bs-secondary) !important;
}
.site-header .mobile-header-action-btn:hover::before,
.site-header .mobile-header-action-btn:focus::before,
.site-header .mobile-header-action-btn.a11y-active::before {
    width: 100%;
}
.site-header .mobile-header-action-btn:focus-visible {
    outline-color: rgba(var(--bs-secondary-rgb), 0.5);
    transform: none;
    box-shadow: none;
}
/* La regla para #toggle-a11y-controls-mobile ya no es necesaria, se usará .mobile-header-action-btn */

/* Offcanvas (Menú móvil) */
.offcanvas-header {
    border-bottom: 1px solid var(--bs-border-color);
}
.offcanvas .search-form-container-mobile {
    display: block !important; 
    margin-bottom: 1rem !important;
}
.offcanvas .search-form-container-mobile .input-group-text.search-icon-display .material-symbols-filled {
    font-size: 1rem;
    line-height: 1;
    color: var(--bs-secondary); 
}
.offcanvas #search-results-container-mobile {
    position: static !important; 
    width: 100% !important;
    max-height: 250px !important;
    margin-top: 0.25rem !important;
    box-shadow: none !important;
    border-top: 1px solid var(--bs-border-color) !important;
    z-index: 1 !important; 
}


/* Ocultar búsqueda de escritorio en pantallas pequeñas donde se usa offcanvas */
@media (max-width: 991.98px) {
    .site-header .header-actions-desktop .search-form-container-desktop {
        display: none !important;
    }
    #search-results-container {
        display: none !important;
    }
}

/* Ocultar búsqueda de offcanvas en pantallas grandes */
@media (min-width: 992px) {
    .offcanvas .search-form-container-mobile,
    .offcanvas #search-results-container-mobile {
        display: none !important;
    }
    .site-header .header-actions-desktop .search-form-container-desktop {
        display: flex !important; 
    }
    #search-results-container {
        position: absolute !important; 
    }
}

/* Ajuste para el título del sitio en pantallas pequeñas */
@media (max-width: 575.98px) {
    .site-header .navbar-brand .site-title-container {
         max-width: 120px; /* Reducir ancho en pantallas muy pequeñas para dejar espacio a los iconos */
    }
}
