/**
 * Tech Interface Header - Main Stylesheet
 * 
 * Uses namespace isolation to prevent conflicts with theme styles
 */

/* Base wrapper and isolation */
.techhdr-wrapper {
    /* Reset everything to prevent theme inheritance issues */
    all: initial;
    box-sizing: border-box;
    display: block;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    
    /* Core variables - populated via JavaScript */
    --techhdr-color: #22c55e;
    --techhdr-color-rgb: 34, 197, 94;
    --techhdr-bg-opacity: 0.1;
    --techhdr-hover-bg-opacity: 0.2;
    --techhdr-height: 70px;
    --techhdr-mobile-height: 60px;
    --techhdr-z-index: 9999;
    --techhdr-blur-strength: 8px;
    --techhdr-font-size: 14px;
    --techhdr-position: fixed;
}

/* Main container */
.techhdr-wrapper#tech-header-container {
    position: var(--techhdr-position, fixed);
    top: 0;
    left: 0;
    right: 0;
    height: var(--techhdr-height);
    z-index: var(--techhdr-z-index);
    width: 100%;
    max-width: 100%;
    transition: transform 0.3s ease-in-out, opacity 0.3s ease-in-out;
}

/* Hidden state (for sticky/scrolling) */
.techhdr-wrapper#tech-header-container.techhdr-hidden {
    transform: translateY(-100%);
}

/* Blur effect background */
.techhdr-wrapper#tech-header-container.techhdr-with-blur .techhdr-container::before {
    content: "";
    position: absolute;
    inset: 0;
    backdrop-filter: blur(var(--techhdr-blur-strength));
    -webkit-backdrop-filter: blur(var(--techhdr-blur-strength));
    background-color: rgba(0, 0, 0, 0.3);
    z-index: -1;
}

/* Inner container */
.techhdr-wrapper .techhdr-container {
    position: relative;
    height: 100%;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    background-color: rgba(10, 10, 20, 0.7);
    border-bottom: 1px solid rgba(var(--techhdr-color-rgb), 0.3);
}

/* Bottom border gradient */
.techhdr-wrapper .techhdr-container::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(var(--techhdr-color-rgb), 0.7) 20%,
        rgba(var(--techhdr-color-rgb), 0.7) 80%,
        transparent 100%
    );
    z-index: 1;
}

/* Global scan line animation */
.techhdr-wrapper .techhdr-global-scan-line {
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    width: 100%;
    opacity: 0;
    pointer-events: none;
    background: linear-gradient(
        to right,
        transparent 0%,
        rgba(var(--techhdr-color-rgb), 0.15) 50%,
        transparent 100%
    );
    z-index: 2; /* Ensure it's visible above other elements */
}

.techhdr-wrapper .techhdr-global-scan-line.techhdr-scanning {
    opacity: 1;
    animation: techhdr-global-scan 4s ease-in-out;
}

/* Logo styling */
.techhdr-wrapper .techhdr-logo {
    position: relative;
    height: 40px;
    display: flex;
    align-items: center;
    padding: 0 20px;
    background-color: rgba(var(--techhdr-color-rgb), var(--techhdr-bg-opacity));
    color: var(--techhdr-color);
    border-left: 1px solid rgba(var(--techhdr-color-rgb), 0.7);
    border-right: 1px solid rgba(var(--techhdr-color-rgb), 0.7);
    overflow: hidden;
    transition: all 0.3s ease-in-out;
    cursor: pointer;
    text-decoration: none;
}

.techhdr-wrapper .techhdr-logo:hover {
    background-color: rgba(var(--techhdr-color-rgb), var(--techhdr-hover-bg-opacity));
    box-shadow: 0 0 10px rgba(var(--techhdr-color-rgb), 0.4);
}

/* Logo corners */
.techhdr-wrapper .techhdr-logo .techhdr-corner {
    position: absolute;
    width: 8px;
    height: 8px;
    border-color: rgba(var(--techhdr-color-rgb), 0.7);
    pointer-events: none;
}

.techhdr-wrapper .techhdr-logo .techhdr-corner-tl {
    top: 0;
    left: 0;
    border-top: 1px solid;
    border-left: 1px solid;
}

.techhdr-wrapper .techhdr-logo .techhdr-corner-tr {
    top: 0;
    right: 0;
    border-top: 1px solid;
    border-right: 1px solid;
}

.techhdr-wrapper .techhdr-logo .techhdr-corner-bl {
    bottom: 0;
    left: 0;
    border-bottom: 1px solid;
    border-left: 1px solid;
}

