/**
 * Modern Header Styles for Article.Pk
 *
 * Single unified header combining:
 * - Logo and branding
 * - Main navigation menu
 * - Social links
 * - Search functionality
 * - Monetize CTA button
 *
 * Features:
 * - Sticky header with shrink on scroll
 * - Responsive mobile menu
 * - Brand colors (#0052cc, #00c453, #2a323a)
 * - Smooth animations
 */

/* ==========================================
   MODERN HEADER CONTAINER
   ========================================== */

.modern-header {
    background: var(--white);
    border-bottom: 1px solid var(--light-border);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: var(--z-sticky);
    transition: all 0.3s ease;
}

.modern-header.scrolled {
    box-shadow: var(--shadow-md);
}

.modern-header.scrolled .header-main {
    padding: 12px 0;
}

.modern-header.scrolled .social-links-bar {
    max-height: 0;
    opacity: 0;
    overflow: hidden;
}

/* ==========================================
   HEADER MAIN ROW
   ========================================== */

.header-main {
    padding: 16px 0;
    transition: padding 0.3s ease;
}

.header-wrapper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

/* ==========================================
   LOGO SECTION
   ========================================== */

.header-logo {
    flex-shrink: 0;
    display: flex;
    align-items: center;
}

.header-logo a {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
    transition: var(--transition-transform);
}

.header-logo a:hover {
    transform: scale(1.02);
}

.header-logo img {
    max-height: 50px;
    width: auto;
    display: block;
}

.header-logo-text {
    font-size: 28px;
    font-weight: var(--font-extrabold);
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-family: var(--font-primary);
}

/* ==========================================
   MAIN NAVIGATION
   ========================================== */

.header-nav {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav-menu {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 5px;
}

.nav-menu > .nav-item {
    position: relative;
}

.nav-menu > .nav-item > .nav-link {
    display: flex;
    align-items: center;
    padding: 10px 16px;
    font-size: var(--text-base);
    font-weight: var(--font-semibold);
    color: var(--text-primary);
    text-decoration: none;
    border-radius: var(--radius-md);
    transition: var(--transition-colors);
    position: relative;
}

.nav-menu > .nav-item > .nav-link:hover {
    color: var(--brand-blue);
    background: rgba(0, 82, 204, 0.05);
}

.nav-menu > .nav-item.active > .nav-link {
    color: var(--brand-blue);
}

.nav-menu > .nav-item.active > .nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 16px;
    right: 16px;
    height: 3px;
    background: var(--gradient-primary);
    border-radius: var(--radius-full);
}

/* Dropdown Menus */
.nav-item.dropdown .dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 220px;
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 8px;
    margin-top: 8px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    z-index: var(--z-dropdown);
}

.nav-item.dropdown:hover .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-menu .dropdown-item {
    display: block;
    padding: 10px 16px;
    color: var(--text-primary);
    text-decoration: none;
    border-radius: var(--radius-md);
    transition: var(--transition-colors);
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
}

.dropdown-menu .dropdown-item:hover {
    background: rgba(0, 82, 204, 0.05);
    color: var(--brand-blue);
}

/* ==========================================
   HEADER ACTIONS
   ========================================== */

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

/* Monetize CTA Button */
.btn-monetize {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 24px;
    background: var(--gradient-primary);
    color: var(--white);
    font-size: var(--text-sm);
    font-weight: var(--font-semibold);
    border: none;
    border-radius: var(--radius-full);
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-blue);
    animation: pulse-subtle 3s ease-in-out infinite;
}

.btn-monetize:hover {
    background: var(--gradient-primary-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-blue-lg);
    color: var(--white);
    text-decoration: none;
}

.btn-monetize i {
    font-size: 16px;
}

@keyframes pulse-subtle {
    0%, 100% {
        box-shadow: var(--shadow-blue);
    }
    50% {
        box-shadow: 0 4px 24px rgba(0, 82, 204, 0.5);
    }
}

/* Search Toggle Button */
.btn-search {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: var(--light-bg);
    color: var(--text-secondary);
    border: none;
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: var(--transition-colors);
}

.btn-search:hover {
    background: rgba(0, 82, 204, 0.1);
    color: var(--brand-blue);
}

.btn-search i {
    font-size: 18px;
}

/* Login Button */
.btn-login {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: linear-gradient(135deg, #0052cc, #00c453);
    color: white;
    font-size: 14px;
    font-weight: 600;
    border-radius: 20px;
    text-decoration: none;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 82, 204, 0.3);
}

.btn-login:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 82, 204, 0.4);
    color: white;
    text-decoration: none;
}

.btn-login i {
    font-size: 14px;
}

/* User Menu */
.user-menu-wrapper {
    position: relative;
}

