/**
 * EngineeringSheets Shared Components CSS
 * CDN: https://cdn.engineeringsheet.com/css/shared.css
 *
 * Includes: Header, Navigation, Footer, and Base Styles
 * All classes prefixed with 'es-' to avoid conflicts
 */

/* ========================================
   CSS Variables
   ======================================== */
:root {
    /* Colors */
    --es-primary: #00D4FF;
    --es-primary-dark: #00A8CC;
    --es-primary-light: #33DDFF;
    --es-primary-glow: rgba(0, 212, 255, 0.3);

    --es-bg-dark: #0a0e14;
    --es-bg-card: #12181f;
    --es-bg-card-hover: #1a222d;
    --es-bg-input: #1a222d;

    --es-text-white: #ffffff;
    --es-text-light: #e0e0e0;
    --es-text-muted: #8899a6;
    --es-text-dim: #5c6b7a;

    --es-border-color: #2a3441;
    --es-border-light: #3a4451;

    --es-success: #00c853;
    --es-warning: #ffc107;
    --es-error: #ff5252;
    --es-sale: #ff4757;

    /* Typography */
    --es-font-body: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    --es-font-mono: 'JetBrains Mono', 'Fira Code', monospace;

    /* Spacing */
    --es-container-max: 1400px;
    --es-nav-height: 70px;

    /* Transitions */
    --es-transition-fast: 0.15s ease;
    --es-transition-normal: 0.3s ease;

    /* Shadows */
    --es-shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --es-shadow-md: 0 4px 20px rgba(0, 0, 0, 0.4);
    --es-shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.5);
    --es-shadow-glow: 0 0 30px var(--es-primary-glow);
}

/* ========================================
   Top Banner
   ======================================== */
.es-top-banner {
    background: linear-gradient(90deg, var(--es-primary-dark), var(--es-primary), var(--es-primary-dark));
    color: var(--es-bg-dark);
    text-align: center;
    padding: 12px 20px;
    font-size: 0.9rem;
    font-weight: 600;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1001;
    font-family: var(--es-font-body);
}

.es-top-banner code {
    background: rgba(0, 0, 0, 0.2);
    padding: 3px 8px;
    border-radius: 4px;
    font-family: var(--es-font-mono);
    font-weight: 700;
}

.es-banner-icon {
    margin-right: 4px;
}

/* ========================================
   Navigation
   ======================================== */
.es-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: rgba(10, 14, 20, 0.95);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--es-border-color);
    transition: all var(--es-transition-normal);
    font-family: var(--es-font-body);
}

.es-nav.has-banner {
    top: 44px;
}

.es-nav-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--es-nav-height);
    max-width: var(--es-container-max);
    margin: 0 auto;
    padding: 0 20px;
}

/* Logo */
.es-nav-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--es-text-white);
    text-decoration: none;
}

.es-nav-logo:hover {
    color: var(--es-text-white);
}

.es-nav-logo .es-sigma,
.es-sigma {
    font-size: 2rem;
    color: var(--es-primary);
    font-family: var(--es-font-mono);
}

/* Main Menu */
.es-nav-menu {
    display: flex;
    align-items: center;
    gap: 8px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.es-nav-item {
    position: relative;
}

.es-nav-link {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 12px 16px;
    color: var(--es-text-light);
    font-weight: 500;
    font-size: 0.95rem;
    transition: color var(--es-transition-fast);
    cursor: pointer;
    text-decoration: none;
}

.es-nav-link:hover {
    color: var(--es-primary);
}

.es-nav-link svg {
    width: 16px;
    height: 16px;
    transition: transform var(--es-transition-fast);
}

.es-nav-item:hover .es-nav-link svg,
.es-nav-item.active .es-nav-link svg {
    transform: rotate(180deg);
}

/* Navigation Actions */
.es-nav-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.es-nav-action {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 8px;
    color: var(--es-text-light);
    transition: all var(--es-transition-fast);
    cursor: pointer;
    background: transparent;
    border: none;
    text-decoration: none;
}

.es-nav-action:hover {
    background: var(--es-bg-card);
    color: var(--es-primary);
}

.es-nav-action svg {
    width: 22px;
    height: 22px;
}

/* Cart Badge */
.es-cart-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    background: var(--es-primary);
    color: var(--es-bg-dark);
    font-size: 0.7rem;
    font-weight: 700;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.es-cart-badge:empty,
.es-cart-badge[data-count="0"] {
    display: none;
}

/* Mega Menu */
.es-mega-menu {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--es-bg-card);
    border: 1px solid var(--es-border-color);
    border-radius: 12px;
    box-shadow: var(--es-shadow-lg);
    padding: 24px;
    opacity: 0;
    visibility: hidden;
    transition: all var(--es-transition-normal);
    min-width: 200px;
}

