/**
 * TermuxAPK Header Styles
 * Modern, responsive header styling
 *
 * @package GeneratePress_Child
 * @subpackage Header
 * @since 1.0.0
 */

/* ==========================================================================
   Hide GeneratePress Default Elements
   ========================================================================== */

/* Hide default GeneratePress header and navigation */
.site-header,
.main-navigation,
.mobile-menu-control-wrapper,
.menu-toggle,
#generate-slideout-menu,
.slideout-overlay {
    display: none !important;
}

/* Hide any remaining GeneratePress mobile elements */
.generate-navigation,
.generate-mobile-menu,
.mobile-bar-items {
    display: none !important;
}

/* ==========================================================================
   Header Base Styles
   ========================================================================== */

.termuxapk-header {
    background-color: #ffffff;
    color: #333333;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 16px;
    font-weight: 500;
    position: relative;
    z-index: 999;
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.08);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.header-sticky {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 9999;
}

.header-sticky.scrolled {
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.12);
    backdrop-filter: blur(20px);
}

.header-transparent {
    background-color: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(15px);
}

/* ==========================================================================
   Header Layout
   ========================================================================== */

.termuxapk-header-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 30px;
}

.header-full-width .termuxapk-header-container {
    max-width: 100%;
    padding: 0 50px;
}

.termuxapk-header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 80px;
    gap: 30px;
}

.header-section {
    display: flex;
    align-items: center;
}

.header-logo {
    flex-shrink: 0;
}

.header-navigation {
    flex: 1;
    justify-content: center;
}

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

/* ==========================================================================
   Logo Styles
   ========================================================================== */

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

.termuxapk-logo-link {
    display: flex;
    align-items: center;
    text-decoration: none;
    color: inherit;
    transition: all 0.3s ease;
    border-radius: 8px;
    padding: 8px;
    margin: -8px;
}

.termuxapk-logo-link:hover {
    transform: translateY(-1px);
    opacity: 0.9;
}

.termuxapk-logo-img {
    max-width: 200px;
    height: auto;
    display: block;
    transition: transform 0.3s ease;
}

.termuxapk-logo-text {
    display: flex;
    flex-direction: column;
    margin-left: 12px;
}

.site-title {
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1.2;
    color: #1a1a1a;
    background: linear-gradient(135deg, #007cba 0%, #005a87 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.site-tagline {
    font-size: 0.875rem;
    color: #666;
    margin-top: 2px;
    font-weight: 400;
}

/* ==========================================================================
   Navigation Styles
   ========================================================================== */

.termuxapk-primary-nav {
    display: flex;
    align-items: center;
}

.termuxapk-nav-menu {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    gap: 8px;
}

.termuxapk-nav-menu li {
    position: relative;
}

.termuxapk-nav-menu a {
    display: flex;
    align-items: center;
    padding: 12px 18px;
    text-decoration: none;
    color: #333;
    font-weight: 500;
    border-radius: 8px;
    transition: all 0.3s ease;
    position: relative;
}

.termuxapk-nav-menu a:hover,
.termuxapk-nav-menu .current-menu-item > a {
    color: #007cba;
    background-color: rgba(0, 124, 186, 0.08);
}

.dropdown-arrow {
    margin-left: 6px;
    font-size: 0.75rem;
    transition: transform 0.3s ease;
}

.has-dropdown:hover .dropdown-arrow {
    transform: rotate(180deg);
}

/* Dropdown Menus */
.sub-menu {
    position: absolute;
    top: 100%;
    left: 0;
    background: #ffffff;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    border-radius: 12px;
    padding: 8px;
    min-width: 220px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1000;
    border: 1px solid rgba(0, 0, 0, 0.08);
}

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

.sub-menu a {
    padding: 10px 14px;
    border-radius: 6px;
    font-size: 0.95rem;
}

/* ==========================================================================
   Download Button Styles
   ========================================================================== */

.termuxapk-download-container {
    display: flex;
    align-items: center;
}

.termuxapk-download-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 18px;
    text-decoration: none;
    border-radius: 6px;
    font-weight: 500;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    border: 1px solid transparent;
    white-space: nowrap;
    letter-spacing: 0.01em;
    position: relative;
    overflow: hidden;
}

.termuxapk-download-btn svg {
    width: 14px;
    height: 14px;
    stroke-width: 2.5;
}

/* Primary download button style */
.download-primary {
    background: #007cba;
    color: #ffffff;
    border-color: #007cba;
}

.download-primary:hover {
    background: #005a87;
    border-color: #005a87;
    color: #ffffff;
}

.download-primary:active {
    background: #004a73;
    border-color: #004a73;
}

/* Secondary download button style */
.download-secondary {
    background: #f8fafc;
    color: #007cba;
    border-color: #e2e8f0;
}

.download-secondary:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
    color: #005a87;
}

.download-secondary:active {
    background: #e2e8f0;
    border-color: #94a3b8;
}

/* Outline download button style */
.download-outline {
    background: transparent;
    color: #007cba;
    border-color: #007cba;
}

.download-outline:hover {
    background: rgba(0, 124, 186, 0.05);
    border-color: #005a87;
    color: #005a87;
}

.download-outline:active {
    background: rgba(0, 124, 186, 0.1);
    border-color: #004a73;
    color: #004a73;
}

/* Mobile download button in menu */
.mobile-download-section {
    padding: 16px 0;
    border-top: 1px solid #e2e8f0;
    margin-top: 16px;
}

.mobile-download-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 12px 20px;
    background: #007cba;
    color: #ffffff;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 500;
    font-size: 0.95rem;
    transition: all 0.2s ease;
    border: 1px solid #007cba;
    letter-spacing: 0.01em;
}

