/**
 * Notebook Header Component - Osona 2024 
 * Header amb pestanyes correctes (corbes a dalt) i qualitat de l'aire dinàmica
 */

/* === HEADER BASE === */
.notebook-header {
    position: fixed !important;
    top: 0;
    left: 50%;
    transform: translateX(-50%) translateY(-100%) !important;
    z-index: 1000;
    width: auto;
    background: transparent;
    border: none;
    padding: 0;
    transition: transform 0.3s ease-in-out, opacity 0.3s ease-in-out;
    opacity: 0 !important;
    visibility: hidden !important;
}

/* Header visible quan s'ha fet scroll */
.notebook-header.header--visible {
    transform: translateX(-50%) translateY(0) !important;
    opacity: 1 !important;
    visibility: visible !important;
}

/* === CONTAINER DE LES PESTANYES === */
.notebook-tabs-container {
    display: flex;
    align-items: stretch;
    justify-content: flex-start;
    position: relative;
    height: 35px;
    width: 100vw;
    max-width: 100vw;
    background: #fff;
    transition: background-color 0.5s ease;
    backface-visibility: hidden;
    border-bottom: 1px solid;
}


/* === PESTANYA ESQUERRA (TÍTOL) === */
.notebook-tab--left {
    /*background: #ffffff;*/
    border-top-right-radius: 25px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    /*padding: 17px 50px;*/
    padding: 0px 50px;
    position: relative;
    z-index: 2;
    /*border-bottom: 2px solid white;
    border-top: 1px solid;
    border-right: 1px solid;*/
    top: 2px;
}

/* === BURGER FLOTANT (DRETA) === */
.notebook-tab--right {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    padding: 0;
    z-index: 3;
    /*background: #ffffff;*/
    border-top-left-radius: 25px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 16px 50px;
    z-index: 2;
    right: 0;
    /*order-bottom: 2px solid white;
    border-top: 1px solid;
    border-left: 1px solid;*/
}

/* Efecte de profunditat del container */
.notebook-tabs-container::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 0;
    right: 0;
    height: 8px;
    background: linear-gradient(to bottom,
            rgba(0, 0, 0, 0.08),
            transparent);
    border-radius: 0 0 25px 25px;
    z-index: -1;
}


/* === BRANDING === */
.notebook-header .site-branding {
    width: 100%;
}

.notebook-header .site-title {
    font-size: 1.2rem;
    font-weight: 600;
    margin: 0;
    line-height: 1.2;
    text-align: left;
}

.notebook-header .site-title a {
    color: #333;
    text-decoration: none;
    transition: color 0.2s ease;
}

.notebook-header .site-title a:hover {
    color: #0066cc;
}

/* === MENÚ BURGER === */
.burger-menu {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    border-radius: 4px;
    transition: all 0.2s ease;
    position: relative;
}

.burger-menu:hover {
    background: rgba(0, 0, 0, 0.05);
}

.burger-menu:focus {
    outline: 2px solid #0066cc;
    outline-offset: 2px;
}

.burger-menu span {
    width: 22px;
    height: 2px;
    background: rgba(0, 0, 0, 0.95);
    transition: all 0.3s ease;
    display: block;
    transform-origin: center;
    /*box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);*/
}

/* Animació del burger menu quan s'obre */
.burger-menu.active span:nth-child(1) {
    transform: rotate(45deg) translate(4px, 4px);
}

.burger-menu.active span:nth-child(2) {
    opacity: 0;
}

.burger-menu.active span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
}

/* === MENÚ FULLSCREEN === */
.fullscreen-menu {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.4s ease;
    pointer-events: none;
}

.fullscreen-menu.active {
    opacity: 1;
    visibility: visible;
    pointer-events: all;
}

/* Overlay del menú fullscreen */
.fullscreen-menu__overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

/* Contingut del menú fullscreen */
.fullscreen-menu__content {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 100%;
    padding: 40px;
    text-align: center;
}