.techhdr-wrapper .techhdr-logo .techhdr-corner-br {
    bottom: 0;
    right: 0;
    border-bottom: 1px solid;
    border-right: 1px solid;
}

/* Logo text */
.techhdr-wrapper .techhdr-logo .techhdr-logo-text {
    font-family: monospace;
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
}

/* Logo image */
.techhdr-wrapper .techhdr-logo .techhdr-logo-img {
    height: 30px;
    width: auto;
    object-fit: contain;
}

/* System status indicator */
.techhdr-wrapper .techhdr-logo .techhdr-system-status {
    display: flex;
    align-items: center;
    margin-left: 10px;
    font-size: 10px;
    opacity: 0.8;
}

.techhdr-wrapper .techhdr-logo .techhdr-system-status .techhdr-status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: var(--techhdr-color);
    margin-right: 6px;
    animation: techhdr-pulse 2s infinite;
}

.techhdr-wrapper .techhdr-logo .techhdr-system-status .techhdr-status-text {
    font-family: monospace;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Logo scan line animation */
.techhdr-wrapper .techhdr-logo .techhdr-scan-line {
    position: absolute;
    top: 0;
    height: 100%;
    width: 100%;
    left: 0;
    background: linear-gradient(
        to bottom,
        transparent 0%,
        rgba(var(--techhdr-color-rgb), 0.2) 50%,
        transparent 100%
    );
    background-size: 100% 4px;
    opacity: 0;
    z-index: 1;
    pointer-events: none;
}

.techhdr-wrapper .techhdr-logo:hover .techhdr-scan-line {
    opacity: 1;
    animation: techhdr-scan-line 1.5s linear infinite;
}

/* Navigation menu */
.techhdr-wrapper .techhdr-menu {
    display: flex;
    align-items: center;
    height: 100%;
    justify-content: center; /* Default alignment, overridden by JS */
}

/* Mobile menu container */
.techhdr-wrapper .techhdr-menu-container {
    position: fixed;
    top: var(--techhdr-height);
    left: 0;
    right: 0;
    background-color: rgba(10, 10, 20, 0.9);
    border-bottom: 1px solid rgba(var(--techhdr-color-rgb), 0.3);
    transform: translateY(-100%);
    opacity: 0;
    transition: transform 0.3s ease, opacity 0.3s ease;
    z-index: calc(var(--techhdr-z-index) - 1);
    max-height: calc(100vh - var(--techhdr-height));
    overflow-y: auto;
}

.techhdr-wrapper .techhdr-menu-container.techhdr-open {
    transform: translateY(0);
    opacity: 1;
}

.techhdr-wrapper .techhdr-menu-container.techhdr-with-blur {
    backdrop-filter: blur(var(--techhdr-blur-strength));
    -webkit-backdrop-filter: blur(var(--techhdr-blur-strength));
}

/* Menu items */
.techhdr-wrapper .techhdr-menu-item {
    position: relative;
    display: flex;
    align-items: center;
    height: 100%;
    padding: 0 15px;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    font-size: var(--techhdr-font-size);
    transition: color 0.3s ease;
}

/* Menu item underline animation */
.techhdr-wrapper .techhdr-menu-item::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 2px;
    background-color: var(--techhdr-color);
    transition: width 0.3s ease, left 0.3s ease;
}

.techhdr-wrapper .techhdr-menu-item:hover {
    color: var(--techhdr-color);
}

.techhdr-wrapper .techhdr-menu-item:hover::after {
    width: 100%;
    left: 0;
}

/* Active menu item */
.techhdr-wrapper .techhdr-menu-item.techhdr-active {
    color: var(--techhdr-color);
}

.techhdr-wrapper .techhdr-menu-item.techhdr-active::after {
    width: 100%;
    left: 0;
}

/* Menu text */
.techhdr-wrapper .techhdr-menu-item .techhdr-menu-text {
    position: relative;
}

/* Menu arrow for submenus */
.techhdr-wrapper .techhdr-menu-item .techhdr-menu-arrow {
    margin-left: 5px;
    width: 10px;
    height: 10px;
    transition: transform 0.3s ease;
}

.techhdr-wrapper .techhdr-menu-item .techhdr-menu-arrow.techhdr-open {
    transform: rotate(180deg);
}

