/* ========================================
   HEADER CSS - LinkCodeAI (FINAL VERSION)
   Single Line Layout: Logo+Text | Navigation | Social Icons
   ======================================== */

/* === ROOT VARIABLES === */
:root {
    --navy-dark: #0a1929;
    --navy-medium: #0d2238;
    --white: #ffffff;
    --green-primary: #10b981;
    --green-hover: #059669;
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
    --transition-speed: 0.3s;
    --header-height: 70px;
}

/* === BASE STYLES === */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* === CONTAINER === */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 30px;
}

/* ========================================
   MAIN HEADER
   ======================================== */
.main-header {
    background-color: var(--navy-dark);
    color: var(--white);
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: var(--shadow-md);
    transition: all var(--transition-speed) ease;
}

.main-header.scrolled {
    box-shadow: var(--shadow-lg);
}

/* === HEADER WRAPPER - Grid Layout === */
.header-wrapper {
    display: grid;
    grid-template-columns: minmax(250px, 1fr) auto minmax(200px, 1fr);
    align-items: center;
    min-height: var(--header-height);
    gap: 20px;
}

/* ========================================
   LEFT: Logo + Tagline
   ======================================== */
.header-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.logo a {
    display: flex;
    text-decoration: none;
    transition: opacity var(--transition-speed) ease;
}

.logo a:hover {
    opacity: 0.9;
}

.logo img {
    height: 35px;
    width: auto;
    display: block;
    transition: transform var(--transition-speed) ease;
}

.logo a:hover img {
    transform: scale(1.05);
}

.tagline {
    font-weight: 600;
    font-size: 15px;
    color: var(--white);
    white-space: nowrap;
}

/* ========================================
   CENTER: Navigation
   ======================================== */
.header-center {
    display: flex;
    justify-content: center;
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 5px;
    margin: 0;
    padding: 0;
}

.nav-item {
    position: relative;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 25px 20px;
    color: var(--white);
    text-decoration: none;
    font-weight: 500;
    font-size: 16px;
    transition: all var(--transition-speed) ease;
    white-space: nowrap;
    position: relative;
}

.nav-link:hover {
    color: var(--green-primary);
    background-color: rgba(16, 185, 129, 0.08);
}

/* Active Page - Green Highlight */
.nav-link[aria-current="page"] {
    color: var(--green-primary);
    background-color: rgba(16, 185, 129, 0.12);
    font-weight: 600;
}

.nav-link[aria-current="page"]::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 20px;
    right: 20px;
    height: 3px;
    background-color: var(--green-primary);
    border-radius: 3px 3px 0 0;
}

/* Dropdown Arrow */
.dropdown-arrow {
    transition: transform var(--transition-speed) ease;
    width: 10px;
    height: 6px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.has-dropdown:hover .dropdown-arrow {
    transform: rotate(180deg);
}

/* Dropdown Menu */
.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    background-color: var(--navy-medium);
    min-width: 220px;
    list-style: none;
    border-radius: 0 0 8px 8px;
    box-shadow: var(--shadow-lg);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all var(--transition-speed) ease;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-top: none;
}

.has-dropdown:hover .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-link {
    display: block;
    padding: 14px 20px;
    color: var(--white);
    text-decoration: none;
    font-size: 15px;
    transition: all var(--transition-speed) ease;
}

.dropdown-link:hover {
    background-color: rgba(16, 185, 129, 0.1);
    color: var(--green-primary);
    padding-left: 25px;
}

.dropdown-menu li:last-child .dropdown-link {
    border-radius: 0 0 8px 8px;
}

/* ========================================
   RIGHT: Social Icons
   ======================================== */
.header-right {
    display: flex;
    justify-content: flex-end;
}

.social-icons {
    display: flex;
    gap: 10px;
}

.social-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.08);
    transition: all var(--transition-speed) ease;
    text-decoration: none;
}

.social-icon:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.social-icon svg {
    transition: transform var(--transition-speed) ease;
}

.social-icon:hover svg {
    transform: scale(1.1);
}