/* Botó de tancar */
.close-menu {
    position: absolute;
    top: 0px;
    right: 40px;
    background: none;
    border: none;
    font-size: 2.5rem;
    color: #333;
    cursor: pointer;
    line-height: 1;
    padding: 10px;
    border-radius: 50%;
    transition: all 0.2s ease;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-menu:hover {
    background: rgba(0, 0, 0, 0.1);
    color: #000;
}

.close-menu:focus {
    outline: 2px solid #0066cc;
    outline-offset: 2px;
}

/* Navegació dins del menú fullscreen */
.fullscreen-menu__nav {
    width: 100%;
    max-width: 600px;
}

.fullscreen-menu__nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.fullscreen-menu__nav li {
    margin: 0;
}

.fullscreen-menu__nav a {
    font-size: 2rem;
    font-weight: 500;
    color: #333;
    text-decoration: none;
    transition: all 0.3s ease;
    display: block;
    padding: 5px 30px;
    border-radius: 15px;
}

.fullscreen-menu__nav a:hover {
    color: #fff;
    background: #000;
    transform: translateY(-2px);
}

.fullscreen-menu__nav a:focus {
    outline: 2px solid #000;
    outline-offset: 2px;
}

.fullscreen-menu .site-description {
    margin-top: 40px;
    font-size: 1.1rem;
    color: #666;
    font-style: italic;
}

/* === COLORS ESPECÍFICS PER NIVELLS ICQA === */

/* Variables CSS per colors dinàmics */
.notebook-tabs-container[data-level="good"] {
    background: #007acc !important;
}

.notebook-tabs-container[data-level="reasonably_good"] {
    background: #28a745 !important;
}

.notebook-tabs-container[data-level="regular"] {
    background: #ffc107 !important;
}

.notebook-tabs-container[data-level="unfavorable"] {
    background: #fd7e14 !important;
}

.notebook-tabs-container[data-level="very_unfavorable"] {
    background: #dc3545 !important;
}

.notebook-tabs-container[data-level="extremely_unfavorable"] {
    background: #6f42c1 !important;
}

/* Contrast del text segons el color de fons */
.notebook-tabs-container[data-level="regular"] .burger-menu span {
    background: rgba(0, 0, 0, 0.8) !important;
    box-shadow: 0 1px 2px rgba(255, 255, 255, 0.3) !important;
}

.header_ciutat {
    font-weight: normal;
}

/* === RESPONSIVE === */

/* Tablets */
@media (max-width: 768px) {
    .notebook-tabs-container {
        height: 55px;
    }

    .notebook-tab--left {
        border-top-right-radius: 20px;
        padding: 10px 20px;
    }

    .notebook-tab--right {
        right: 15px;
    }

    .notebook-header .site-title {
        font-size: 1.1rem;
    }

    .burger-menu span {
        width: 20px;
    }


    .fullscreen-menu__nav a {
        font-size: 1.8rem;
        padding: 12px 25px;
    }

    .close-menu {
        top: 5px;
        right: 5px;
        font-size: 2rem;
        width: 50px;
        height: 50px;
    }

    .notebook-tab.notebook-tab--right {
        padding: 0;
    }
}

/* Móvils */
@media (max-width: 480px) {
    .notebook-tabs-container {
        height: 50px;
        max-width: 100vw;
    }

    .notebook-tab--left {
        border-top-right-radius: 18px;
        padding: 8px 15px;
    }

    .notebook-tab--right {
        right: 10px;
    }

    .notebook-header .site-title {
        font-size: 1rem;
    }

    .burger-menu {
        padding: 6px;
    }

    .burger-menu span {
        width: 18px;
        height: 2px;
    }


    .fullscreen-menu__content {
        padding: 30px 20px;
    }

    .fullscreen-menu__nav a {
        font-size: 1.5rem;
        padding: 10px 20px;
    }

    .fullscreen-menu__nav ul {
        gap: 20px;
    }

    .close-menu {
        top: 5px;
        right: 5px;
        font-size: 1.8rem;
        width: 45px;
        height: 45px;
    }
}

/* === ACCESSIBILITAT === */

/* Respectar preferències de moviment reduït */
@media (prefers-reduced-motion: reduce) {

    .notebook-header,
    .notebook-tab,
    .burger-menu,
    .burger-menu span,
    .fullscreen-menu,
    .fullscreen-menu__nav a,
    .close-menu {
        transition: none !important;
        animation: none !important;
    }

    .fullscreen-menu__nav a:hover {
        transform: none;
    }
}

/* Mode fosc / contrasts alts */
@media (prefers-color-scheme: dark) {
    .notebook-tabs-container {
        /* Border en blanc per mode fosc */
        border-color: #fff;
        /* Ombra lleugera per mode fosc, en lloc d'una ombra fosca */
        box-shadow: 0 -2px 10px rgba(255, 255, 255, 0.06);
    }

    .fullscreen-menu__overlay {
        background: rgba(26, 26, 26, 0.95);
    }

    /* Força color de text i fons transparent per enllaços (evita pastilles blanques a iPhone) */
    .fullscreen-menu__nav a,
    .close-menu {
        color: #fff;
        background: transparent;
        -webkit-tap-highlight-color: transparent;
        -webkit-appearance: none;
    }

    /* Forçar border blanc per botons específics dins el menú fullscreen (corregeix .btn-osona negre) */
    .fullscreen-menu .btn-osona,
    .fullscreen-menu .custom-select-display.btn-osona,
    .fullscreen-menu .btn-osona-info,
    .fullscreen-menu .btn-select-toggle {
        color: #fff;
        border-color: #fff !important;
        background: transparent;
        -webkit-tap-highlight-color: transparent;
    }

    .fullscreen-menu .btn-osona:hover,
    .fullscreen-menu .custom-select-display.btn-osona:hover,
    .fullscreen-menu .btn-osona:focus,
    .fullscreen-menu .custom-select-display.btn-osona:focus {
        background: rgba(255, 255, 255, 0.06);
        color: #fff;
        border-color: rgba(255, 255, 255, 0.9) !important;
        outline: none;
    }

    /* Focus / active: pinzell lleuger per a contrast però seguint mode fosc */
    .fullscreen-menu__nav a:hover,
    .fullscreen-menu__nav a:focus,
    .fullscreen-menu__nav a:active {
        color: #66b3ff;
        background: rgba(102, 179, 255, 0.08);
        outline: none;
    }
}

/* === ADMIN BAR COMPATIBILITY === */
body.admin-bar .notebook-header {
    top: 32px;
}

@media screen and (max-width: 782px) {
    body.admin-bar .notebook-header {
        top: 46px;
    }
}

/* === ANIMACIONS D'ENTRADA === */
@keyframes slideDownTab {
    from {
        transform: translateX(-50%) translateY(-100%);
        opacity: 0;
    }

    to {
        transform: translateX(-50%) translateY(0);
        opacity: 1;
    }
}

.notebook-header.header--visible {
    animation: slideDownTabs 0.4s ease-out;
}

/* Animació de càrrega per la zona central */
@keyframes pulseQuality {

    0%,
    100% {
        opacity: 0.8;
    }

    50% {
        opacity: 1;
    }
}

.notebook-tabs-container.loading {
    animation: pulseQuality 1.5s infinite;
    background: #fff !important;
}


/* === FOCUS STYLES MILLORATS === */
*:focus-visible {
    outline: 2px solid #0066cc !important;
    outline-offset: 2px !important;
}