/* Submenu */
.techhdr-wrapper .techhdr-menu-item .techhdr-submenu {
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 200px;
    background-color: rgba(10, 10, 20, 0.9);
    border: 1px solid rgba(var(--techhdr-color-rgb), 0.3);
    border-top: none;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s;
    z-index: var(--techhdr-z-index);
}

.techhdr-wrapper .techhdr-menu-item .techhdr-submenu.techhdr-with-blur {
    backdrop-filter: blur(var(--techhdr-blur-strength));
    -webkit-backdrop-filter: blur(var(--techhdr-blur-strength));
}

.techhdr-wrapper .techhdr-menu-item .techhdr-submenu.techhdr-open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* Submenu items */
.techhdr-wrapper .techhdr-menu-item .techhdr-submenu .techhdr-submenu-item {
    display: block;
    padding: 10px 15px;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    font-size: var(--techhdr-font-size);
    border-bottom: 1px solid rgba(var(--techhdr-color-rgb), 0.1);
    transition: background-color 0.3s ease, color 0.3s ease;
}

.techhdr-wrapper .techhdr-menu-item .techhdr-submenu .techhdr-submenu-item:hover {
    background-color: rgba(var(--techhdr-color-rgb), 0.1);
    color: var(--techhdr-color);
}

.techhdr-wrapper .techhdr-menu-item .techhdr-submenu .techhdr-submenu-item:last-child {
    border-bottom: none;
}

/* Mobile menu toggle button */
.techhdr-wrapper .techhdr-menu-toggle {
    display: none;
    flex-direction: column;
    justify-content: space-between;
    width: 24px;
    height: 20px;
    cursor: pointer;
}

.techhdr-wrapper .techhdr-menu-toggle span {
    display: block;
    height: 2px;
    width: 100%;
    background-color: var(--techhdr-color);
    transition: all 0.3s ease;
}

/* Hamburger to X animation */
.techhdr-wrapper .techhdr-menu-toggle.techhdr-open span:nth-child(1) {
    transform: translateY(9px) rotate(45deg);
}

.techhdr-wrapper .techhdr-menu-toggle.techhdr-open span:nth-child(2) {
    opacity: 0;
}

.techhdr-wrapper .techhdr-menu-toggle.techhdr-open span:nth-child(3) {
    transform: translateY(-9px) rotate(-45deg);
}

/* Right side actions */
.techhdr-wrapper .techhdr-actions {
    display: flex;
    align-items: center;
    height: 100%;
}

/* Search */
.techhdr-wrapper .techhdr-search {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    margin-left: 10px;
    cursor: pointer;
}

.techhdr-wrapper .techhdr-search-icon {
    width: 20px;
    height: 20px;
    color: rgba(255, 255, 255, 0.8);
    transition: color 0.3s ease;
}

.techhdr-wrapper .techhdr-search-icon svg {
    width: 100%;
    height: 100%;
}

.techhdr-wrapper .techhdr-search-icon:hover {
    color: var(--techhdr-color);
}

/* Search expandable container */
.techhdr-wrapper .techhdr-search-container {
    position: absolute;
    top: 100%;
    right: 0;
    width: 0;
    max-width: 300px;
    background-color: rgba(10, 10, 20, 0.9);
    border: 1px solid rgba(var(--techhdr-color-rgb), 0.3);
    border-top: none;
    overflow: hidden;
    transition: width 0.3s ease, opacity 0.3s ease;
    opacity: 0;
    z-index: var(--techhdr-z-index);
}

.techhdr-wrapper .techhdr-search-container.techhdr-open {
    width: 100%;
    opacity: 1;
}

.techhdr-wrapper .techhdr-search-container.techhdr-with-blur {
    backdrop-filter: blur(var(--techhdr-blur-strength));
    -webkit-backdrop-filter: blur(var(--techhdr-blur-strength));
}

/* Search form */
.techhdr-wrapper .techhdr-search-container form {
    display: flex;
    width: 100%;
}

.techhdr-wrapper .techhdr-search-container input {
    flex: 1;
    height: 40px;
    padding: 0 15px;
    background-color: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.9);
    font-family: inherit;
}

.techhdr-wrapper .techhdr-search-container input:focus {
    outline: none;
}

.techhdr-wrapper .techhdr-search-container input::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

