/* ==========================================
   贵州古芝源品牌管理有限公司 - 全局样式表
   中医药汉方风格 | 2026
   ========================================== */

/* CSS 变量 */
:root {
    --primary-green: #2d5016;
    --light-green: #4a7c23;
    --earth-brown: #8b6f47;
    --cream: #f5f0e8;
    --dark-brown: #3e2723;
    --gold: #d4a574;
    --text-dark: #2c2c2c;
    --text-light: #666;
    --white: #ffffff;
}

/* 全局重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: "PingFang SC", "Microsoft YaHei", "SimSun", serif;
    line-height: 1.8;
    color: var(--text-dark);
    background-color: var(--cream);
}

/* 导航栏 */
.navbar {
    position: fixed;
    top: 0;
    width: 100%;
    background: rgba(45, 80, 22, 0.95);
    padding: 1rem 0;
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    transition: background 0.3s;
}

.navbar.scrolled {
    background: rgba(45, 80, 22, 0.98);
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    color: var(--white);
    font-size: 1.8rem;
    font-weight: bold;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
    min-width: 0;
}

.logo-icon {
    width: 40px;
    height: 40px;
    background: var(--gold);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.logo-img {
    max-height: 45px;
    max-width: 180px;
    object-fit: contain;
}

.logo-text {
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.nav-links {
    display: flex;
    list-style: none;
    gap: 2rem;
    flex-wrap: nowrap;
    flex-shrink: 0;
    overflow: hidden;
}

.nav-links li {
    flex-shrink: 0;
    white-space: nowrap;
}

.nav-links a {
    color: var(--white);
    text-decoration: none;
    font-size: 1rem;
    transition: color 0.3s;
    position: relative;
}

.nav-links a:hover {
    color: var(--gold);
}

.nav-links a::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--gold);
    transition: width 0.3s;
}

.nav-links a:hover::after {
    width: 100%;
}

/* 下拉菜单 */
.dropdown {
    position: relative;
}

.dropdown > a::after {
    content: '' !important;
    width: 0 !important;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(45, 80, 22, 0.98);
    min-width: 280px;
    padding: 0.5rem 0;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.2);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
    z-index: 1001;
    list-style: none;
}

.dropdown:hover .dropdown-menu {
    opacity: 1;
    visibility: visible;
}

.dropdown-menu li {
    display: block;
    white-space: nowrap;
}

.dropdown-menu a {
    display: block;
    padding: 0.7rem 1.5rem;
    color: var(--white) !important;
    font-size: 0.95rem;
    text-decoration: none;
    transition: background 0.3s, color 0.3s;
}

.dropdown-menu a:hover {
    background: rgba(212, 165, 116, 0.2);
    color: var(--gold) !important;
}

.dropdown-menu a.active-link {
    color: var(--gold) !important;
}

@media (max-width: 768px) {
    .dropdown-menu {
        position: static;
        transform: none;
        opacity: 1;
        visibility: visible;
        background: rgba(0,0,0,0.2);
        box-shadow: none;
        padding-left: 1rem;
        display: none;
    }
    .dropdown.active .dropdown-menu {
        display: block;
    }
}

/* 通用区域标题 */
.section-title {
    text-align: center;
    font-size: 2.5rem;
    color: var(--primary-green);
    margin-bottom: 1rem;
    position: relative;
}

.section-title::after {
    content: '';
    display: block;
    width: 80px;
    height: 3px;
    background: var(--gold);
    margin: 1rem auto;
}

.section-subtitle {
    text-align: center;
    color: var(--text-light);
    margin-bottom: 3rem;
    font-size: 1.1rem;
}

/* 按钮 */
.btn-primary {
    display: inline-block;
    padding: 0.8rem 2rem;
    background: var(--primary-green);
    color: var(--white);
    border: none;
    border-radius: 5px;
    font-size: 1.1rem;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.3s;
}

.btn-primary:hover {
    background: var(--light-green);
}