.user-menu-trigger {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 4px 12px 4px 4px;
    background: var(--light-bg);
    border: 1px solid rgba(0, 82, 204, 0.1);
    border-radius: 24px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.user-menu-trigger:hover {
    background: rgba(0, 82, 204, 0.05);
    border-color: rgba(0, 82, 204, 0.2);
}

.user-menu-trigger.active {
    background: rgba(0, 82, 204, 0.1);
    border-color: #0052cc;
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
}

.user-avatar-fallback {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #0052cc, #00c453);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 14px;
    font-weight: 700;
}

.user-menu-trigger i {
    font-size: 10px;
    color: var(--text-secondary);
    transition: transform 0.3s ease;
}

.user-menu-trigger.active i {
    transform: rotate(180deg);
}

.user-menu-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 260px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    z-index: 1000;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.user-menu-dropdown.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.user-menu-header {
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
    background: linear-gradient(135deg, rgba(0, 82, 204, 0.03), rgba(0, 196, 83, 0.03));
}

.user-menu-name {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.user-menu-email {
    font-size: 13px;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-menu-items {
    padding: 8px 0;
}

.user-menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: var(--text-primary);
    text-decoration: none;
    font-size: 14px;
    transition: all 0.2s ease;
}

.user-menu-item:hover {
    background: rgba(0, 82, 204, 0.05);
    color: #0052cc;
    text-decoration: none;
}

.user-menu-item i {
    width: 18px;
    font-size: 14px;
    color: var(--text-secondary);
}

.user-menu-item:hover i {
    color: #0052cc;
}

.user-menu-divider {
    height: 1px;
    background: var(--border-color);
    margin: 8px 0;
}

.user-menu-logout {
    color: #dc3545;
}

.user-menu-logout i {
    color: #dc3545;
}

.user-menu-logout:hover {
    background: rgba(220, 53, 69, 0.05);
    color: #dc3545;
}

/* Mobile Menu Toggle */
.mobile-menu-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    position: relative;
}

.hamburger {
    width: 24px;
    height: 18px;
    position: relative;
    transform: rotate(0deg);
    transition: 0.5s ease-in-out;
}

.hamburger span {
    display: block;
    position: absolute;
    height: 3px;
    width: 100%;
    background: var(--text-primary);
    border-radius: 3px;
    opacity: 1;
    left: 0;
    transform: rotate(0deg);
    transition: 0.25s ease-in-out;
}

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

.hamburger span:nth-child(2),
.hamburger span:nth-child(3) {
    top: 8px;
}

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

.mobile-menu-toggle.active .hamburger span:nth-child(1) {
    top: 8px;
    width: 0%;
    left: 50%;
}

.mobile-menu-toggle.active .hamburger span:nth-child(2) {
    transform: rotate(45deg);
}

.mobile-menu-toggle.active .hamburger span:nth-child(3) {
    transform: rotate(-45deg);
}

.mobile-menu-toggle.active .hamburger span:nth-child(4) {
    top: 8px;
    width: 0%;
    left: 50%;
}

/* ==========================================
   SOCIAL LINKS BAR
   ========================================== */

.social-links-bar {
    background: var(--gradient-dark);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding: 10px 0;
    max-height: 50px;
    opacity: 1;
    transition: all 0.3s ease;
}

.social-links-container {
    display: flex;
    align-items: center;
    gap: 15px;
}

.social-links-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 12px;
}

.social-links-list li a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-light);
    border-radius: var(--radius-full);
    font-size: 14px;
    transition: all 0.3s ease;
    text-decoration: none;
}

.social-links-list li a:hover {
    background: var(--gradient-primary);
    color: var(--white);
    transform: translateY(-2px);
}

.social-label {
    font-size: var(--text-sm);
    color: var(--text-light);
    font-weight: var(--font-medium);
}

/* ==========================================
   SEARCH DROPDOWN
   ========================================== */

.header-search-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    width: 400px;
    max-width: 90vw;
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    padding: 20px;
    margin-top: 12px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    z-index: var(--z-dropdown);
}

.header-search-dropdown.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.search-form-wrapper {
    position: relative;
}

.search-form-wrapper .search-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    font-size: 18px;
}

.search-form-wrapper input {
    width: 100%;
    padding: 14px 50px 14px 48px;
    border: 2px solid var(--light-border);
    border-radius: var(--radius-lg);
    font-size: var(--text-base);
    transition: var(--transition-colors);
    font-family: var(--font-primary);
}

.search-form-wrapper input:focus {
    outline: none;
    border-color: var(--brand-blue);
    box-shadow: 0 0 0 3px rgba(0, 82, 204, 0.1);
}

.search-form-wrapper button {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    padding: 8px 16px;
    background: var(--gradient-primary);
    color: var(--white);
    border: none;
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
    font-weight: var(--font-semibold);
    cursor: pointer;
    transition: var(--transition-colors);
}

.search-form-wrapper button:hover {
    background: var(--gradient-primary-hover);
}

/* ==========================================
   MOBILE MENU
   ========================================== */

.mobile-menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: var(--z-fixed);
}