.techhdr-wrapper .techhdr-search-container button {
    width: 40px;
    height: 40px;
    background-color: rgba(var(--techhdr-color-rgb), 0.3);
    border: none;
    color: var(--techhdr-color);
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.techhdr-wrapper .techhdr-search-container button:hover {
    background-color: rgba(var(--techhdr-color-rgb), 0.5);
}

.techhdr-wrapper .techhdr-search-container button svg {
    width: 16px;
    height: 16px;
}

/* System data stats */
.techhdr-wrapper .techhdr-data-stats {
    display: flex;
    align-items: center;
    margin-left: 15px;
    font-family: monospace;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.7);
}

.techhdr-wrapper .techhdr-data-stats-item {
    display: flex;
    align-items: center;
    margin-right: 15px;
}

.techhdr-wrapper .techhdr-data-stats-item:last-child {
    margin-right: 0;
}

.techhdr-wrapper .techhdr-data-stats-item .techhdr-stat-label {
    margin-right: 5px;
    color: var(--techhdr-color);
    opacity: 0.8;
}

.techhdr-wrapper .techhdr-data-stats-item .techhdr-stat-value {
    letter-spacing: 1px;
}

/* Ripple effect */
.techhdr-wrapper .techhdr-ripple {
    position: absolute;
    border-radius: 50%;
    transform: scale(0) translateZ(0);
    animation: techhdr-ripple-effect 0.6s linear;
    pointer-events: none;
    z-index: 1;
}

/* Mobile styles */
@media (max-width: 768px) {
    .techhdr-wrapper#tech-header-container {
        height: var(--techhdr-mobile-height);
    }
    
    .techhdr-wrapper .techhdr-menu {
        display: none;
    }
    
    .techhdr-wrapper .techhdr-menu-toggle {
        display: flex;
    }
    
    .techhdr-wrapper .techhdr-data-stats {
        display: none;
    }
    
    .techhdr-wrapper .techhdr-menu-container {
        display: flex;
        flex-direction: column;
        padding: 15px;
    }
    
    .techhdr-wrapper .techhdr-menu-container .techhdr-menu-item {
        height: auto;
        padding: 0;
        width: 100%;
    }
    
    .techhdr-wrapper .techhdr-menu-container .techhdr-menu-item .techhdr-menu-text {
        padding: 15px 0;
        font-size: 16px;
        border-bottom: 1px solid rgba(var(--techhdr-color-rgb), 0.1);
        width: 100%;
    }
    
    .techhdr-wrapper .techhdr-menu-container .techhdr-submenu {
        position: relative;
        width: 100%;
        opacity: 1;
        visibility: visible;
        transform: none;
        border: none;
        background-color: transparent;
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease;
    }
    
    .techhdr-wrapper .techhdr-menu-container .techhdr-submenu.techhdr-open {
        max-height: 500px;
    }
    
    .techhdr-wrapper .techhdr-menu-container .techhdr-submenu-item {
        padding-left: 30px;
    }
    
    .techhdr-wrapper .techhdr-logo {
        height: 36px;
        padding: 0 15px;
    }
    
    .techhdr-wrapper .techhdr-logo .techhdr-logo-text {
        font-size: 16px;
    }
    
    .techhdr-wrapper .techhdr-logo .techhdr-logo-img {
        height: 24px;
    }
}

/* Admin bar compatibility */
body.admin-bar .techhdr-wrapper#tech-header-container {
    top: 32px;
}

@media screen and (max-width: 782px) {
    body.admin-bar .techhdr-wrapper#tech-header-container {
        top: 46px;
    }
}

/* Animations */
@keyframes techhdr-scan-line {
    0% {
        transform: translateY(-100%);
    }
    100% {
        transform: translateY(100%);
    }
}

@keyframes techhdr-global-scan {
    0% {
        transform: translateX(-100%);
        opacity: 0;
    }
    20% {
        opacity: 1;
    }
    80% {
        opacity: 1;
    }
    100% {
        transform: translateX(100%);
        opacity: 0;
    }
}

@keyframes techhdr-pulse {
    0% {
        opacity: 0.6;
        transform: scale(0.8);
    }
    50% {
        opacity: 1;
        transform: scale(1);
    }
    100% {
        opacity: 0.6;
        transform: scale(0.8);
    }
}

@keyframes techhdr-ripple-effect {
    to {
        transform: scale(20) translateZ(0);
        opacity: 0;
    }
}

/* Shortcode specific styles */
.techhdr-shortcode {
    position: relative !important;
    margin: 20px 0 !important;
    top: auto !important;
    left: auto !important;
    right: auto !important;
}

.techhdr-shortcode .techhdr-menu-container {
    position: absolute !important;
}
