/**
 * Header Styles — extracted from header-nav.php inline <style>
 * Cacheable by the browser as an external file.
 *
 * @package DECQuizTheme
 */

/* =========================================
   BASE STYLES
   ========================================= */

/* Hide WordPress Skip Link which causes layout shift */
.skip-link,
#wp-skip-link {
    display: none !important;
    height: 0 !important;
    width: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
}

/* Force Header to Top */
#decquiz-main-header {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 80px !important;
    background: #ffffff !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05) !important;
    z-index: 9999999 !important;
    visibility: visible !important;
    opacity: 1 !important;
    display: grid !important;
    grid-template-columns: 200px 1fr 200px !important;
    align-items: center !important;
    padding: 0 40px !important;
    box-sizing: border-box !important;
    font-family: -apple-system, sans-serif !important;
    transition: background-color 0.3s ease, padding 0.3s ease !important;
}

/* =========================================
   SCROLLED STATE
   ========================================= */
#decquiz-main-header.scrolled,
body #decquiz-main-header.scrolled {
    background-color: #000000 !important;
    background: #000000 !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2) !important;
    transition: background-color 0.3s ease !important;
}

/* Force White Text on ALL links and logo */
#decquiz-main-header.scrolled a,
#decquiz-main-header.scrolled nav ul li a,
body #decquiz-main-header.scrolled a,
body #decquiz-main-header.scrolled nav ul li a {
    color: #ffffff !important;
    text-shadow: none !important;
    font-weight: 700 !important;
    mix-blend-mode: normal !important;
    filter: none !important;
    opacity: 1 !important;
    -webkit-text-fill-color: #ffffff !important;
}

/* =========================================
   LOGO (LEFT)
   ========================================= */
#decquiz-main-header .logo {
    justify-self: start !important;
}

#decquiz-main-header .logo a {
    font-size: 24px !important;
    font-weight: 800 !important;
    color: #000000 !important;
    text-decoration: none !important;
    transition: color 0.3s ease !important;
}

/* Scrolled LOGO - Force White Text */
#decquiz-main-header.scrolled .logo a,
body #decquiz-main-header.scrolled .logo a {
    color: #ffffff !important;
    -webkit-text-fill-color: #ffffff !important;
}

/* SVG FILL OVERRIDE FOR LOGO */
#decquiz-main-header.scrolled .logo svg text,
#decquiz-main-header.scrolled .logo svg tspan {
    fill: #ffffff !important;
    transition: fill 0.3s ease;
}

/* =========================================
   NAVIGATION (CENTER)
   ========================================= */
#decquiz-main-header nav {
    justify-self: center !important;
}

#decquiz-main-header ul.desktop-nav {
    display: flex !important;
    gap: 30px !important;
    list-style: none !important;
    margin: 0 !important;
    padding: 0 !important;
    align-items: center;
}

/* =========================================
   ACTIONS (RIGHT)
   ========================================= */
.header-actions {
    justify-self: end !important;
    display: flex;
    align-items: center;
}

/* =========================================
   LINKS
   ========================================= */
#decquiz-main-header li a,
#decquiz-main-header .header-actions a {
    color: #000000 !important;
    text-decoration: none !important;
    font-weight: 600 !important;
    font-size: 16px !important;
    transition: color 0.3s ease !important;
}

/* Scrolled LINKS - Force White */
#decquiz-main-header.scrolled li a,
#decquiz-main-header.scrolled .header-actions a,
body #decquiz-main-header.scrolled li a,
body #decquiz-main-header.scrolled .header-actions a {
    color: #ffffff !important;
    -webkit-text-fill-color: #ffffff !important;
}

/* =========================================
   STABILO EFFECT - HAND DRAWN SIMULATION
   ========================================= */
#decquiz-main-header nav>ul>li>a,
#decquiz-main-header .header-actions a {
    position: relative;
    z-index: 10;
    padding: 2px 5px;
    display: inline-block;
}

#decquiz-main-header nav>ul>li>a::before,
#decquiz-main-header .header-actions a::before {
    content: '';
    position: absolute;
    left: -5px;
    bottom: 3px;
    width: calc(100% + 15px);
    height: 16px;
    background: #fde047;
    z-index: -1;
    transform-origin: left center;
    transform: scaleX(0) skewX(-15deg) rotate(-2deg);
    transition: transform 0.8s cubic-bezier(0.25, 1, 0.5, 1);
    opacity: 0.8;
    border-radius: 3px 255px 3px 25px / 255px 5px 225px 5px;
    mix-blend-mode: multiply;
}

#decquiz-main-header nav>ul>li>a:hover::before,
#decquiz-main-header .header-actions a:hover::before {
    transform: scaleX(1) skewX(-15deg) rotate(-1deg);
}

