/* ============================================
   Header & Footer — Styles partagés
   Secure Exchanges — Charte v9
   Dépend de design-system.css (tokens)
   ============================================ */

/* ============================================
   Canada Banner
   ============================================ */
.canada-banner {
    background: linear-gradient(135deg, var(--se-navy) 0%, var(--se-navy-light) 100%);
    color: var(--se-white);
    text-align: center;
    padding: 10px 20px;
    font-size: 0.9rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.canada-banner strong {
    color: var(--se-orange);
}

.canada-flag-icon {
    display: inline-block;
    height: 14px;
    width: 28px;
    object-fit: contain;
    vertical-align: middle;
    border-radius: 2px;
    flex-shrink: 0;
}

/* ============================================
   Header — Unified Horizontal Layout
   ============================================ */
#simple-header {
    background: var(--se-white);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 1000;
    border-bottom: 3px solid var(--se-orange);
    transition: box-shadow 0.3s ease;
}

#simple-header.scrolled {
    box-shadow: var(--shadow-md);
}

.header-unified {
    max-width: var(--container-wide);
    margin: 0 auto;
    padding: 12px 40px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 40px;
}

/* Header Logo */
.header-logo {
    flex-shrink: 0;
    transition: transform var(--transition-base);
}

.header-logo:hover {
    transform: scale(1.02);
}

.header-logo img {
    height: 50px;
    width: auto;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.05));
}

/* Header Menu */
.header-menu {
    display: flex;
    align-items: center;
    gap: 35px;
    flex: 1;
    justify-content: center;
}

.header-menu > a,
.header-menu .dropbtn {
    color: var(--se-navy);
    text-decoration: none;
    font-family: var(--font-heading);
    font-weight: normal;
    font-size: 22px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    transition: all var(--transition-base);
    position: relative;
    padding: 8px 0;
    white-space: nowrap;
}

.header-menu > a::after,
.header-menu .dropbtn::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--se-orange);
    transition: width var(--transition-base);
}

.header-menu > a:hover,
.header-menu .dropbtn:hover {
    color: var(--se-orange);
}

.header-menu > a:hover::after,
.dropdown:hover .dropbtn::after {
    width: 100%;
}

/* Dropdown Menu */
.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown .dropbtn {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    background: none;
    border: none;
    font-family: var(--font-heading);
    font-weight: normal;
}

.dropdown .dropbtn i {
    font-size: 0.7rem;
    transition: transform var(--transition-base);
}

.dropdown:hover .dropbtn i {
    transform: rotate(180deg);
}

.dropdown-content {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background-color: var(--se-white);
    min-width: 320px;
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    border-radius: 12px;
    margin-top: 15px;
    padding: 10px 0;
    animation: v2DropFadeIn 0.3s ease;
    border: 1px solid rgba(0, 0, 0, 0.06);
}

.dropdown-content::before {
    content: "";
    position: absolute;
    top: -20px;
    left: 0;
    width: 100%;
    height: 20px;
    background: transparent;
}