.es-mega-menu.es-mega-menu-wide {
    min-width: 800px;
    left: 0;
    transform: none;
}

.es-nav-item:hover .es-mega-menu,
.es-nav-item.active .es-mega-menu {
    opacity: 1;
    visibility: visible;
}

/* Mega Menu Columns */
.es-mega-menu-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 32px;
}

.es-mega-menu-column h4 {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--es-primary);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--es-border-color);
}

.es-mega-menu-column ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.es-mega-menu-column li {
    margin-bottom: 8px;
}

.es-mega-menu-column a {
    display: block;
    padding: 6px 0;
    color: var(--es-text-light);
    font-size: 0.9rem;
    transition: all var(--es-transition-fast);
    text-decoration: none;
}

.es-mega-menu-column a:hover {
    color: var(--es-primary);
    padding-left: 8px;
}

/* Dropdown Menu (Simple) */
.es-dropdown-menu {
    list-style: none;
    min-width: 220px;
    margin: 0;
    padding: 0;
}

.es-dropdown-menu li {
    margin-bottom: 4px;
}

.es-dropdown-menu a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    color: var(--es-text-light);
    font-size: 0.9rem;
    border-radius: 6px;
    transition: all var(--es-transition-fast);
    text-decoration: none;
}

.es-dropdown-menu a:hover {
    background: var(--es-bg-dark);
    color: var(--es-primary);
}

/* Badge */
.es-badge {
    display: inline-block;
    padding: 2px 8px;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    border-radius: 4px;
    letter-spacing: 0.5px;
}

.es-badge-sale {
    background: var(--es-sale);
    color: white;
}

/* Mobile Menu Toggle */
.es-nav-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 44px;
    height: 44px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 10px;
}

.es-nav-toggle span {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--es-text-light);
    transition: all var(--es-transition-fast);
}

.es-nav-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.es-nav-toggle.active span:nth-child(2) {
    opacity: 0;
}

.es-nav-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
}

/* ========================================
   Search Overlay
   ======================================== */
.es-search-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(10, 14, 20, 0.95);
    z-index: 1100;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 100px;
    opacity: 0;
    visibility: hidden;
    transition: all var(--es-transition-normal);
}

.es-search-overlay.active {
    opacity: 1;
    visibility: visible;
}

.es-search-container {
    width: 100%;
    max-width: 600px;
    padding: 0 20px;
}

.es-search-input-wrapper {
    position: relative;
}

.es-search-input {
    width: 100%;
    padding: 20px 24px 20px 56px;
    font-size: 1.25rem;
    font-family: var(--es-font-body);
    background: var(--es-bg-card);
    border: 2px solid var(--es-border-color);
    border-radius: 12px;
    color: var(--es-text-white);
}

.es-search-input:focus {
    outline: none;
    border-color: var(--es-primary);
}

.es-search-input::placeholder {
    color: var(--es-text-muted);
}

.es-search-icon {
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--es-text-muted);
}

.es-search-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--es-bg-card);
    border: 1px solid var(--es-border-color);
    border-radius: 8px;
    color: var(--es-text-light);
    cursor: pointer;
    transition: all var(--es-transition-fast);
}

.es-search-close:hover {
    background: var(--es-bg-card-hover);
    color: var(--es-primary);
}

/* ========================================
   Footer
   ======================================== */
.es-footer {
    background: var(--es-bg-card);
    border-top: 1px solid var(--es-border-color);
    padding: 60px 0 30px;
    margin-top: 80px;
    font-family: var(--es-font-body);
}

