/* ==========================================================================
   Groupon Style Header CSS
   Version: 1.0
   ========================================================================== */

/* ==========================================================================
   CSS 变量
   ========================================================================== */
:root {
    /* Groupon 品牌色 */
    --gpn-green: #53a318;
    --gpn-green-dark: #429115;
    --gpn-green-light: #6dbf25;
    
    /* 促销横幅 */
    --gpn-promo-bg: linear-gradient(90deg, #4a2c82 0%, #6b4299 50%, #4a2c82 100%);
    --gpn-promo-text: #ffffff;
    
    /* 顶部栏 */
    --gpn-topbar-bg: #ffffff;
    --gpn-topbar-text: #707070;
    --gpn-topbar-border: #e5e5e5;
    
    /* 主色 */
    --gpn-white: #ffffff;
    --gpn-gray-bg: #f6f7f8;
    --gpn-text: #1a1a1a;
    --gpn-text-light: #666666;
    --gpn-border: #e5e5e5;
    --gpn-blue: #0066cc;
    
    /* 尺寸 */
    --gpn-header-height: 70px;
    --gpn-topbar-height: 36px;
    --gpn-promo-height: 44px;
    --gpn-category-height: 48px;
    --gpn-container-width: 1280px;
}

/* ==========================================================================
   容器
   ========================================================================== */
.gpn-container {
    max-width: var(--gpn-container-width);
    margin: 0 auto;
    padding: 0 20px;
}

/* ==========================================================================
   1. 促销横幅 (Promo Bar)
   ========================================================================== */
.gpn-promo-bar {
    background: var(--gpn-promo-bg);
    color: var(--gpn-promo-text);
    position: relative;
    z-index: 1001;
}

.gpn-promo-inner {
    max-width: var(--gpn-container-width);
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: var(--gpn-promo-height);
    position: relative;
}

.gpn-promo-content {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 10px 40px;
    text-align: center;
}

.gpn-promo-text {
    font-size: 14px;
    font-weight: 500;
    letter-spacing: 0.3px;
}

.gpn-promo-text strong {
    font-weight: 700;
}

.gpn-promo-btn {
    display: inline-block;
    padding: 6px 16px;
    border: 1.5px solid rgba(255,255,255,0.9);
    border-radius: 20px;
    color: #fff !important;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none !important;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.gpn-promo-btn:hover {
    background: rgba(255,255,255,0.15);
    transform: translateY(-1px);
}

.gpn-promo-close {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    width: 28px;
    height: 28px;
    background: transparent;
    border: none;
    color: rgba(255,255,255,0.7);
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s;
}

.gpn-promo-close:hover {
    color: #fff;
    background: rgba(255,255,255,0.1);
}

/* 促销栏隐藏动画 */
.gpn-promo-bar.is-hiding {
    animation: slideUp 0.3s ease forwards;
}

@keyframes slideUp {
    to {
        transform: translateY(-100%);
        opacity: 0;
    }
}

/* ==========================================================================
   2. 顶部工具栏 (Top Bar)
   ========================================================================== */
.gpn-topbar {
    background: var(--gpn-topbar-bg);
    border-bottom: 1px solid var(--gpn-topbar-border);
    height: var(--gpn-topbar-height);
}

.gpn-topbar-inner {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    height: 100%;
}

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

.gpn-topbar-links li {
    margin: 0;
}

.gpn-topbar-links a {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--gpn-topbar-text);
    font-size: 12px;
    text-decoration: none;
    transition: color 0.2s;
}

.gpn-topbar-links a:hover {
    color: var(--gpn-text);
}

.gpn-topbar-links svg {
    opacity: 0.7;
}

/* 语言选择器 */
.gpn-lang-item {
    position: relative;
}

.gpn-lang-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    background: transparent;
    border: none;
    color: var(--gpn-topbar-text);
    font-size: 12px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background 0.2s;
}

.gpn-lang-btn:hover {
    background: #f5f5f5;
}