.mobile-menu-overlay.active {
    opacity: 1;
    visibility: visible;
}

.mobile-menu {
    position: fixed;
    top: 0;
    right: -100%;
    width: 320px;
    max-width: 85vw;
    height: 100vh;
    background: var(--white);
    box-shadow: var(--shadow-2xl);
    overflow-y: auto;
    transition: right 0.3s ease;
    z-index: var(--z-fixed);
    display: flex;
    flex-direction: column;
}

.mobile-menu.active {
    right: 0;
}

.mobile-menu-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px;
    border-bottom: 1px solid var(--light-border);
}

.mobile-menu-logo {
    font-size: 24px;
    font-weight: var(--font-extrabold);
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.mobile-menu-close {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--light-bg);
    border: none;
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: var(--transition-colors);
}

.mobile-menu-close:hover {
    background: rgba(0, 82, 204, 0.1);
    color: var(--brand-blue);
}

/* Mobile Search */
.mobile-menu-search {
    padding: 20px;
    border-bottom: 1px solid var(--light-border);
}

.mobile-menu-search form {
    position: relative;
}

.mobile-menu-search input {
    width: 100%;
    padding: 12px 16px 12px 42px;
    border: 2px solid var(--light-border);
    border-radius: var(--radius-lg);
    font-size: var(--text-sm);
}

.mobile-menu-search input:focus {
    outline: none;
    border-color: var(--brand-blue);
}

.mobile-menu-search .search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
}

/* Mobile Navigation Links */
.mobile-menu-nav {
    flex: 1;
    padding: 8px;
}

.mobile-nav-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.mobile-nav-list .nav-item {
    margin-bottom: 4px;
}

.mobile-nav-list .nav-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    color: var(--text-primary);
    text-decoration: none;
    border-radius: var(--radius-md);
    font-weight: var(--font-medium);
    transition: var(--transition-colors);
}

.mobile-nav-list .nav-link:hover {
    background: rgba(0, 82, 204, 0.05);
    color: var(--brand-blue);
}

.mobile-nav-list .nav-link.active {
    background: rgba(0, 82, 204, 0.1);
    color: var(--brand-blue);
    font-weight: var(--font-semibold);
}

/* Mobile CTA */
.mobile-menu-cta {
    padding: 20px;
    border-top: 1px solid var(--light-border);
}

.mobile-menu-cta .btn-monetize {
    width: 100%;
    justify-content: center;
    padding: 14px 24px;
}

/* Mobile Social Links */
.mobile-menu-social {
    padding: 20px;
    border-top: 1px solid var(--light-border);
}

.mobile-social-title {
    font-size: var(--text-sm);
    font-weight: var(--font-semibold);
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.mobile-social-links {
    display: flex;
    gap: 12px;
}

.mobile-social-links a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    background: var(--light-bg);
    color: var(--text-secondary);
    border-radius: var(--radius-full);
    font-size: 18px;
    transition: all 0.3s ease;
    text-decoration: none;
}

.mobile-social-links a:hover {
    background: var(--gradient-primary);
    color: var(--white);
    transform: translateY(-2px);
}

/* ==========================================
   RESPONSIVE DESIGN
   ========================================== */

@media (max-width: 991px) {
    .header-nav {
        display: none;
    }

    .btn-monetize {
        display: none;
    }

    .mobile-menu-toggle {
        display: flex;
    }

    .header-wrapper {
        gap: 12px;
    }

    .social-links-bar {
        display: none;
    }

    .header-main {
        padding: 12px 0;
    }

    .header-logo img {
        max-height: 40px;
    }
}

@media (max-width: 767px) {
    .header-search-dropdown {
        width: calc(100vw - 40px);
        left: 50%;
        right: auto;
        transform: translateX(-50%) translateY(-10px);
    }

    .header-search-dropdown.active {
        transform: translateX(-50%) translateY(0);
    }

    .btn-search {
        width: 36px;
        height: 36px;
    }

    .btn-search i {
        font-size: 16px;
    }
}

@media (max-width: 575px) {
    .header-logo img {
        max-height: 35px;
    }

    .header-logo-text {
        font-size: 22px;
    }

    .mobile-menu {
        width: 100%;
        max-width: 100%;
    }
}

/* ==========================================
   PRINT STYLES
   ========================================== */

@media print {
    .modern-header {
        position: static;
        box-shadow: none;
        border-bottom: 1px solid #000;
    }

    .header-actions,
    .social-links-bar,
    .mobile-menu-toggle {
        display: none !important;
    }
}

/* ==========================================
   ACCESSIBILITY
   ========================================== */

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* Skip to main content */
.skip-to-main {
    position: absolute;
    left: -9999px;
    z-index: 999999;
    padding: 1em;
    background-color: var(--brand-blue);
    color: white;
    text-decoration: none;
}

.skip-to-main:focus {
    left: 50%;
    transform: translateX(-50%);
    top: 10px;
}