.btn-secondary {
    display: inline-block;
    padding: 0.8rem 2rem;
    background: var(--white);
    color: var(--primary-green);
    border: 2px solid var(--primary-green);
    border-radius: 5px;
    font-size: 1.1rem;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.3s;
}

.btn-secondary:hover {
    background: var(--primary-green);
    color: var(--white);
}

/* 面包屑 */
.breadcrumb {
    margin-bottom: 2rem;
    color: var(--text-light);
}

.breadcrumb a {
    color: var(--primary-green);
    text-decoration: none;
}

.breadcrumb a:hover {
    text-decoration: underline;
}

/* 标签 */
.tag {
    display: inline-block;
    background: var(--cream);
    color: var(--primary-green);
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    font-size: 0.9rem;
}

/* 卡片 */
.card {
    background: var(--white);
    border-radius: 10px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.05);
    transition: transform 0.3s, box-shadow 0.3s;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(45, 80, 22, 0.15);
}

/* 页脚 */
.footer {
    background: var(--dark-brown);
    color: var(--white);
    text-align: center;
    padding: 2rem;
}

.footer p {
    opacity: 0.8;
    margin: 0.5rem 0;
}

/* 滚动动画 */
.fade-in {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.fade-in.visible {
    opacity: 1;
    transform: translateY(0);
}

/* 平滑滚动 */
html {
    scroll-behavior: smooth;
}

/* 响应式 */
@media (max-width: 768px) {
    .nav-links {
        display: none;
    }

    /* 汉堡菜单按钮 */
    .nav-toggle {
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        width: 36px;
        height: 36px;
        background: none;
        border: none;
        cursor: pointer;
        z-index: 1002;
        padding: 4px;
        gap: 5px;
    }
    .nav-toggle span {
        display: block;
        width: 24px;
        height: 2px;
        background: var(--white);
        border-radius: 2px;
        transition: all 0.3s ease;
    }
    .nav-toggle.open span:nth-child(1) {
        transform: translateY(7px) rotate(45deg);
    }
    .nav-toggle.open span:nth-child(2) {
        opacity: 0;
    }
    .nav-toggle.open span:nth-child(3) {
        transform: translateY(-7px) rotate(-45deg);
    }

    /* 移动端菜单覆盖层 */
    .nav-mobile-overlay {
        display: none;
        position: fixed;
        top: 0; left: 0; right: 0; bottom: 0;
        background: rgba(0,0,0,0.5);
        z-index: 998;
    }
    .nav-mobile-overlay.open {
        display: block;
    }

    /* 移动端导航菜单面板 */
    .nav-links {
        position: fixed;
        top: 0;
        right: -280px;
        width: 260px;
        height: 100vh;
        background: rgba(45, 80, 22, 0.98);
        flex-direction: column;
        gap: 0;
        padding: 80px 0 2rem;
        z-index: 999;
        transition: right 0.3s ease;
        overflow-y: auto;
        box-shadow: -4px 0 20px rgba(0,0,0,0.3);
    }
    .nav-links.open {
        right: 0;
        display: flex;
    }
    .nav-links li {
        width: 100%;
    }
    .nav-links > li > a {
        display: block;
        padding: 0.9rem 2rem;
        font-size: 1.05rem;
        border-bottom: 1px solid rgba(255,255,255,0.08);
    }
    .nav-links > li > a::after {
        display: none;
    }

    /* 移动端子菜单 */
    .dropdown-menu {
        position: static;
        transform: none;
        background: rgba(0,0,0,0.2);
        min-width: unset;
        border-radius: 0;
        box-shadow: none;
        opacity: 1;
        visibility: visible;
        display: none;
        padding: 0;
    }
    .dropdown.open .dropdown-menu {
        display: block;
    }
    .dropdown-menu li a {
        padding: 0.7rem 3rem;
        font-size: 0.95rem;
    }
    .dropdown > a::after {
        display: none;
    }
    .dropdown > a {
        display: flex;
        justify-content: space-between;
        align-items: center;
    }
    .dropdown > a .arrow {
        font-size: 0.7rem;
        transition: transform 0.3s;
    }
    .dropdown.open > a .arrow {
        transform: rotate(180deg);
    }

    .section-title {
        font-size: 2rem;
    }

    .breadcrumb {
        font-size: 0.9rem;
    }
}

@media (min-width: 769px) and (max-width: 1024px) {
    .section-title {
        font-size: 2.2rem;
    }
}

/* ==========================================
   购物车相关样式
   ========================================== */

/* 购物车图标和角标 */
.cart-link {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.cart-icon {
    font-size: 1.2rem;
}

.cart-badge {
    position: absolute;
    top: -8px;
    right: -12px;
    background: var(--gold);
    color: var(--white);
    font-size: 0.7rem;
    font-weight: bold;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

.cart-badge.show {
    display: flex;
}

/* 购物车提示消息 */
.cart-toast {
    position: fixed;
    top: 100px;
    right: 20px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 5px 30px rgba(0,0,0,0.15);
    padding: 1rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    z-index: 10000;
    transform: translateX(120%);
    transition: transform 0.3s ease;
    max-width: 400px;
}

.cart-toast.show {
    transform: translateX(0);
}

.cart-toast-content {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
}

.cart-toast-icon {
    font-size: 1.5rem;
}

.cart-toast-text {
    color: var(--text-dark);
    font-size: 0.95rem;
}

.cart-toast-link {
    background: var(--primary-green);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 5px;
    text-decoration: none;
    font-size: 0.9rem;
    white-space: nowrap;
    transition: background 0.3s;
}

.cart-toast-link:hover {
    background: var(--light-green);
}

/* 通知消息 */
.notification {
    position: fixed;
    top: 100px;
    left: 50%;
    transform: translateX(-50%) translateY(-20px);
    background: var(--primary-green);
    color: white;
    padding: 1rem 2rem;
    border-radius: 10px;
    box-shadow: 0 5px 30px rgba(0,0,0,0.15);
    z-index: 10001;
    opacity: 0;
    transition: opacity 0.3s, transform 0.3s;
    font-size: 0.95rem;
}

.notification.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.notification-success {
    background: var(--primary-green);
}

.notification-error {
    background: #d32f2f;
}

.notification-info {
    background: #1976d2;
}

/* 数量选择器 */
.quantity-selector {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 1rem 0;
}

.quantity-btn {
    width: 36px;
    height: 36px;
    border: 2px solid var(--primary-green);
    background: white;
    color: var(--primary-green);
    font-size: 1.2rem;
    border-radius: 5px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

.quantity-btn:hover {
    background: var(--primary-green);
    color: white;
}

.quantity-input {
    width: 60px;
    height: 36px;
    border: 2px solid var(--cream);
    border-radius: 5px;
    text-align: center;
    font-size: 1rem;
    font-weight: bold;
    color: var(--text-dark);
}

/* 产品操作按钮 */
.product-actions {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
}

.btn-add-cart {
    flex: 1;
    padding: 1rem;
    background: white;
    color: var(--primary-green);
    border: 2px solid var(--primary-green);
    border-radius: 5px;
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-add-cart:hover {
    background: var(--primary-green);
    color: white;
}

.btn-buy-now {
    flex: 1;
    padding: 1rem;
    background: var(--primary-green);
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 1.1rem;
    cursor: pointer;
    transition: background 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-buy-now:hover {
    background: var(--light-green);
}

/* 响应式 */
@media (max-width: 768px) {
    .cart-toast {
        top: 80px;
        right: 10px;
        left: 10px;
        max-width: none;
    }

    .notification {
        top: 80px;
        left: 10px;
        right: 10px;
        transform: translateY(-20px);
    }

    .notification.show {
        transform: translateY(0);
    }
}