.gpn-flag {
    font-size: 14px;
}

.gpn-lang-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 8px;
    background: #fff;
    border: 1px solid var(--gpn-border);
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    min-width: 140px;
    padding: 8px 0;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
    z-index: 1100;
}

.gpn-lang-item:hover .gpn-lang-dropdown,
.gpn-lang-dropdown.is-open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.gpn-lang-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    color: var(--gpn-text);
    font-size: 13px;
    text-decoration: none;
    transition: background 0.2s;
}

.gpn-lang-option:hover {
    background: #f5f5f5;
}

.gpn-lang-option.active {
    color: var(--gpn-green);
    font-weight: 600;
}

/* ==========================================================================
   3. 主导航栏 (Main Header)
   ========================================================================== */
.gpn-header-main {
    background: var(--gpn-white);
    height: var(--gpn-header-height);
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    position: relative;
    z-index: 1000;
}

.gpn-header-main.is-sticky {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.gpn-header-row {
    display: flex;
    align-items: center;
    height: 100%;
    gap: 24px;
}

/* Logo */
.gpn-logo {
    flex-shrink: 0;
}

.gpn-logo a {
    display: flex;
    align-items: center;
}

.gpn-logo img {
    max-height: 45px;
    width: auto;
}

.gpn-logo-text {
    text-decoration: none;
}

.gpn-logo-main {
    font-size: 28px;
    font-weight: 800;
    color: var(--gpn-green);
    letter-spacing: -1px;
}

/* 搜索框 */
.gpn-search-wrap {
    flex: 1;
    max-width: 600px;
    position: relative;
}

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

.gpn-search-box {
    display: flex;
    align-items: center;
    background: var(--gpn-white);
    border: 2px solid var(--gpn-green);
    border-radius: 24px;
    overflow: hidden;
    transition: box-shadow 0.2s;
}

.gpn-search-box:focus-within {
    box-shadow: 0 0 0 3px rgba(83, 163, 24, 0.2);
}

.gpn-search-icon-left {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
}

.gpn-search-input {
    flex: 1;
    border: none;
    padding: 12px 16px 12px 44px;
    font-size: 15px;
    outline: none;
    background: transparent;
    color: var(--gpn-text);
}

.gpn-search-input::placeholder {
    color: #999;
}

.gpn-search-btn {
    flex-shrink: 0;
    width: 48px;
    height: 44px;
    background: var(--gpn-green);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.gpn-search-btn:hover {
    background: var(--gpn-green-dark);
}

/* 搜索下拉 */
.gpn-search-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 8px;
    background: #fff;
    border: 1px solid var(--gpn-border);
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    max-height: 400px;
    overflow-y: auto;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
    z-index: 1100;
}

.gpn-search-dropdown.is-open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.gpn-search-loading {
    padding: 16px;
    text-align: center;
    color: #999;
    font-size: 14px;
}

/* 用户工具 */
.gpn-user-tools {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.gpn-tool-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    color: var(--gpn-text);
    text-decoration: none;
    border-radius: 50%;
    transition: background 0.2s;
    position: relative;
}

.gpn-tool-btn:hover {
    background: #f5f5f5;
}

.gpn-tool-btn svg {
    stroke-width: 1.5;
}

/* 购物车计数 */
.gpn-cart-count {
    position: absolute;
    top: 2px;
    right: 2px;
    min-width: 18px;
    height: 18px;
    background: var(--gpn-green);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
}

/* 通知点 */
.gpn-notif-dot {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 8px;
    height: 8px;
    background: #e53e3e;
    border-radius: 50%;
    border: 2px solid #fff;
}

/* 登录按钮 */
.gpn-signin-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    color: var(--gpn-text) !important;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none !important;
    border-radius: 8px;
    transition: background 0.2s;
}

.gpn-signin-btn:hover {
    background: #f5f5f5;
}

/* 用户菜单 */
.gpn-user-menu {
    position: relative;
}