@keyframes v2DropFadeIn {
    from {
        opacity: 0;
        transform: translateY(-15px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.dropdown:hover .dropdown-content {
    display: block;
}

.dropdown-content a {
    color: var(--se-navy);
    padding: 15px 25px;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 14px;
    transition: all 0.25s ease;
    font-weight: 500;
    font-size: 14px;
    position: relative;
    white-space: nowrap;
}

.dropdown-content a::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 0;
    background: linear-gradient(90deg, var(--se-orange-bg), transparent);
    transition: width var(--transition-base);
}

.dropdown-content a:hover::before {
    width: 100%;
}

.dropdown-content a:hover {
    background-color: rgba(255, 107, 53, 0.05);
    color: var(--se-orange);
    padding-left: 30px;
}

.dropdown-content a i {
    font-size: 1.2rem;
    color: var(--se-orange);
    transition: transform var(--transition-base);
}

.dropdown-content a:hover i {
    transform: scale(1.15) rotate(5deg);
}

/* Allège les icônes de marque (pleines) pour matcher le style fa-thin */
.dropdown-content a i.fa-brands {
    opacity: 0.45;
    font-size: 1.1rem;
}
.dropdown-content a:hover i.fa-brands {
    opacity: 0.7;
}

/* Header Actions */
/* Auth-conditional visibility (SDK toggles .hidden class via JS) */
/* Default state: showWhenConnected starts hidden, hideWhenConnected starts visible */
/* MainScript.js toggles the .hidden class on these elements */
.showWhenConnected,
.hideWhenConnected {
    display: flex;
    align-items: center;
}
.showWhenConnected.hidden,
.hideWhenConnected.hidden {
    display: none !important;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-shrink: 0;
}

.action-link {
    color: var(--se-gray-blue);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all var(--transition-base);
    white-space: nowrap;
}

.action-link:hover {
    color: var(--se-orange);
}

.action-link i {
    font-size: 13px;
}

/* Bouton Essai Gratuit */
.btn-essai-gratuit {
    background: linear-gradient(135deg, var(--se-orange) 0%, var(--se-orange-dark) 100%);
    color: var(--se-white);
    padding: 12px 24px;
    border-radius: 12px;
    text-decoration: none;
    font-weight: 700;
    font-size: 13px;
    white-space: nowrap;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: var(--shadow-orange);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.btn-essai-gratuit::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn-essai-gratuit:hover::before {
    width: 300px;
    height: 300px;
}

.btn-essai-gratuit:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-orange-lg);
    color: var(--se-white);
}

/* Language selector wrapper with globe icon */
.lang-selector-wrapper {
    display: flex;
    align-items: center;
    gap: 6px;
}
.lang-globe-icon {
    color: var(--se-gray-blue);
    font-size: 15px;
    transition: color var(--transition-base);
}
.lang-selector-wrapper:hover .lang-globe-icon {
    color: var(--se-orange);
}

/* Override SwitchLanguage UserControl inside V2 header */
.header-actions .switchLanguage {
    position: relative;
    float: none !important;
    margin: 0 !important;
    margin-left: 0 !important;
    padding: 0 !important;
}

/* V2 header: hide language text, globe icon only */
.header-actions .switchLanguage .lang-short { display: none !important; }
.header-actions .switchLanguage .lang-full  { display: none !important; }

.header-actions .switchLanguage > a {
    color: var(--se-gray-blue) !important;
    font-size: 13px !important;
    font-weight: 500 !important;
    padding: 0 !important;
    display: flex !important;
    align-items: center;
    gap: 5px;
    text-decoration: none;
    transition: all var(--transition-base);
    white-space: nowrap;
    cursor: pointer;
}

.header-actions .switchLanguage > a:hover {
    color: var(--se-orange) !important;
}

.header-actions .switchLanguage > a i {
    font-size: 12px !important;
    width: auto !important;
    margin-right: 0 !important;
    opacity: 1 !important;
}

.header-actions .switchLanguage ul {
    width: auto !important;
    min-width: 140px !important;
    border-radius: 8px !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12) !important;
    border: 1px solid rgba(0, 0, 0, 0.06) !important;
    border-top: none !important;
    overflow: visible !important;
    padding: 4px 0 !important;
    list-style: none !important;
    top: calc(100% + 8px) !important;
    right: 0 !important;
    left: auto !important;
}

/* Invisible hover bridge — same technique as .dropdown-content::before in nav menus */
.header-actions .switchLanguage ul::before {
    content: "";
    position: absolute;
    top: -20px;
    left: 0;
    width: 100%;
    height: 20px;
    background: transparent;
}

.header-actions .switchLanguage ul li > a {
    font-size: 13px !important;
    font-weight: 500 !important;
    padding: 10px 16px 10px 38px !important;
    color: var(--se-gray-blue) !important;
    position: relative;
    transition: background 0.15s ease, color 0.15s ease !important;
    letter-spacing: 0 !important;
}

/* Check/circle icons via pseudo-elements */
.header-actions .switchLanguage ul li > a::before {
    font-family: "Font Awesome 7 Pro";
    font-weight: 100;
    font-size: 12px;
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    content: "\f111"; /* fa-circle (inactive) */
    color: var(--se-gray-blue);
    opacity: 0.4;
}

