/* Tech Warmup — STEMpedia-style two-tier navigation */

.tw-header {
    position: relative;
    z-index: 1050;
    background: #fff;
    
}

.tw-header-top {
    border-bottom: 1px solid #e8ecf0;
}

.tw-header-top-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 72px;
    gap: 16px;
}

.tw-header-main {
    position: relative;
    background: linear-gradient(180deg, #e8f4fc 0%, #dceef9 100%);
    border-bottom: 1px solid #c5d9e8;
}

.tw-nav-item.has-mega {
    position: static;
}

.tw-header-main-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 48px;
    gap: 12px;
}

/* Logo */
.logo-container {
    display: flex;
    align-items: center;
    text-decoration: none;
    flex-shrink: 0;
}

.logo-image {
    height: 52px;
    width: auto;
    margin-right: 10px;
    user-select: none;
    pointer-events: none;
}

.logo-text {
    display: flex;
    flex-direction: column;
}

.logo-text h1 {
    font-size: 1.55rem;
    margin: 0;
    color: #2c3e50;
    line-height: 1.15;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.logo-text p {
    font-size: 0.8rem;
    margin: 0;
    color: #6c757d;
}

/* Utility bar (top right) */
.tw-utility-nav {
    display: flex;
    align-items: stretch;
    gap: 0;
}

.tw-utility-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 8px 18px;
    text-decoration: none;
    color: #3d4f5f;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    transition: color 0.2s ease, background 0.2s ease;
    border-left: 1px solid #e8ecf0;
    min-width: 88px;
}

.tw-utility-link:first-child {
    border-left: none;
}

.tw-utility-link:hover {
    color: #1a6fb5;
    background: rgba(52, 152, 219, 0.06);
}

.tw-utility-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 4px;
    font-size: 1rem;
}

