/**
 * Avanza Theme - Header and Footer Styles
 * Reusable styles for header and footer components
 */

/* Official Brand Colors */
:root {
    --avanza-pink: #ec2c66;
    --avanza-yellow: #fdbd23;
    --avanza-teal: #09b5be;
    --avanza-blue: #1685b2;
    --avanza-green: #47ba95;
    --avanza-white: #FFFFFF;
    --avanza-black: #000000;
    --avanza-gray: #666666;
}

/* Header Styles */
.avanza-header {
    background-color: var(--avanza-white);
    box-shadow: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.avanza-header .header-container {
    width: 100%;
}

.avanza-header .navigation-container {
    width: 100%;
}

.avanza-header .header-content {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    position: relative;
}

.avanza-header .avanza-logo {
    margin: 0;
    text-align: center;
    padding: 10px 0;
}

.avanza-header .avanza-logo a {
    text-decoration: none;
    display: block;
    margin: auto;
}

.avanza-header .avanza-logo-img {
    height: 100px;
    width: auto;
    max-width: 462px;
    margin: auto;
    display: block;
    transition: all 0.3s ease;
}

.avanza-header .avanza-logo-placeholder {
    display: block;
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--avanza-black);
    text-align: center;
}

.footer-logo-placeholder {
    display: block;
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--avanza-black);
    text-align: center;
}

/* Pinned header styles */
.avanza-header.pinned {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    background-color: var(--avanza-white);
    z-index: 99999;
}

.avanza-header.pinned .nav-bar {
    height: 25px;
}

/* Logo shrinking when pinned */
.avanza-header.pinned .avanza-logo-img {
    height: 50px;
    width: auto;
}

/* Add top padding to body when header is pinned */
body.header-pinned {
    padding-top: 80px; /* Adjust based on your pinned header height */
}

.nav-bar {
    display: flex !important;
    height: 50px;
    width: 100%;
    visibility: visible !important;
    opacity: 1 !important;
    transition: height 0.3s ease;
}

.nav-segment {
    flex: 1;
    /* min-height: 100%; */
    height: 100%;
    display: block;
}

/* Background color utility classes for nav-bar */
.pink-bg {
    background-color: var(--avanza-pink);
}

.yellow-bg {
    background-color: var(--avanza-yellow);
}

.teal-bg {
    background-color: var(--avanza-teal);
}

.blue-bg {
    background-color: var(--avanza-blue);
}

.green-bg {
    background-color: var(--avanza-green);
}

.avanza-nav {
    display: flex;
    gap: 30px;
    align-items: center;
    justify-content: center;
    width: 100%;
    list-style: none;
    margin: 0;
    padding: 0;
}

.avanza-nav a {
    color: var(--avanza-black);
    text-decoration: none !important;
    font-weight: 500;
    font-size: 0.9rem;
    transition: color 0.3s ease;
}

.avanza-nav a:hover {
    color: var(--avanza-pink);
    text-decoration: none !important;
}

/* Desktop Navigation Styles */
.main-navigation {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    position: relative;
}

/* Target all possible ul selectors within navigation */
.main-navigation .avanza-nav {
    display: flex;
    list-style: none;
    list-style-type: none;
    margin: 0;
    padding: 0;
    gap: 30px;
    justify-content: space-around;
    width: 100%;
    flex-direction: row;
}

/* Target all possible li selectors */
.main-navigation .avanza-nav li {
    margin: 0;
    list-style: none;
    list-style-type: none;
    display: list-item;
}

/* Target all possible link selectors */
.main-navigation .avanza-nav a {
    /* Color is set by customizer - don't override here */
    text-decoration: none;
    font-weight: 500;
    font-size: 1.125rem;
    transition: color 0.3s ease;
    line-height: 50px;
    display: block;
}

/* Default color for menu items (if customizer colors not set) */
.main-navigation .nav-menu > li:nth-of-type(n + 5) a {
    color: var(--avanza-black);
}

/* Hover color is handled by customizer for first 4 items */
/* For items beyond 4, use pink */
.main-navigation .nav-menu > li:nth-of-type(n + 5) a:hover {
    color: var(--avanza-pink);
}

/* Menu item color customization support */
.main-navigation .nav-menu li a,
.main-navigation .avanza-nav li a {
    transition: all 0.3s ease;
    position: relative;
}

/* Underline effect only on hover */
.main-navigation .nav-menu li a::after,
.main-navigation .avanza-nav li a::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 2px;
    background-color: currentColor;
    transition: width 0.3s ease;
}

.main-navigation .nav-menu li a:hover::after,
.main-navigation .avanza-nav li a:hover::after {
    width: 100%;
}