/* Scrolled Stabilo - Slightly brighter to pop on black */
#decquiz-main-header.scrolled nav>ul>li>a::before,
#decquiz-main-header.scrolled .header-actions a::before {
    content: '';
    position: absolute;
    left: -5px;
    bottom: 3px;
    width: calc(100% + 15px);
    height: 16px;
    background: #fde047;
    z-index: -1;
    transform-origin: left center;
    transform: scaleX(0) skewX(-15deg) rotate(-2deg);
    transition: transform 0.8s cubic-bezier(0.25, 1, 0.5, 1);
    opacity: 1; /* Full opacity on black */
    border-radius: 3px 255px 3px 25px / 255px 5px 225px 5px;
    mix-blend-mode: normal; /* No multiply on black */
}

#decquiz-main-header.scrolled nav>ul>li>a:hover::before,
#decquiz-main-header.scrolled .header-actions a:hover::before {
    transform: scaleX(1) skewX(-15deg) rotate(-1deg);
}

#decquiz-main-header.scrolled nav>ul>li>a:hover,
#decquiz-main-header.scrolled .header-actions a:hover {
    color: #000 !important;
    -webkit-text-fill-color: #000 !important;
    text-shadow: none !important;
}

/* =========================================
   STABILO COLORS
   ========================================= */
#decquiz-main-header nav>ul>li>a.highlight-blue::before {
    background: #60a5fa !important;
}

#decquiz-main-header nav>ul>li>a.highlight-orange::before {
    background: #fb923c !important;
}

#decquiz-main-header nav>ul>li>a.highlight-green::before {
    background: #4ade80 !important;
}

#decquiz-main-header nav>ul>li>a.highlight-pink::before {
    background: #fda4af !important;
}

#decquiz-main-header nav>ul>li>a.highlight-purple::before {
    background: #d8b4fe !important;
}

#decquiz-main-header .header-actions a.highlight-yellow::before {
    background: #fde047 !important;
}

/* =========================================
   BUTTON STYLES
   ========================================= */
#decquiz-main-header .header-actions a.btn {
    background: #000 !important;
    color: #fff !important;
    padding: 8px 16px !important;
    border-radius: 6px !important;
    border: 1px solid #000 !important;
}

#decquiz-main-header .header-actions a.btn:hover {
    background: transparent !important;
    color: #000 !important;
    border-color: transparent !important;
}

#decquiz-main-header.scrolled .header-actions a.btn,
#decquiz-main-header.scrolled .header-actions a {
    background: #ffffff !important;
    color: #000000 !important;
    -webkit-text-fill-color: #000000 !important;
    border-color: #ffffff !important;
}

#decquiz-main-header.scrolled .header-actions a.btn:hover,
#decquiz-main-header.scrolled .header-actions a:hover {
    background: transparent !important;
    color: #ffffff !important;
    -webkit-text-fill-color: #ffffff !important;
    border-color: transparent !important;
}

/* =========================================
   USER MENU DROPDOWN
   ========================================= */
.user-menu-wrapper {
    position: relative;
    display: inline-block;
}

.user-menu-toggle {
    display: flex !important;
    align-items: center;
    gap: 6px;
}

.user-menu-arrow {
    font-size: 10px;
    transition: transform 0.3s ease;
}

.user-menu-wrapper:hover .user-menu-arrow {
    transform: rotate(180deg);
}

.user-submenu {
    display: none !important;
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #ffffff;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    padding: 0 !important;
    border-radius: 12px;
    min-width: 180px;
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 0 !important;
    z-index: 99999 !important;
    margin-top: 0 !important;
    padding-top: 10px !important;
    border: 1px solid rgba(0, 0, 0, 0.05);
    overflow: hidden;
}

.user-menu-wrapper:hover .user-submenu {
    display: flex !important;
}

.user-submenu a {
    font-size: 14px !important;
    color: #333 !important;
    padding: 12px 20px !important;
    display: block !important;
    width: 100% !important;
    font-weight: 500 !important;
    text-align: left;
    background: transparent !important;
    border-radius: 0 !important;
    box-sizing: border-box !important;
    transition: none !important;
    white-space: nowrap !important;
    transform: translateZ(0);
    will-change: background-color, color;
    -webkit-font-smoothing: antialiased;
    text-decoration: none !important;
}

/* Disable stabilo effect on submenu links */
.user-submenu a::before {
    display: none !important;
}

.user-submenu a:hover {
    background: #f1f5f9 !important;
    color: #000 !important;
    width: 100% !important;
}

.user-submenu a:first-child {
    border-top-left-radius: 8px !important;
    border-top-right-radius: 8px !important;
}

.user-submenu a:last-child {
    border-bottom-left-radius: 8px !important;
    border-bottom-right-radius: 8px !important;
}