.gpn-user-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: transparent;
    border: none;
    cursor: pointer;
    border-radius: 8px;
    transition: background 0.2s;
}

.gpn-user-btn:hover {
    background: #f5f5f5;
}

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

.gpn-user-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--gpn-text);
    max-width: 100px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.gpn-user-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 8px;
    background: #fff;
    border: 1px solid var(--gpn-border);
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    min-width: 200px;
    padding: 8px 0;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
    z-index: 1100;
}

.gpn-user-menu:hover .gpn-user-dropdown,
.gpn-user-dropdown.is-open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.gpn-user-dropdown a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    color: var(--gpn-text);
    font-size: 14px;
    text-decoration: none;
    transition: background 0.2s;
}

.gpn-user-dropdown a:hover {
    background: #f5f5f5;
}

.gpn-user-dropdown svg {
    opacity: 0.6;
}

.gpn-dropdown-divider {
    height: 1px;
    background: var(--gpn-border);
    margin: 8px 0;
}

.gpn-logout-link {
    color: #e53e3e !important;
}

/* ==========================================================================
   4. 分类导航 (Category Nav)
   ========================================================================== */
.gpn-category-nav {
    background: var(--gpn-white);
    border-bottom: 1px solid var(--gpn-border);
    height: var(--gpn-category-height);
}

.gpn-category-list {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 100%;
    list-style: none;
    margin: 0;
    padding: 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.gpn-category-list::-webkit-scrollbar {
    display: none;
}

.gpn-category-item {
    flex-shrink: 0;
}

.gpn-category-item a {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    color: var(--gpn-text);
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.2s;
    white-space: nowrap;
}

.gpn-category-item a:hover {
    background: #f5f5f5;
    color: var(--gpn-green);
}

.gpn-cat-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.7;
}

.gpn-category-item a:hover .gpn-cat-icon {
    opacity: 1;
}

.gpn-cat-icon svg {
    stroke: currentColor;
}

/* ==========================================================================
   5. 面包屑导航 (Breadcrumbs)
   ========================================================================== */
.gpn-breadcrumbs {
    background: var(--gpn-gray-bg);
    padding: 10px 0;
}

.gpn-breadcrumb-list {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.gpn-breadcrumb-item a,
.gpn-breadcrumb-item span {
    font-size: 13px;
    color: var(--gpn-text-light);
    text-decoration: none;
}

.gpn-breadcrumb-item a:hover {
    color: var(--gpn-blue);
    text-decoration: underline;
}

.gpn-breadcrumb-sep {
    display: flex;
    align-items: center;
    color: #ccc;
}

/* ==========================================================================
   6. 移动端菜单
   ========================================================================== */
.gpn-mobile-toggle {
    display: none;
    position: fixed;
    top: 12px;
    right: 16px;
    z-index: 1002;
    width: 44px;
    height: 44px;
    background: var(--gpn-white);
    border: 1px solid var(--gpn-border);
    border-radius: 8px;
    cursor: pointer;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

.gpn-mobile-toggle span {
    display: block;
    width: 20px;
    height: 2px;
    background: var(--gpn-text);
    transition: all 0.3s;
}

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

.gpn-mobile-toggle.is-active span:nth-child(2) {
    opacity: 0;
}

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

.gpn-mobile-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1003;
    opacity: 0;
    transition: opacity 0.3s;
}

.gpn-mobile-overlay.is-open {
    display: block;
    opacity: 1;
}

.gpn-mobile-menu {
    position: fixed;
    top: 0;
    right: -100%;
    width: 300px;
    max-width: 85vw;
    height: 100vh;
    background: var(--gpn-white);
    z-index: 1004;
    transition: right 0.3s ease;
    overflow-y: auto;
}

.gpn-mobile-menu.is-open {
    right: 0;
}

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

.gpn-mobile-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--gpn-green);
}

.gpn-mobile-close {
    width: 36px;
    height: 36px;
    background: transparent;
    border: none;
    font-size: 28px;
    color: var(--gpn-text-light);
    cursor: pointer;
}