.es-container {
    width: 100%;
    max-width: var(--es-container-max);
    margin: 0 auto;
    padding: 0 20px;
}

.es-footer-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: 48px;
    margin-bottom: 48px;
}

.es-footer-brand {
    max-width: 320px;
}

.es-footer-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--es-text-white);
    margin-bottom: 16px;
    text-decoration: none;
}

.es-footer-logo:hover {
    color: var(--es-text-white);
}

.es-footer-logo .es-sigma {
    font-size: 1.5rem;
    color: var(--es-primary);
    font-family: var(--es-font-mono);
}

.es-footer-brand p {
    color: var(--es-text-muted);
    font-size: 0.9rem;
    line-height: 1.7;
    margin: 0;
}

.es-footer-column h4 {
    font-size: 0.9rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 20px;
    color: var(--es-text-white);
}

.es-footer-links {
    list-style: none;
    margin: 0;
    padding: 0;
}

.es-footer-links li {
    margin-bottom: 12px;
}

.es-footer-links a {
    color: var(--es-text-muted);
    font-size: 0.9rem;
    transition: color var(--es-transition-fast);
    text-decoration: none;
}

.es-footer-links a:hover {
    color: var(--es-primary);
}

/* Payment Icons */
.es-payment-icons {
    display: flex;
    gap: 12px;
    margin-top: 24px;
    flex-wrap: wrap;
}

.es-payment-icon {
    width: 48px;
    height: 30px;
    background: var(--es-bg-dark);
    border: 1px solid var(--es-border-color);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.65rem;
    color: var(--es-text-muted);
    font-weight: 600;
}

/* Footer Bottom */
.es-footer-bottom {
    padding-top: 30px;
    border-top: 1px solid var(--es-border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
}

.es-footer-copyright {
    color: var(--es-text-muted);
    font-size: 0.85rem;
    margin: 0;
}

.es-footer-bottom-links {
    display: flex;
    gap: 24px;
}

.es-footer-bottom-links a {
    color: var(--es-text-muted);
    font-size: 0.85rem;
    text-decoration: none;
}

.es-footer-bottom-links a:hover {
    color: var(--es-primary);
}

/* ========================================
   Body Lock for Mobile Menu
   ======================================== */
body.es-menu-open {
    overflow: hidden;
}

/* ========================================
   Mobile Responsive
   ======================================== */
@media (max-width: 992px) {
    .es-nav-toggle {
        display: flex;
    }

    .es-nav-menu {
        position: fixed;
        top: var(--es-nav-height);
        left: 0;
        right: 0;
        bottom: 0;
        background: var(--es-bg-dark);
        flex-direction: column;
        align-items: stretch;
        padding: 24px;
        gap: 0;
        overflow-y: auto;
        transform: translateX(-100%);
        transition: transform var(--es-transition-normal);
    }

    .es-nav.has-banner .es-nav-menu {
        top: calc(var(--es-nav-height) + 44px);
    }

    .es-nav-menu.active {
        transform: translateX(0);
    }

    .es-nav-link {
        padding: 16px 0;
        font-size: 1.1rem;
        border-bottom: 1px solid var(--es-border-color);
        justify-content: space-between;
    }

    .es-mega-menu,
    .es-mega-menu.es-mega-menu-wide {
        position: static;
        transform: none;
        opacity: 1;
        visibility: visible;
        box-shadow: none;
        border: none;
        background: transparent;
        padding: 16px 0 16px 16px;
        display: none;
        min-width: auto;
    }

    .es-nav-item.active .es-mega-menu {
        display: block;
    }

    .es-mega-menu-grid {
        grid-template-columns: 1fr;
        gap: 24px;
    }

    .es-nav-actions {
        margin-left: auto;
    }

    .es-footer-grid {
        grid-template-columns: 1fr 1fr;
    }

    .es-footer-brand {
        max-width: none;
        grid-column: span 2;
    }
}

@media (max-width: 576px) {
    .es-footer-grid {
        grid-template-columns: 1fr;
    }

    .es-footer-brand {
        grid-column: span 1;
    }

    .es-footer-bottom {
        flex-direction: column;
        text-align: center;
    }

    .es-top-banner {
        font-size: 0.8rem;
        padding: 10px 15px;
    }
}