/* Scrolled user submenu */
#decquiz-main-header.scrolled .user-submenu {
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

#decquiz-main-header.scrolled .user-submenu a {
    color: #1e293b !important;
    -webkit-text-fill-color: #1e293b !important;
}

#decquiz-main-header.scrolled .user-submenu a:hover {
    background: #f1f5f9 !important;
    color: #000 !important;
    -webkit-text-fill-color: #000 !important;
}

/* =========================================
   DROPDOWN MENU
   ========================================= */
#decquiz-main-header li {
    position: relative;
}

#decquiz-main-header ul.submenu {
    display: none !important;
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #ffffff;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    padding: 0 !important;
    border-radius: 12px;
    min-width: 220px;
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 0 !important;
    z-index: 99999 !important;
    margin-top: 0 !important;
    padding-top: 10px !important;
    border: 1px solid rgba(0, 0, 0, 0.05);
    overflow: hidden;
}

#decquiz-main-header li:hover>ul.submenu,
#decquiz-main-header ul.submenu:hover {
    display: flex !important;
}

#decquiz-main-header ul.submenu li {
    display: block !important;
    width: 100% !important;
    text-align: left !important;
    padding: 0 !important;
    margin: 0 !important;
    box-sizing: border-box !important;
}

#decquiz-main-header ul.submenu li a {
    font-size: 14px !important;
    color: #333 !important;
    padding: 12px 20px !important;
    display: block !important;
    width: 100% !important;
    font-weight: 500 !important;
    text-align: left;
    background: transparent !important;
    border-radius: 0 !important;
    box-sizing: border-box !important;
    transition: none !important;
    white-space: nowrap !important;
    transform: translateZ(0);
    will-change: background-color, color;
    -webkit-font-smoothing: antialiased;
}

#decquiz-main-header ul.submenu li a:hover {
    background: #f1f5f9 !important;
    color: #000 !important;
    width: 100% !important;
}

/* First and Last item radius for rounded menu */
#decquiz-main-header ul.submenu li:first-child a {
    border-top-left-radius: 8px !important;
    border-top-right-radius: 8px !important;
}

#decquiz-main-header ul.submenu li:last-child a {
    border-bottom-left-radius: 8px !important;
    border-bottom-right-radius: 8px !important;
}

/* Scrolled submenu links */
#decquiz-main-header.scrolled ul.submenu li a,
body #decquiz-main-header.scrolled ul.submenu li a {
    color: #1e293b !important;
    -webkit-text-fill-color: #1e293b !important;
    font-weight: 500 !important;
}

#decquiz-main-header.scrolled ul.submenu li a:hover,
body #decquiz-main-header.scrolled ul.submenu li a:hover {
    color: #000000 !important;
    -webkit-text-fill-color: #000000 !important;
    background: #f1f5f9 !important;
}

/* Scrolled user submenu override */
#decquiz-main-header.scrolled .user-submenu a,
body #decquiz-main-header.scrolled .user-submenu a {
    color: #1e293b !important;
    -webkit-text-fill-color: #1e293b !important;
}

#decquiz-main-header.scrolled .user-submenu a:hover,
body #decquiz-main-header.scrolled .user-submenu a:hover {
    color: #000000 !important;
    -webkit-text-fill-color: #000000 !important;
    background: #f1f5f9 !important;
}

/* =========================================
   SCROLLED BUTTON OVERRIDES
   ========================================= */
#decquiz-main-header.scrolled .header-actions a.btn,
#decquiz-main-header.scrolled a.btn {
    background-color: #ffffff !important;
    color: #000000 !important;
    border: 2px solid #ffffff !important;
    font-weight: 800 !important;
    position: relative !important;
    z-index: 10 !important;
    overflow: visible !important;
}

/* Enable Marker for Scrolled Button */
#decquiz-main-header.scrolled .header-actions a.btn::before,
#decquiz-main-header.scrolled a.btn::before {
    display: block !important;
    content: '' !important;
    position: absolute;
    left: -5px;
    bottom: 5px;
    width: calc(100% + 10px);
    height: 60%;
    background: #fde047 !important;
    z-index: -1;
    transform-origin: left center;
    transform: scaleX(0) skewX(-15deg);
    transition: transform 0.3s cubic-bezier(0.25, 1, 0.5, 1);
    border-radius: 4px;
    opacity: 1;
    mix-blend-mode: normal !important;
}

#decquiz-main-header.scrolled .header-actions a.btn:hover,
#decquiz-main-header.scrolled a.btn:hover {
    background-color: transparent !important;
    color: #000000 !important;
    border-color: transparent !important;
    transform: translateY(-2px);
}

#decquiz-main-header.scrolled .header-actions a.btn:hover::before,
#decquiz-main-header.scrolled a.btn:hover::before {
    transform: scaleX(1) skewX(-15deg);
}