.social-icon.facebook:hover { background-color: #1877F2; }
.social-icon.linkedin:hover { background-color: #0A66C2; }
.social-icon.twitter:hover { background-color: #1DA1F2; }
.social-icon.instagram:hover { background: linear-gradient(45deg, #FED576, #F47133, #BC3081); }
.social-icon.youtube:hover { background-color: #FF0000; }

/* ========================================
   MOBILE MENU
   ======================================== */
.mobile-menu-toggle {
    display: none;
}

.mobile-menu-overlay {
    display: none;
}

/* ========================================
   RESPONSIVE
   ======================================== */

/* Tablet (768px - 1199px) */
@media (min-width: 768px) and (max-width: 1199px) {
    .header-wrapper {
        grid-template-columns: auto 1fr auto;
        gap: 15px;
    }
    
    .tagline {
        font-size: 14px;
    }
    
    .nav-link {
        padding: 25px 15px;
        font-size: 15px;
    }
    
    .social-icon {
        width: 34px;
        height: 34px;
    }
}

/* Mobile (up to 767px) */
@media (max-width: 767px) {
    .container {
        padding: 0 15px;
    }
    
    .header-wrapper {
        display: flex;
        flex-wrap: wrap;
        justify-content: space-between;
        padding: 10px 0;
    }
    
    .header-left {
        order: 1;
        flex: 1;
    }
    
    .logo img {
        height: 30px;
    }
    
    .tagline {
        font-size: 12px;
    }
    
    .mobile-menu-toggle {
        display: flex;
        order: 2;
        flex-direction: column;
        gap: 5px;
        background: none;
        border: none;
        cursor: pointer;
        padding: 10px;
    }
    
    .hamburger-line {
        width: 28px;
        height: 3px;
        background-color: var(--white);
        border-radius: 3px;
        transition: all var(--transition-speed) ease;
    }
    
    .mobile-menu-toggle[aria-expanded="true"] .hamburger-line:nth-child(1) {
        transform: rotate(45deg) translate(7px, 7px);
    }
    
    .mobile-menu-toggle[aria-expanded="true"] .hamburger-line:nth-child(2) {
        opacity: 0;
    }
    
    .mobile-menu-toggle[aria-expanded="true"] .hamburger-line:nth-child(3) {
        transform: rotate(-45deg) translate(7px, -7px);
    }
    
    .header-center {
        display: none;
    }
    
    .nav-menu {
        position: fixed;
        top: 0;
        right: -100%;
        width: 85%;
        max-width: 320px;
        height: 100vh;
        background-color: var(--navy-dark);
        flex-direction: column;
        padding: 80px 0 30px;
        gap: 0;
        transition: right var(--transition-speed) ease;
        overflow-y: auto;
        z-index: 1000;
        box-shadow: -4px 0 10px rgba(0, 0, 0, 0.3);
    }
    
    .nav-menu.active {
        right: 0;
    }
    
    .nav-item {
        width: 100%;
        border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    }
    
    .nav-link {
        padding: 18px 25px;
        font-size: 17px;
    }
    
    .nav-link[aria-current="page"]::after {
        display: none;
    }
    
    .nav-link[aria-current="page"] {
        border-left: 4px solid var(--green-primary);
    }
    
    .dropdown-menu {
        position: static;
        opacity: 1;
        visibility: visible;
        transform: none;
        box-shadow: none;
        border: none;
        max-height: 0;
        overflow: hidden;
        transition: max-height var(--transition-speed) ease;
        background-color: rgba(0, 0, 0, 0.2);
    }
    
    .has-dropdown.active .dropdown-menu {
        max-height: 400px;
    }
    
    .dropdown-link {
        padding: 14px 25px 14px 40px;
    }
    
    .header-right {
        order: 3;
        width: 100%;
        justify-content: center;
        padding-top: 10px;
        border-top: 1px solid rgba(255, 255, 255, 0.1);
    }
    
    .social-icons {
        gap: 12px;
    }
    
    .social-icon {
        width: 38px;
        height: 38px;
    }
    
    .mobile-menu-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background-color: rgba(0, 0, 0, 0.7);
        z-index: 999;
        opacity: 0;
        transition: opacity var(--transition-speed) ease;
    }
    
    .mobile-menu-overlay.active {
        display: block;
        opacity: 1;
    }
}

/* Accessibility */
.nav-link:focus-visible,
.dropdown-link:focus-visible,
.social-icon:focus-visible,
.logo a:focus-visible {
    outline: 2px solid var(--green-primary);
    outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}