/* Active language item (href="#") */
.header-actions .switchLanguage ul li > a[href="#"] {
    color: var(--se-orange) !important;
    pointer-events: none;
}
.header-actions .switchLanguage ul li > a[href="#"]::before {
    content: "\f058"; /* fa-circle-check (active) */
    color: var(--se-orange);
    opacity: 1;
}

.header-actions .switchLanguage ul li:hover > a {
    color: var(--se-orange) !important;
    background-color: rgba(238, 101, 37, 0.05) !important;
    padding-left: 38px !important;
}
.header-actions .switchLanguage ul li:hover > a::before {
    color: var(--se-orange);
    opacity: 0.7;
}

/* Language Selector */
.language-selector {
    position: relative;
}

.lang-link {
    color: var(--se-gray-blue);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: all var(--transition-base);
    white-space: nowrap;
    cursor: pointer;
    user-select: none;
}

.lang-link:hover {
    color: var(--se-orange);
}

.lang-link i {
    font-size: 12px;
}

.lang-link .fa-chevron-down {
    transition: transform 0.2s ease;
}

.language-selector.open .lang-link .fa-chevron-down {
    transform: rotate(180deg);
}

.lang-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
    border: 1px solid rgba(0, 0, 0, 0.06);
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-4px);
    transition: all 0.2s ease;
    z-index: 1000;
    min-width: 120px;
}

.language-selector.open .lang-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.lang-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    font-size: 13px;
    font-weight: 500;
    color: var(--se-gray-blue);
    text-decoration: none;
    transition: background 0.15s ease;
    white-space: nowrap;
}

.lang-option:hover {
    background: #f5f5f5;
}

.lang-option.active {
    color: var(--se-orange);
    pointer-events: none;
}

.lang-option i {
    font-size: 12px;
    width: 14px;
    text-align: center;
}

/* ============================================
   Footer
   ============================================ */
.site-footer {
    background: var(--se-navy-dark);
    color: var(--se-white);
    padding: 50px 0 15px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.footer-container {
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0 20px;
}

.footer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 35px;
    margin-bottom: 35px;
}

.footer-logo-section {
    margin-bottom: 30px;
}

.footer-logo-row {
    display: flex;
    align-items: center;
    gap: 18px;
}

.footer-logo-row a {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.footer-logo-section img.footer-logo-img {
    height: 40px;
    display: block;
}

.footer-canada-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.6);
    white-space: normal;
}

.footer-column h4 {
    font-size: 0.95rem;
    font-weight: normal;
    margin-bottom: 18px;
    color: var(--se-orange);
    letter-spacing: 2px;
}

.footer-column ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.footer-column li {
    margin-bottom: 8px;
}

.footer-column a {
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    font-size: 13px;
    transition: color var(--transition-base);
}

.footer-column a:visited {
    color: rgba(255, 255, 255, 0.7);
}

.footer-column a:hover {
    color: var(--se-white);
}

.footer-bottom {
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.6);
    font-size: 13px;
}

.footer-bottom p {
    margin-bottom: 6px;
}

/* Hide the duplicate links and line break generated by Copyright.ascx inside footer-bottom */
.footer-bottom .copyright-links {
    display: none !important;
}

.footer-copyright br {
    display: none;
}

.footer-copyright {
    margin-bottom: 8px;
}

/* "Fièrement canadien" badge next to copyright */
.footer-proudly-canadian {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-left: 6px;
}

.footer-proudly-canadian img {
    vertical-align: middle;
}

.footer-contact {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 8px;
}

.footer-contact a {
    color: var(--se-orange);
    text-decoration: none;
    transition: color 0.2s;
    font-size: 13px;
}

.footer-contact a:visited {
    color: var(--se-orange);
}

.footer-contact a:hover {
    color: var(--se-orange-light);
}

.footer-contact span {
    color: rgba(255, 255, 255, 0.3);
}

.footer-contact a[aria-label] i.fa-brands {
    font-size: 1.1rem;
}

.footer-legal {
    display: flex;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
    font-size: 12px;
}

.footer-legal a {
    color: rgba(255, 255, 255, 0.4);
    text-decoration: none;
    transition: color 0.2s;
}

.footer-legal a:visited {
    color: rgba(255, 255, 255, 0.4);
}