/* =========================================
   BURGER MENU & MOBILE STYLES
   ========================================= */
.mqa-burger-btn {
    display: none !important;
    background: none !important;
    border: none !important;
    cursor: pointer !important;
    padding: 10px !important;
    z-index: 1000 !important;
    justify-self: end;
    pointer-events: auto !important;
}

.mqa-burger-line {
    display: block;
    width: 24px;
    height: 2px;
    background-color: #1e293b;
    margin: 5px 0;
    transition: all 0.3s ease;
    pointer-events: none;
}

#decquiz-main-header.scrolled .mqa-burger-line {
    background-color: #ffffff !important;
}

/* Mobile Menu Container */
#mqa-mobile-menu {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 0;
    background: white;
    z-index: 9999998 !important;
    overflow: hidden;
    transition: height 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
    padding-top: 80px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    align-items: center;
    opacity: 0;
    visibility: hidden;
}

#mqa-mobile-menu.active {
    height: 100vh;
    opacity: 1;
    visibility: visible;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 40px;
}

#mqa-mobile-menu ul {
    list-style: none;
    padding: 0;
    margin: 20px 0;
    width: 100%;
    text-align: center;
}

#mqa-mobile-menu li {
    margin: 15px 0;
}

#mqa-mobile-menu a {
    font-size: 18px;
    font-weight: 600;
    color: #1e293b;
    text-decoration: none;
    display: block;
    padding: 10px;
}

/* =========================================
   RESPONSIVE
   ========================================= */
@media (max-width: 968px) {
    #decquiz-main-header {
        grid-template-columns: 1fr auto !important;
        padding: 0 20px !important;
    }

    #decquiz-main-header nav,
    .header-actions {
        display: none !important;
    }

    .mqa-burger-btn {
        display: block !important;
    }

    .mqa-burger-btn.active .mqa-burger-line:nth-child(1) {
        transform: rotate(45deg) translate(5px, 5px);
    }

    .mqa-burger-btn.active .mqa-burger-line:nth-child(2) {
        opacity: 0;
    }

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

    .mqa-burger-btn.active .mqa-burger-line {
        background-color: #1e293b !important;
    }
}

/* =========================================
   BODY PADDING
   ========================================= */
body {
    padding-top: 80px !important;
}

/* =========================================
   QUIZ PAGES FIX - Header Centering (DESKTOP ONLY)
   ========================================= */
@media (min-width: 969px) {
    body[class*="quiz-gratuit"] #decquiz-main-header {
        padding: 0 !important;
        grid-template-columns: 1fr auto !important;
        justify-content: center !important;
    }

    body[class*="quiz-gratuit"] #decquiz-main-header .logo {
        display: none !important;
    }

    body[class*="quiz-gratuit"] #decquiz-main-header nav {
        justify-self: start !important;
        padding-left: 40px !important;
    }

    body[class*="quiz-gratuit"] #decquiz-main-header .header-actions {
        justify-self: end !important;
        padding-right: 40px !important;
    }
}

/* =========================================
   LOGO STYLES (migrated from logo.php)
   ========================================= */
.mqa-custom-logo {
    display: inline-block;
    text-decoration: none;
    transition: opacity 0.3s ease, transform 0.2s ease;
    line-height: 1;
    z-index: 10;
    position: relative;
    animation: logoFadeIn 0.5s ease-out;
}

.mqa-custom-logo:hover {
    opacity: 0.85;
    transform: scale(1.02);
}

.mqa-custom-logo svg {
    display: block;
    height: auto;
    max-width: 180px;
    width: 100%;
}

/* Positionnement dans le header */
header .wp-block-site-title,
header .wp-site-branding,
.wp-block-template-part[data-area="header"] .wp-block-site-title,
header .wp-block-group:first-child {
    display: flex;
    align-items: center;
    gap: 15px;
}

/* Masquer le titre texte si le logo est present */
header .wp-block-site-title:has(.mqa-custom-logo) p,
header .wp-block-site-title:has(.mqa-custom-logo) h1,
header .wp-block-site-title:has(.mqa-custom-logo) h2,
header .wp-block-site-title:has(.mqa-custom-logo) h3 {
    display: none;
}

header .mqa-custom-logo {
    flex-shrink: 0;
}

@media (max-width: 768px) {
    .mqa-custom-logo svg {
        max-width: 140px;
    }

    .mqa-logo-subtitle {
        display: none;
    }

    .mqa-custom-logo svg text {
        font-size: 16px !important;
    }

    .mqa-custom-logo svg text.mqa-logo-subtitle {
        font-size: 8px !important;
    }
}

@media (min-width: 769px) and (max-width: 1024px) {
    .mqa-custom-logo svg {
        max-width: 160px;
    }
}

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