/* Footer Styles */
.avanza-footer {
    background-color: var(--avanza-yellow);
    padding: 40px 0;
}

.footer-content {
    display: flex;
    flex-direction: column;
    gap: 20px;
    justify-content: space-between;
    align-items: center;
}

.footer-logo-img {
    height: 80px;
    width: auto;
    max-width: 100%;
}

.footer-social {
    display: flex;
    gap: 20px;
    align-items: center;
}

.social-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    background-color: var(--avanza-white);
    border-radius: 50%;
    transition: transform 0.3s ease;
}

.social-link:hover {
    transform: scale(1.1);
}

.social-link img {
    width: 20px;
    height: 20px;
}

/* Menu Toggle - Hidden on desktop, visible on mobile */
.menu-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 10px;
    z-index: 1001;
    position: relative;
    margin-left: auto;
}

.menu-toggle-text {
    font-size: 0.9rem;
    font-weight: 500;
    margin-right: 10px;
}

.menu-toggle-icon {
    display: flex;
    flex-direction: column;
    width: 20px;
    height: 15px;
    justify-content: space-between;
    position: relative;
}

.menu-toggle-icon span {
    display: block;
    height: 2px;
    width: 100%;
    background-color: #333;
    transition: all 0.3s ease;
    position: absolute;
    left: 0;
    top: 50%;
    transform-origin: center;
}

.menu-toggle-icon span:nth-child(1) {
    transform: translateY(-6px);
}

.menu-toggle-icon span:nth-child(2) {
    transform: translateY(0);
}

.menu-toggle-icon span:nth-child(3) {
    transform: translateY(6px);
}

.menu-toggle.active .menu-toggle-icon span:nth-child(1) {
    transform: translateY(0) rotate(45deg);
}

.menu-toggle.active .menu-toggle-icon span:nth-child(2) {
    opacity: 0;
    transform: translateY(0) rotate(0deg);
}

.menu-toggle.active .menu-toggle-icon span:nth-child(3) {
    transform: translateY(0) rotate(-45deg);
}

/* Mobile Navigation Styles */
@media (max-width: 768px) {
    .site-header .container {
        padding: 10px 0;
    }

    .avanza-header {
        position: relative;
    }

    .avanza-header .navigation-container {
        padding: 0;
    }
    
    .avanza-header .header-content {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 100%;
        padding: 0 20px;
        gap: 15px;
        position: relative;
    }

    .avanza-header .avanza-logo {
        padding: 0;
    }

    .avanza-header .avanza-logo-img {
        height: 50px;
    }

    .menu-toggle {
        display: flex;
        align-items: center;
        order: 1;
        flex-shrink: 0;
        position: absolute;
        top: 0;
        left: 0;
        transform: translate(0, 25%);
        z-index: 9999;
    }

    .avanza-header.pinned .menu-toggle {
        transform: translate(0, 0);
    }
    
    .site-branding {
        order: 2;
        flex: 1;
        display: flex;
        justify-content: center;
    }
    
    .main-navigation {
        position: relative;
        width: 100%;
        max-width: 100%;
        padding: 0;
        display: block;
    }
    
    .main-navigation .avanza-nav {
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background-color: #fff;
        box-shadow: 0 2px 4px rgba(0,0,0,0.1);
        transform: translateY(-100%);
        opacity: 0;
        visibility: hidden;
        transition: all 0.3s ease;
        z-index: 1000;
        flex-direction: column;
        padding: 1rem;
        gap: 0;
        margin: 0;
        list-style: none;
    }
    
    .main-navigation.active .avanza-nav {
        transform: translateY(0);
        opacity: 1;
        visibility: visible;
        flex-direction: column;
    }
    
    .main-navigation .avanza-nav li {
        margin-bottom: 0.5rem;
        border-bottom: 1px solid #eee;
    }
    
    .main-navigation .avanza-nav li:last-child {
        border-bottom: none;
    }
    
    .main-navigation .avanza-nav a {
        display: block;
        padding: 15px 0;
        font-size: 1.1rem;
        line-height: normal;
    }

    .avanza-header .avanza-logo-img {
        height: 50px;
    }
    
    /* Logo smaller when pinned on mobile */
    .avanza-header.pinned .avanza-logo-img {
        height: 40px;
    }
    
    .footer-logo-img {
        height: 50px;
    }
    
    .footer-content {
        flex-direction: column;
        gap: 20px;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .nav-bar {
        height: 25px;
    }

    .avanza-header.pinned .nav-bar {
        height: 20px;
    }
}