.footer-legal a:hover {
    color: rgba(255, 255, 255, 0.8);
}

.footer-legal span {
    color: rgba(255, 255, 255, 0.2);
}

.manage-consent-link,
.newsletterbtn {
    cursor: pointer;
}

/* ============================================
   Hamburger Toggle Button (hidden on desktop)
   ============================================ */
.menu-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    z-index: 1001;
}

.menu-toggle span {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--se-navy);
    border-radius: 2px;
    transition: all 0.3s ease;
}

/* Hamburger → X animation */
.menu-open .menu-toggle span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}
.menu-open .menu-toggle span:nth-child(2) {
    opacity: 0;
}
.menu-open .menu-toggle span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
}

/* ============================================
   Responsive — Header
   ============================================ */

/* First squeeze: reduce gaps & padding */
@media (max-width: 1400px) {
    .header-unified {
        padding: 12px 30px;
        gap: 30px;
    }

    .header-menu {
        gap: 24px;
    }

    .header-menu > a,
    .header-menu .dropbtn {
        font-size: 19px;
    }

    .header-actions {
        gap: 14px;
    }

    .btn-essai-gratuit {
        padding: 10px 18px;
        font-size: 12px;
    }

    .action-link {
        font-size: 13px;
    }
}

/* Second squeeze: tighter still */
@media (max-width: 1200px) {
    .header-unified {
        padding: 12px 20px;
        gap: 20px;
    }

    .header-menu {
        gap: 18px;
    }

    .header-menu > a,
    .header-menu .dropbtn {
        font-size: 17px;
    }

    .header-actions {
        gap: 12px;
    }

    .btn-essai-gratuit {
        padding: 9px 14px;
        font-size: 11px;
    }

    .action-link {
        font-size: 12px;
        gap: 4px;
    }

    #simple-header.scrolled {
        top: 12px;
        margin: 0 15px;
        border-radius: 16px;
    }
}