.gpn-mobile-search {
    padding: 16px 20px;
    border-bottom: 1px solid var(--gpn-border);
}

.gpn-mobile-search form {
    display: flex;
    background: #f5f5f5;
    border-radius: 8px;
    overflow: hidden;
}

.gpn-mobile-search input {
    flex: 1;
    border: none;
    padding: 12px 16px;
    font-size: 14px;
    background: transparent;
    outline: none;
}

.gpn-mobile-search button {
    width: 44px;
    background: transparent;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--gpn-text-light);
}

.gpn-mobile-categories {
    list-style: none;
    margin: 0;
    padding: 8px 0;
}

.gpn-mobile-categories li {
    margin: 0;
}

.gpn-mobile-categories a {
    display: block;
    padding: 14px 20px;
    color: var(--gpn-text);
    font-size: 15px;
    font-weight: 500;
    text-decoration: none;
    border-bottom: 1px solid #f0f0f0;
}

.gpn-mobile-categories a:hover {
    background: #f9f9f9;
    color: var(--gpn-green);
}

.gpn-mobile-user {
    padding: 16px 20px;
    border-top: 1px solid var(--gpn-border);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.gpn-mobile-user a {
    display: block;
    padding: 12px 16px;
    background: var(--gpn-green);
    color: #fff !important;
    text-align: center;
    font-size: 14px;
    font-weight: 600;
    border-radius: 8px;
    text-decoration: none;
}

.gpn-mobile-user a:last-child {
    background: transparent;
    color: var(--gpn-text) !important;
    border: 1px solid var(--gpn-border);
}

/* ==========================================================================
   7. 响应式
   ========================================================================== */
@media (max-width: 1024px) {
    .gpn-search-wrap {
        max-width: 400px;
    }
    
    .gpn-topbar-links span {
        display: none;
    }
    
    .gpn-topbar-links a {
        padding: 8px;
    }
    
    .gpn-user-name {
        display: none;
    }
}

@media (max-width: 768px) {
    .gpn-topbar {
        display: none;
    }
    
    .gpn-header-main {
        height: 60px;
    }
    
    .gpn-header-row {
        gap: 12px;
    }
    
    .gpn-search-wrap {
        display: none;
    }
    
    .gpn-user-tools {
        display: none;
    }
    
    .gpn-mobile-toggle {
        display: flex;
    }
    
    .gpn-category-nav {
        overflow-x: auto;
    }
    
    .gpn-category-list {
        justify-content: flex-start;
        padding: 0 16px;
    }
    
    .gpn-promo-content {
        padding: 10px 50px 10px 16px;
        flex-direction: column;
        gap: 8px;
    }
    
    .gpn-promo-text {
        font-size: 12px;
    }
    
    .gpn-logo img {
        max-height: 35px;
    }
    
    .gpn-logo-main {
        font-size: 22px;
    }
}

@media (max-width: 480px) {
    .gpn-promo-btn {
        display: none;
    }
    
    .gpn-category-item a {
        padding: 6px 10px;
        font-size: 12px;
    }
    
    .gpn-cat-icon {
        display: none;
    }
}

/* ==========================================================================
   8. 隐藏父主题默认 Header 元素
   ========================================================================== */
body.gpn-header-active .top-bar,
body.gpn-header-active .navigation,
body.gpn-header-active .notification-bar,
body.gpn-header-active .navbar-toggle.button-white {
    display: none !important;
}

/* 如果需要保留某些父主题样式，可以在这里覆盖 */
body.gpn-header-active {
    padding-top: 0 !important;
}

/* Sticky Header 补偿 */
body.gpn-header-active.admin-bar .gpn-header-main.is-sticky {
    top: 32px;
}

@media (max-width: 782px) {
    body.gpn-header-active.admin-bar .gpn-header-main.is-sticky {
        top: 46px;
    }
}