.tw-utility-icon.icon-contact { background: #fff3e6; color: #e67e22; }
.tw-utility-icon.icon-shop { background: #e8f4fc; color: #2980b9; }
.tw-utility-icon.icon-account { background: #e8f4fc; color: #2980b9; }

/* Primary nav */
.tw-primary-nav {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 2px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.tw-nav-item {
    position: static;
}

.tw-nav-link {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 12px 14px;
    color: #2c3e50;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    transition: color 0.2s ease, background 0.2s ease;
    white-space: nowrap;
}

.tw-nav-link:hover,
.tw-nav-item:hover > .tw-nav-link,
.tw-nav-item.is-open > .tw-nav-link {
    color: #1a6fb5;
    background: rgba(255, 255, 255, 0.55);
}

.tw-nav-chevron {
    font-size: 0.65rem;
    opacity: 0.7;
    transition: transform 0.2s ease;
}

.tw-nav-item:hover .tw-nav-chevron,
.tw-nav-item.is-open .tw-nav-chevron {
    transform: rotate(180deg);
}

/* Header cart strip */
.tw-header-cart {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.nav-cart-total {
    font-weight: 700;
    font-size: 0.95rem;
    color: #2c3e50;
}

.tw-cart-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: relative;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background: #fff;
    color: #e67e22;
    text-decoration: none;
    font-size: 1.15rem;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.tw-cart-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.12);
    color: #d35400;
}

.cart-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #e74c3c;
    color: #fff;
    line-height: 1;
    font-size: 0.7rem;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    border-radius: 999px;
    position: absolute;
    top: -6px;
    right: -6px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    z-index: 2;
}

/* Mega menu panel */
.tw-mega-panel {
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    background: #fff;
    border-top: 1px solid #e0e8ef;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.12);
    opacity: 0;
    visibility: hidden;
    transform: translateY(8px);
    transition: opacity 0.22s ease, transform 0.22s ease, visibility 0.22s;
    pointer-events: none;
}

.tw-nav-item.has-mega:hover .tw-mega-panel,
.tw-nav-item.has-mega.is-open .tw-mega-panel {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
}

.tw-mega-inner {
    display: grid;
    grid-template-columns: 220px 1fr;
    min-height: 280px;
    max-width: 1140px;
    margin: 0 auto;
    padding: 0 15px;
}

.tw-mega-sidebar {
    background: #f4f8fb;
    border-right: 1px solid #e8ecf0;
    padding: 20px 0;
}

.tw-mega-sidebar-title {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: #7f8c9a;
    padding: 0 20px 12px;
    margin: 0;
    text-transform: uppercase;
}

.tw-mega-cat-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.tw-mega-cat-list a {
    display: block;
    padding: 9px 20px;
    color: #2c3e50;
    text-decoration: none;
    font-size: 0.88rem;
    font-weight: 500;
    transition: background 0.15s ease, color 0.15s ease, padding-left 0.15s ease;
}

.tw-mega-cat-list a:hover {
    background: #fff;
    color: #1a6fb5;
    padding-left: 24px;
}

.tw-mega-cat-list a.is-all {
    font-weight: 700;
    color: #1a6fb5;
}

.tw-mega-content {
    padding: 20px 24px 24px;
}

.tw-mega-content-title {
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    color: #95a5a6;
    text-transform: uppercase;
    margin: 0 0 14px;
}

.tw-mega-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

.tw-mega-card {
    text-decoration: none;
    color: inherit;
    border: 1px solid #eef2f6;
    border-radius: 10px;
    overflow: hidden;
    transition: box-shadow 0.2s ease, transform 0.2s ease;
    background: #fff;
}

.tw-mega-card:hover {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
    transform: translateY(-2px);
}

.tw-mega-card-img {
    width: 100%;
    height: 110px;
    object-fit: cover;
    background: #f0f4f8;
    display: block;
}

.tw-mega-card-body {
    padding: 10px 12px 12px;
}

.tw-mega-card-cat {
    font-size: 0.65rem;
    font-weight: 700;
    color: #95a5a6;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 4px;
}

.tw-mega-card-title {
    font-size: 0.82rem;
    font-weight: 700;
    color: #2c3e50;
    line-height: 1.3;
    margin: 0 0 6px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.tw-mega-card-price {
    font-size: 0.85rem;
    font-weight: 700;
    color: #e67e22;
}

.tw-mega-card-price del {
    color: #aaa;
    font-weight: 400;
    font-size: 0.78rem;
    margin-right: 4px;
}

.tw-mega-empty {
    color: #95a5a6;
    font-size: 0.9rem;
    padding: 24px 0;
}

.tw-mega-chips {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px;
}

.tw-mega-chip {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    border: 1px solid #e8ecf0;
    border-radius: 10px;
    text-decoration: none;
    color: #2c3e50;
    font-weight: 600;
    font-size: 0.88rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.tw-mega-chip:hover {
    border-color: #3498db;
    box-shadow: 0 4px 14px rgba(52, 152, 219, 0.15);
    color: #1a6fb5;
}

.tw-mega-chip i {
    color: #3498db;
    font-size: 1.1rem;
}

.tw-mega-chip-count {
    margin-left: auto;
    font-size: 0.78rem;
    color: #95a5a6;
    font-weight: 500;
}

/* User account in utility / nav */
.tw-account-wrap {
    position: relative;
    align-self: stretch;
    display: flex;
    align-items: stretch;
}

.tw-account-trigger {
    min-width: 88px;
}

.tw-account-name {
    display: inline-block;
    max-width: 110px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: bottom;
}

.tw-account-menu {
    position: absolute;
    top: 100%;
    right: 0;
    min-width: 200px;
    padding-top: 6px;
    z-index: 1100;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

.tw-account-menu-panel {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.14);
    padding: 8px 0;
    border: 1px solid #e8ecf0;
}

.tw-account-wrap:hover .tw-account-menu,
.tw-account-wrap.is-open .tw-account-menu,
.tw-account-menu.show {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.tw-account-menu a {
    display: flex;
    align-items: center;
    padding: 10px 18px;
    color: #2c3e50;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9rem;
    transition: background 0.15s ease;
}

.tw-account-menu a:hover {
    background: rgba(52, 152, 219, 0.1);
    color: #1a6fb5;
}

.tw-account-menu a i {
    width: 22px;
    margin-right: 10px;
    color: #3498db;
}

.tw-account-menu .dropdown-divider {
    margin: 6px 0;
    border-top: 1px solid #eee;
}

.user-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(52, 152, 219, 0.35);
}

.verify-indicator {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 6px;
    border-radius: 999px;
    background: #ef4444;
    color: #fff;
    font-size: 0.6rem;
    font-weight: 700;
    margin-left: 6px;
}

.verify-indicator.mobile {
    position: absolute;
    top: -6px;
    right: -8px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
}

@keyframes verifyBlink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

.verify-indicator:not(.desktop) {
    animation: verifyBlink 1s ease-in-out infinite;
}

/* Auth buttons (logged out) — top utility bar */
.tw-utility-auth {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 16px;
    border-left: 1px solid #e8ecf0;
    align-self: center;
    min-height: 48px;
}

.tw-btn-nav {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 7px 16px;
    font-size: 0.8rem;
    font-weight: 600;
    border-radius: 20px;
    border: 2px solid #3498db;
    cursor: pointer;
    text-decoration: none;
    line-height: 1.2;
    white-space: nowrap;
    transition: all 0.2s ease;
}

.tw-btn-nav-outline {
    background: transparent;
    color: #3498db;
}

.tw-btn-nav-outline:hover {
    background: #3498db;
    color: #fff;
}

.tw-btn-nav-solid {
    background: #3498db;
    color: #fff;
    border-color: #3498db;
}

.tw-btn-nav-solid:hover {
    background: #2980b9;
    border-color: #2980b9;
}

/* ========== Mobile header ========== */
.tw-header-mobile-wrap {
    border-bottom: 1px solid #e8ecf0;
}

.tw-header-mobile {
    display: flex;
    align-items: center;
    justify-content: space-between;
 
    min-height: 58px;
    background: #fff;
}

.tw-header-mobile .mobile-logo {
    flex: 1;
    min-width: 0;
    text-align: center;
}

.tw-header-mobile .mobile-logo .logo-container {
    justify-content: center;
}

.tw-header-mobile .logo-image {
    height: 32px;
}

.tw-header-mobile .logo-text h1 {
    font-size: 1rem;
    line-height: 1.1;
}

.tw-header-mobile .logo-text p {
    font-size: 0.65rem;
    color: #6c757d;
}

.mobile-menu-toggle {
    flex-shrink: 0;
    background: linear-gradient(180deg, #e8f4fc 0%, #dceef9 100%);
    border: 1px solid #c5d9e8;
    color: #2c3e50;
    font-size: 1.15rem;
    width: 42px;
    height: 42px;
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease, transform 0.2s ease;
}

.mobile-menu-toggle:active {
    transform: scale(0.96);
}

.mobile-header-icons {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.mobile-cart-icon {
    position: relative;
    color: #e67e22;
    font-size: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    text-decoration: none;
    border-radius: 10px;
    background: linear-gradient(180deg, #e8f4fc 0%, #dceef9 100%);
    border: 1px solid #c5d9e8;
}

.mobile-cart-icon .cart-count {
    top: -2px;
    right: -2px;
}

.mobile-user-icon {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    overflow: hidden;
    cursor: pointer;
    position: relative;
    border: 2px solid #3498db;
    padding: 0;
    background: #fff;
    flex-shrink: 0;
}

.mobile-user-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* ========== Mobile sidebar ========== */
.mobile-nav-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    z-index: 1040;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    backdrop-filter: blur(2px);
}

.mobile-nav-overlay.active {
    opacity: 1;
    visibility: visible;
}

.mobile-nav {
    position: fixed;
    top: 0;
    left: 0;
    width: min(320px, 88vw);
    max-width: 100%;
    height: 100vh;
    height: 100dvh;
    background: #fff;
    z-index: 1055;
    display: flex;
    flex-direction: column;
    transform: translateX(-105%);
    transition: transform 0.32s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.12);
}

.mobile-nav.active {
    transform: translateX(0);
}

.mobile-nav-brand {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 18px;
    background: linear-gradient(180deg, #e8f4fc 0%, #f8fbfd 100%);
    border-bottom: 1px solid #dceef9;
    flex-shrink: 0;
}

.mobile-nav-brand-link {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    min-width: 0;
    flex: 1;
}

.mobile-nav-brand-img {
    width: 36px;
    height: 36px;
    object-fit: contain;
    flex-shrink: 0;
}

.mobile-nav-brand-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.mobile-nav-brand-text strong {
    font-size: 0.95rem;
    color: #2c3e50;
    letter-spacing: 0.02em;
}

.mobile-nav-brand-text small {
    font-size: 0.68rem;
    color: #6c757d;
}

.mobile-nav-close {
    flex-shrink: 0;
    width: 38px;
    height: 38px;
    border: none;
    border-radius: 10px;
    background: #fff;
    color: #2c3e50;
    font-size: 1.1rem;
    cursor: pointer;
    box-shadow: 0 1px 6px rgba(0, 0, 0, 0.08);
    display: flex;
    align-items: center;
    justify-content: center;
}

.mobile-nav-user-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    background: #f4f8fb;
    border-bottom: 1px solid #e8ecf0;
    flex-shrink: 0;
}

.mobile-nav-user-card img {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #3498db;
}

.mobile-nav-user-meta {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.mobile-nav-user-meta strong {
    font-size: 0.95rem;
    color: #2c3e50;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mobile-nav-user-meta span {
    font-size: 0.75rem;
    color: #6c757d;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mobile-nav-verify {
    flex-shrink: 0;
}

.mobile-nav-account-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    padding: 12px 14px;
    border-bottom: 1px solid #e8ecf0;
    flex-shrink: 0;
}

.mobile-nav-account-grid a {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 10px 6px;
    text-align: center;
    text-decoration: none;
    font-size: 0.68rem;
    font-weight: 600;
    color: #2c3e50;
    background: #f4f8fb;
    border-radius: 10px;
    border: 1px solid #e8ecf0;
    transition: background 0.2s ease, border-color 0.2s ease;
}

.mobile-nav-account-grid a i {
    font-size: 1rem;
    color: #3498db;
}

.mobile-nav-account-grid a:hover {
    background: #e8f4fc;
    border-color: #c5d9e8;
}

.mobile-nav-scroll {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 8px 0 16px;
}

.mobile-nav-label {
    margin: 12px 18px 6px;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #95a5a6;
}

.mobile-nav-items {
    list-style: none;
    padding: 0;
    margin: 0;
}

.mobile-nav-items > li {
    border-bottom: 1px solid #f0f3f6;
}

.mobile-nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    color: #2c3e50;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.92rem;
    transition: background 0.15s ease, color 0.15s ease;
}

.mobile-nav-link i {
    width: 20px;
    text-align: center;
    color: #3498db;
    font-size: 1rem;
}

.mobile-nav-link:hover,
.mobile-nav-link:active {
    background: #f4f8fb;
    color: #1a6fb5;
}

.mobile-nav-items .mobile-toggle-head {
    display: flex;
    align-items: stretch;
}

.mobile-nav-items .mobile-toggle-head .mobile-nav-link {
    flex: 1;
}

.mobile-nav-items .mobile-submenu-toggle {
    flex-shrink: 0;
    width: 48px;
    background: transparent;
    border: 0;
    border-left: 1px solid #f0f3f6;
    color: #7f8c9a;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease, color 0.2s ease;
}

.mobile-nav-items .mobile-submenu-toggle i {
    transition: transform 0.25s ease;
}

.mobile-nav-items .mobile-toggle-item.open .mobile-submenu-toggle {
    background: #f4f8fb;
    color: #3498db;
}

.mobile-nav-items .mobile-toggle-item.open .mobile-submenu-toggle i {
    transform: rotate(180deg);
}

.mobile-nav-items .mobile-submenu {
    list-style: none;
    margin: 0;
    padding: 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.35s ease;
    background: #f8fafc;
}

.mobile-nav-items .mobile-toggle-item.open .mobile-submenu {
    max-height: 480px;
}

.mobile-nav-items .mobile-submenu a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 11px 18px 11px 50px;
    color: #4a5f6f;
    text-decoration: none;
    font-size: 0.88rem;
    font-weight: 500;
    border-top: 1px solid #eef2f6;
}

.mobile-nav-items .mobile-submenu a:hover {
    background: #eef6fc;
    color: #1a6fb5;
}

.mobile-submenu-count {
    font-style: normal;
    font-size: 0.75rem;
    color: #95a5a6;
    background: #e8ecf0;
    padding: 2px 8px;
    border-radius: 10px;
}

.mobile-nav-footer {
    flex-shrink: 0;
    padding: 14px 18px 20px;
    padding-bottom: max(20px, env(safe-area-inset-bottom));
    border-top: 1px solid #e8ecf0;
    background: #f8fafc;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.mobile-nav-footer .tw-btn-nav {
    flex: 1;
    min-width: 120px;
    text-align: center;
}

.mobile-nav-logout {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 12px 16px;
    border-radius: 10px;
    background: #fff;
    border: 1px solid #e8ecf0;
    color: #c0392b;
    font-weight: 600;
    text-decoration: none;
    font-size: 0.9rem;
}

.mobile-nav-logout:hover {
    background: #fef5f5;
    border-color: #f5c6c6;
}

body.mobile-nav-open {
    overflow: hidden;
}

@media (max-width: 991.98px) {
    .tw-header-top,
    .tw-header-main {
        display: none !important;
    }

    .tw-header-mobile-wrap {
        display: block;
    }
}

@media (min-width: 992px) {
    .tw-header-mobile-wrap {
        display: none !important;
    }

    .tw-mega-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 1199.98px) and (min-width: 992px) {
    .tw-mega-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}