@media (max-width: 992px) {
    .header-logo img {
        height: 70px;
    }

    .menu-toggle {
        display: flex;
    }

    .header-unified {
        flex-wrap: wrap;
    }

    .header-menu {
        display: none;
        order: 3;
        flex-basis: 100%;
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
        padding-top: 20px;
        border-top: 1px solid rgba(0, 0, 0, 0.06);
    }

    /* Show menu when toggled */
    .menu-open .header-menu {
        display: flex;
    }

    .header-actions {
        display: none;
        order: 4;
        flex-basis: 100%;
        flex-direction: column;
        gap: 0;
        padding-top: 16px;
        border-top: 1px solid rgba(0, 0, 0, 0.06);
        align-items: stretch;
    }

    .menu-open .header-actions {
        display: flex;
    }

    /* Connexion / Mon profil link: full width, tap-friendly */
    .header-actions .action-link {
        padding: 14px 0;
        font-size: 16px;
        font-weight: 600;
        color: var(--se-navy);
        justify-content: flex-start;
        width: 100%;
    }

    .header-actions .action-link i {
        font-size: 16px;
    }

    /* Essai gratuit / Envoyer message: full width, centered */
    .header-actions .hideWhenConnected,
    .header-actions .showWhenConnected {
        width: 100%;
    }

    .header-actions .btn-essai-gratuit {
        text-align: center;
        width: 100%;
        display: block;
        padding: 14px 24px;
        font-size: 14px;
        margin: 8px 0;
    }

    /* Dropdowns in mobile: full width, tap-friendly */
    .header-menu .dropdown {
        width: 100%;
    }

    .header-menu .dropdown .dropbtn {
        width: 100%;
        padding: 10px 0;
        font-size: 20px;
    }

    .header-menu > a {
        padding: 10px 0;
        font-size: 20px;
        width: 100%;
    }

    /* Dropdown content in mobile: static, no absolute */
    .header-menu .dropdown-content {
        position: static;
        box-shadow: none;
        border: none;
        border-radius: 0;
        margin-top: 0;
        padding: 0 0 5px 15px;
        animation: none;
        min-width: auto;
    }

    .header-menu .dropdown-content::before {
        display: none;
    }

    /* Language selector in mobile: collapsible like nav dropdowns */
    .header-actions .lang-selector-wrapper {
        width: 100%;
        flex-direction: row;
        flex-wrap: wrap;
        align-items: flex-start;
        gap: 0;
        border-top: 1px solid rgba(0, 0, 0, 0.06);
        padding-top: 12px;
        margin-top: 4px;
    }

    /* Globe icon inline with language text */
    .header-actions .lang-globe-icon {
        font-size: 18px;
        margin-right: 10px;
        flex-shrink: 0;
        /* Align vertically with the switchLanguage > a text (padding 12px 0) */
        margin-top: 14px;
    }

    .header-actions .switchLanguage {
        flex: 1;
        float: none !important;
        margin: 0 !important;
        margin-left: 0 !important;
    }

    /* Make the main language link look like a nav item */
    .header-actions .switchLanguage > a {
        padding: 12px 0 !important;
        font-size: 16px !important;
        font-weight: 600 !important;
        color: var(--se-navy) !important;
        display: flex !important;
        align-items: center;
        gap: 8px;
        width: 100%;
    }

    /* Show the lang-full text on mobile so user sees current language */
    .header-actions .switchLanguage .lang-full {
        display: inline !important;
    }

    /* Make chevron smaller and aligned */
    .header-actions .switchLanguage > a i {
        font-size: 12px !important;
        opacity: 1 !important;
        width: auto !important;
        margin-right: 4px !important;
        transition: transform 0.2s ease;
    }

    /* Language list: hidden by default, shown on toggle */
    .header-actions .switchLanguage ul {
        display: none !important;
        position: static !important;
        box-shadow: none !important;
        border: none !important;
        border-top: none !important;
        border-radius: 0 !important;
        min-width: auto !important;
        width: 100% !important;
        padding: 0 0 5px 28px !important;
        margin-top: 0 !important;
        top: auto !important;
        right: auto !important;
        left: auto !important;
    }

    /* Full-width language list below the globe+text row */
    .header-actions .lang-selector-wrapper .switchLanguage ul {
        flex-basis: 100%;
    }

    /* Show language list when parent has .open class */
    .header-actions .switchLanguage.lang-open ul {
        display: block !important;
    }

    .header-actions .switchLanguage.lang-open > a i {
        transform: rotate(180deg);
    }

    .header-actions .switchLanguage ul li > a {
        padding: 10px 16px 10px 38px !important;
        font-size: 14px !important;
        position: relative;
    }

    /* ---- Mobile dropdown toggle (touch devices) ---- */
    .header-menu .dropdown-content {
        display: none;
    }

    .header-menu .dropdown.open > .dropdown-content {
        display: flex;
        flex-direction: column;
    }

    .header-menu .dropdown.open > .dropbtn i {
        transform: rotate(180deg);
    }
}

/* ============================================
   Responsive < 768px
   ============================================ */
@media (max-width: 767.98px) {
    .canada-banner {
        font-size: 0.75rem;
        padding: 8px 12px;
        gap: 6px;
    }

    .canada-flag-icon {
        height: 12px;
        width: 22px;
    }

    .header-unified {
        padding: 10px 15px;
        gap: 10px;
    }

    .header-logo img {
        height: 55px;
    }

    .footer-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 25px;
    }

    .footer-column a {
        font-size: 14px;
        padding: 3px 0;
    }
}

/* ============================================
   Responsive < 480px
   ============================================ */
@media (max-width: 480px) {
    .canada-banner {
        font-size: 0.7rem;
        padding: 6px 10px;
    }

    .header-unified {
        padding: 8px 12px;
        gap: 8px;
    }

    .header-logo img {
        height: 45px;
    }

    .header-menu .dropdown .dropbtn {
        font-size: 17px;
        padding: 12px 0;
    }

    .header-menu > a {
        font-size: 17px;
        padding: 12px 0;
    }

    .header-menu .dropdown-content a {
        padding: 12px 20px;
        font-size: 14px;
        white-space: normal;
    }

    .footer-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .footer-column h4 {
        margin-bottom: 10px;
    }

    .footer-bottom {
        font-size: 12px;
    }

    .footer-contact {
        font-size: 12px;
    }

    .btn-essai-gratuit {
        padding: 10px 16px;
        font-size: 12px;
    }
}