/* Global Navigation Bar Styles */
nav.navbar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    background-color: #f4f4f4;
    z-index: 1000; /* Ensures the navbar stays above other elements */
    opacity: 1;
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.navbar-content {
    max-width: 100%;
    width: 100%;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 2%;  /* Reduced from 5% to 2% - wider coverage */
    box-sizing: border-box;
    transition: padding 0.3s ease;
    gap: 1rem;
}

/* Logo and Support Button Container */
.logo-support-container {
    display: flex;
    align-items: center;
    gap: 20px;  /* Space between logo and Støtt Oss button */
    flex-shrink: 0;
}

/* Logo container and sizing */
nav .logo {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    flex-shrink: 0;
}

nav .logo a {
    display: flex;
    align-items: center;
}

nav .logo img {
    height: 75px;  /* Increased from 70px to 75px - larger size makes small text more readable */
    width: auto;
    transition: transform 0.3s ease, height 0.3s ease;
    image-rendering: -webkit-optimize-contrast;  /* Sharper text rendering in WebKit browsers */
    image-rendering: crisp-edges;  /* Crisp edges for better small text readability */
    -webkit-backface-visibility: hidden;  /* Prevent blur on webkit browsers */
    backface-visibility: hidden;
    transform: translateZ(0);  /* Force GPU acceleration for sharper rendering */
    -webkit-font-smoothing: antialiased;  /* Better text rendering */
}

nav .logo img:hover {
    transform: scale(1.05) translateZ(0);  /* Maintain GPU acceleration on hover */
}

html {
    scroll-behavior: auto; /* Immediate scrolling for elderly users */
}

/* Støtt Oss Button Styling - Always Green */
.stott-oss {
    display: inline-block;
    text-decoration: none;
    border: 2px solid #28a745;
    border-radius: 40px;
    padding: 0.6rem 1.2rem;
    font-size: 1.125rem;  /* 18px - Increased for elderly users */
    font-weight: bold;
    color: #fff !important;  /* White text all the time - force override */
    background-color: #28a745 !important;  /* Green background all the time - force override */
    text-align: center;
    line-height: 1.2;
    transition: all 0.3s ease;
    white-space: nowrap;
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.3);
}

.stott-oss:hover {
    background-color: #218838 !important;  /* Darker green on hover - force override */
    border-color: #218838;
    color: #fff !important;  /* Keep white text on hover - force override */
    cursor: pointer;
    box-shadow: 0 6px 16px rgba(40, 167, 69, 0.4);
    transform: translateY(-2px);
}

/* Mobile: Støtt Oss between logo and hamburger */
.stott-oss.mobile-only {
    display: none;
}

/* Desktop only - hide in mobile menu */
.desktop-only {
    display: list-item;
}

/* Navigation Links - Desktop View */
nav ul.nav-links {
    list-style: none;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    margin: 0;
    padding: 0;
    flex-wrap: wrap;
    gap: 8px;
}

nav ul.nav-links li {
    margin: 0;
}

nav ul.nav-links li a {
    text-decoration: none;
    color: #333;
    font-size: 22px;  /* Increased from 20px to 22px for better readability */
    font-weight: 600;  /* Semibold for elderly users */
    transition: all 0.3s ease;
    position: relative;
    padding: 10px 14px;
    border-radius: 8px;
    display: block;
}

/* Hover effect for navigation links */
nav ul.nav-links li a:hover {
    color: #28a745;
    background-color: rgba(40, 167, 69, 0.08);
}

/* Active menu item styling */
nav ul.nav-links li a.active {
    color: #28a745;
    font-weight: bold;
    background-color: rgba(40, 167, 69, 0.1);
}

/* Underline effect for active item */
nav ul.nav-links li a.active::after {
    content: '';
    position: absolute;
    left: 12px;
    right: 12px;
    bottom: 5px;
    height: 3px;
    background-color: #28a745;
    border-radius: 2px;
    animation: underlineSlideIn 0.3s ease-out; /* Animation for underline */
}