.mobile-download-btn:hover {
    background: #005a87;
    border-color: #005a87;
    color: #ffffff;
}

.mobile-download-btn:active {
    background: #004a73;
    border-color: #004a73;
}

.mobile-download-btn svg {
    flex-shrink: 0;
    width: 16px;
    height: 16px;
    stroke-width: 2.5;
}

/* Responsive styles for download buttons */
@media (max-width: 768px) {
    .termuxapk-download-btn {
        padding: 8px 14px;
        font-size: 0.85rem;
        gap: 5px;
    }

    .termuxapk-download-btn svg {
        width: 12px;
        height: 12px;
    }
}

@media (max-width: 480px) {
    .termuxapk-download-container {
        margin-left: 8px;
    }

    .termuxapk-download-btn {
        padding: 7px 12px;
        font-size: 0.8rem;
        border-radius: 5px;
    }

    .mobile-download-btn {
        padding: 10px 16px;
        font-size: 0.9rem;
        border-radius: 6px;
    }
}



/* ==========================================================================
   Mobile Navigation
   ========================================================================== */

.termuxapk-mobile-toggle {
    display: none;
    flex-direction: column;
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.3s ease;
    gap: 4px;
}

.hamburger-line {
    width: 24px;
    height: 2px;
    background-color: #333;
    transition: all 0.3s ease;
    border-radius: 2px;
}

.termuxapk-mobile-toggle:hover {
    background-color: rgba(0, 124, 186, 0.08);
}

.termuxapk-mobile-toggle[aria-expanded="true"] .hamburger-line:nth-child(1) {
    transform: rotate(45deg) translate(6px, 6px);
}

.termuxapk-mobile-toggle[aria-expanded="true"] .hamburger-line:nth-child(2) {
    opacity: 0;
}

.termuxapk-mobile-toggle[aria-expanded="true"] .hamburger-line:nth-child(3) {
    transform: rotate(-45deg) translate(6px, -6px);
}

/* Mobile Navigation - Completely rewritten for reliability */
.termuxapk-mobile-nav {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 99999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.termuxapk-mobile-nav.active {
    opacity: 1;
    visibility: visible;
}

.mobile-nav-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
}

.mobile-nav-content {
    position: absolute;
    top: 0;
    right: 0;
    width: 320px;
    max-width: 85vw;
    height: 100%;
    background: #ffffff;
    padding: 20px;
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-y: auto;
    box-shadow: -5px 0 20px rgba(0, 0, 0, 0.1);
}

.termuxapk-mobile-nav.active .mobile-nav-content {
    transform: translateX(0);
}

.mobile-nav-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 20px;
    border-bottom: 1px solid #e1e5e9;
    margin-bottom: 20px;
}

.mobile-logo .site-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #333;
}

.mobile-nav-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    padding: 5px;
    color: #666;
}

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

.mobile-nav-menu li {
    margin-bottom: 5px;
}

.mobile-nav-menu a {
    display: block;
    padding: 15px 0;
    text-decoration: none;
    color: #333;
    font-weight: 500;
    border-bottom: 1px solid #f0f0f0;
    transition: color 0.3s ease;
}

.mobile-nav-menu a:hover {
    color: #007cba;
}

/* Prevent body scroll when mobile menu is open */
body.mobile-nav-open {
    overflow: hidden;
}

/* Add top spacing for sticky header */
body.has-sticky-header {
    padding-top: 70px;
}

@media (max-width: 768px) {
    body.has-sticky-header {
        padding-top: 70px;
    }
}

@media (max-width: 480px) {
    body.has-sticky-header {
        padding-top: 40px;
    }
}

/* ==========================================================================
   Responsive Design
   ========================================================================== */

@media (max-width: 768px) {
    .termuxapk-header-container {
        padding: 0 20px;
    }
    
    .header-full-width .termuxapk-header-container {
        padding: 0 25px;
    }
    
    .termuxapk-header-content {
        min-height: 70px;
        gap: 15px;
    }
    
    .header-navigation {
        display: none;
    }
    
    .termuxapk-mobile-toggle {
        display: flex;
    }

    .termuxapk-download-btn {
        padding: 10px 16px;
        font-size: 0.9rem;
    }

    .termuxapk-download-btn span {
        display: none;
    }

    .download-desktop {
        display: none;
    }
    
    .termuxapk-logo-img {
        max-width: 150px;
    }
    
    .site-title {
        font-size: 1.4rem;
    }
    
    .termuxapk-logo-text {
        margin-left: 10px;
    }
}

@media (max-width: 480px) {
    .termuxapk-header-container {
        padding: 0 15px;
    }

    .termuxapk-header-content {
        min-height: 60px;
        gap: 10px;
    }

    .site-title {
        font-size: 1.25rem;
    }

    .termuxapk-download-btn {
        padding: 8px 12px;
    }
}

/* ==========================================================================
   Accessibility & Screen Readers
   ========================================================================== */

.screen-reader-text {
    position: absolute !important;
    clip: rect(1px, 1px, 1px, 1px);
    width: 1px !important;
    height: 1px !important;
    overflow: hidden;
}

/* Focus styles for keyboard navigation */
.termuxapk-nav-menu a:focus,
.termuxapk-mobile-toggle:focus {
    outline: 2px solid #007cba;
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .termuxapk-header {
        border-bottom: 2px solid #000;
    }
    
    .termuxapk-nav-menu a:hover {
        background-color: #000;
        color: #fff;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .termuxapk-header,
    .termuxapk-logo-link,
    .termuxapk-nav-menu a,
    .search-form-container,
    .termuxapk-mobile-nav,
    .mobile-nav-content {
        transition: none;
    }
}