/* Animation for underline effect */
@keyframes underlineSlideIn {
    from {
        transform: scaleX(0);
    }
    to {
        transform: scaleX(1);
    }
}

/* Hamburger Menu Icon - CSS/SVG Based */
.hamburger-menu {
    cursor: pointer;
    display: none; /* Hidden by default for large screens */
    z-index: 1100;
    width: 35px;
    height: 35px;
    position: relative;
    transition: transform 0.3s ease;
}

.hamburger-menu:hover {
    transform: scale(1.1);
}

.hamburger-menu:active {
    transform: scale(0.95);
}

/* Hamburger Lines */
.hamburger-menu span {
    display: block;
    position: absolute;
    height: 3px;
    width: 100%;
    background-color: #333;
    border-radius: 3px;
    opacity: 1;
    left: 0;
    transform: rotate(0deg);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.hamburger-menu span:nth-child(1) {
    top: 6px;
}

.hamburger-menu span:nth-child(2) {
    top: 16px;
}

.hamburger-menu span:nth-child(3) {
    top: 26px;
}

/* Transform to X when active */
.hamburger-menu.active span:nth-child(1) {
    top: 16px;
    transform: rotate(45deg);
    background-color: #28a745;
}

.hamburger-menu.active span:nth-child(2) {
    opacity: 0;
    left: -35px;
}

.hamburger-menu.active span:nth-child(3) {
    top: 16px;
    transform: rotate(-45deg);
    background-color: #28a745;
}

/* Remove old close-menu styles */
.close-menu {
    display: none !important;
}

/* Mobile Menu Overlay/Backdrop */
.menu-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 999;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.menu-overlay.active {
    display: block;
    opacity: 1;
}

/* Tablet Breakpoint (769px - 1024px) */
@media (min-width: 769px) and (max-width: 1024px) {
    .navbar-content {
        padding: 12px 2%;  /* Wider coverage for tablets */
    }

    nav ul.nav-links li a {
        font-size: 22px;  /* Increased from 20px to 22px for better readability */
        font-weight: 600;
        padding: 8px 10px;
    }

    nav .logo img {
        height: 70px;  /* Increased for better small text readability on tablets */
    }

    nav .stott-oss {
        font-size: 1rem;  /* 16px - Increased for elderly users */
        padding: 0.5rem 1rem;
    }
}

/* Large Desktop (1400px+) */
@media (min-width: 1400px) {
    .navbar-content {
        padding: 12px 3%;  /* Reduced from 8% to 3% - much wider coverage */
        max-width: none;   /* Removed 1600px constraint - use almost full width */
        margin: 0 auto;
    }

    nav ul.nav-links li a {
        font-size: 22px;  /* Increased from 20px to 22px for better readability */
        font-weight: 600;
        padding: 10px 16px;
    }
}

/* Small Mobile (max 480px) */
@media (max-width: 480px) {
    .navbar-content {
        padding: 10px 4%;
        gap: 0.5rem;
    }

    .logo-support-container {
        gap: 12px;  /* Reduced gap for smaller screens */
    }

    nav .logo img {
        height: 60px;  /* Increased for better small text readability on small mobile */
    }

    .stott-oss.mobile-only {
        display: inline-block;
        font-size: 0.875rem;  /* 14px - Increased for elderly users */
        padding: 0.35rem 0.65rem;
        border-width: 1.5px;
    }

    .hamburger-menu {
        width: 32px;
        height: 32px;
    }

    .hamburger-menu span {
        height: 2.5px;
    }

    .hamburger-menu span:nth-child(1) {
        top: 5px;
    }

    .hamburger-menu span:nth-child(2) {
        top: 14px;
    }

    .hamburger-menu span:nth-child(3) {
        top: 23px;
    }

    .hamburger-menu.active span:nth-child(1),
    .hamburger-menu.active span:nth-child(3) {
        top: 14px;
    }
}

/* Mobile Navigation Styles (max 768px) */
@media (max-width: 768px) {
    /* Show mobile Støtt Oss button */
    .stott-oss.mobile-only {
        display: inline-block;
        font-size: 1rem;  /* 16px - Increased for elderly users */
        padding: 0.45rem 0.85rem;
    }

    /* Hide desktop Støtt Oss from nav menu */
    .desktop-only {
        display: none !important;
    }

    /* Mobile Navigation Links - Hidden Initially */
    nav ul.nav-links {
        position: fixed;
        right: -100%; /* Hidden off-screen */
        top: 0;
        height: 100vh;
        width: 85%;
        max-width: 320px;
        flex-direction: column;
        background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
        justify-content: center;
        align-items: flex-start;
        padding: 40px 30px;
        box-shadow: -4px 0 24px rgba(0, 0, 0, 0.15);
        transition: right 0.4s cubic-bezier(0.4, 0, 0.2, 1);
        z-index: 1001;
        overflow-y: auto;
    }

    /* Show navigation links when active */
    nav ul.nav-links.active {
        right: 0; /* Slide-in effect */
    }

    nav ul.nav-links li {
        margin: 0;
        width: 100%;
        opacity: 0;
        transform: translateX(20px);
        transition: opacity 0.3s ease, transform 0.3s ease;
    }

    /* Stagger animation for menu items */
    nav ul.nav-links.active li {
        opacity: 1;
        transform: translateX(0);
    }

    nav ul.nav-links.active li:nth-child(1) { transition-delay: 0.1s; }
    nav ul.nav-links.active li:nth-child(2) { transition-delay: 0.15s; }
    nav ul.nav-links.active li:nth-child(3) { transition-delay: 0.2s; }
    nav ul.nav-links.active li:nth-child(4) { transition-delay: 0.25s; }
    nav ul.nav-links.active li:nth-child(5) { transition-delay: 0.3s; }
    nav ul.nav-links.active li:nth-child(6) { transition-delay: 0.35s; }

    nav ul.nav-links li a {
        display: block;
        width: 100%;
        padding: 16px 20px;
        font-size: 20px;
        font-weight: 500;
        color: #333;
        border-radius: 12px;
        margin-bottom: 8px;
        transition: all 0.3s ease;
        position: relative;
    }

    nav ul.nav-links li a:hover {
        background-color: rgba(40, 167, 69, 0.1);
        color: #28a745;
        transform: translateX(8px);
    }

    nav ul.nav-links li a.active {
        background-color: rgba(40, 167, 69, 0.15);
        color: #28a745;
        font-weight: bold;
        border-left: 4px solid #28a745;
        padding-left: 16px;
    }

    /* Remove underline effect on mobile */
    nav ul.nav-links li a.active::after {
        display: none;
    }

    /* Show hamburger icon for mobile screens */
    .hamburger-menu {
        display: block;
    }

    /* Show close icon when menu is active */
    .close-menu.active {
        display: block;
        position: fixed;
        top: 20px;
        right: 20px;
    }

    /* Hide close icon initially */
    .close-menu {
        display: none;
    }

    /* Mobile menu adjustments */
    nav ul.nav-links li a {
        font-size: 18px;
    }
}

/* Medium Mobile Optimization (481px - 768px) */
@media (min-width: 481px) and (max-width: 768px) {
    .navbar-content {
        gap: 1rem;
    }

    .logo-support-container {
        gap: 15px;  /* Reduced gap for medium screens */
    }

    nav .logo img {
        height: 68px;  /* Increased for better small text readability on medium mobile */
    }

    .stott-oss.mobile-only {
        font-size: 1rem;  /* 16px - Increased for elderly users */
        padding: 0.5rem 0.9rem;
    }

    nav ul.nav-links li a {
        font-size: 22px;  /* Increased from 20px to 22px for better readability */
    }
}

/* Large Screen (Desktop) Styles */
@media (min-width: 769px) {
    /* Hide hamburger and close menu icons for larger screens */
    .hamburger-menu, .close-menu {
        display: none;
    }
}
