/* 导航栏样式 - 公共样式文件 */
:root {
    --primary: #6a11cb;
    --secondary: #8a2be2;
    --accent: #ffcc00;
    --light: #f8f9fa;
    --dark: #212529;
    --success: #28a745;
    --danger: #dc3545;
}

/* 统一根字体大小，确保各页面 rem / em 比例一致 */
html {
    font-size: 16px;
}

/* 导航栏 */
header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    padding: 15px 5%;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
}

.logo h1 {
    color: white;
    font-size: 1.8rem;
    margin-left: 10px;
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.2);
}

.logo-icon {
    color: var(--accent);
    font-size: 2.2rem;
}

.nav-links {
    display: flex;
    list-style: none;
}

.nav-links li {
    margin: 0 15px;
}

.nav-links a {
    color: white;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s ease;
    padding: 8px 12px;
    border-radius: 20px;
    cursor: pointer;
    position: relative;
    font-size: 16px; /* 统一字体大小 */
    line-height: 1.2;
}

.nav-links a::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 50%;
    width: 0;
    height: 2px;
    background-color: var(--accent);
    transition: all 0.3s ease;
    transform: translateX(-50%);
}

.nav-links a:hover::after,
.nav-links a.active::after {
    width: 100%;
}

.nav-links a:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

.nav-links a.active {
    background-color: rgba(255, 255, 255, 0.1);
}

/* 右侧导航区域 */
.nav-right {
    display: flex;
    align-items: center;
    gap: 15px;
}
/* 统一导航高度，保证各页面一致 */
.navbar {
    min-height: 64px;
}

/* 购物车图标 */
.cart-icon {
    background: none;
    border: none;
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    position: relative;
    padding: 8px;
    transition: all 0.3s ease;
}

.cart-icon:hover {
    transform: scale(1.1);
}

.cart-count {
    position: absolute;
    top: -8px;
    right: -8px;
    background-color: var(--accent);
    color: white;
    font-size: 0.7rem;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 用户信息区域 */
.user-info {
    display: flex;
    align-items: center;
    color: white;
    font-weight: 500;
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 20px;
    transition: all 0.3s ease;
}

.user-info:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

/* 登录按钮 */
.cta-button {
    background-color: var(--accent);
    color: var(--dark);
    border: none;
    padding: 10px 20px;
    border-radius: 25px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.cta-button:hover {
    background-color: #ffd700;
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.2);
}

/* 登录/注册模态框样式 */
#login-modal {
    width: 90%;
    max-width: 400px;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 3001;
    border-radius: 16px;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.3);
    background-color: white;
    overflow: hidden;
    display: none;
}

#login-modal .cart-header {
    padding: 20px;
    background-color: var(--primary);
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#login-modal .cart-header h3 {
    font-size: 1.3rem;
    margin: 0;
}

#login-modal .close-cart {
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    transition: transform 0.2s ease;
}

#login-modal .close-cart:hover {
    transform: scale(1.1);
}

#login-modal .cart-items {
    padding: 25px;
    background-color: #f9f9f9;
}

#login-modal .cart-items label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--dark);
}

#login-modal .cart-items input[type="tel"],
#login-modal .cart-items input[type="text"] {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s ease;
}

#login-modal .cart-items input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(106, 17, 203, 0.2);
}

#login-modal .cart-items button[type="button"] {
    padding: 10px 15px;
    background-color: var(--accent);
    color: var(--dark);
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

#login-modal .cart-items button[type="button"]:hover {
    background-color: #ffcc00;
    transform: translateY(-1px);
}

#login-modal .cart-items button[type="submit"] {
    width: 100%;
    padding: 12px;
    background-color: var(--success);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
}

#login-modal .cart-items button[type="submit"]:hover {
    background-color: #218838;
    transform: translateY(-1px);
}

#login-modal .cart-items p {
    text-align: center;
    margin-top: 20px;
    font-size: 0.9rem;
    color: #666;
}

#login-modal .cart-items a {
    color: var(--primary);
    text-decoration: underline;
    cursor: pointer;
    transition: color 0.3s ease;
}

#login-modal .cart-items a:hover {
    color: var(--accent);
}

/* 响应式 */
@media (max-width: 768px) {
    .navbar {
        flex-direction: column;
        gap: 15px;
    }
    .nav-links {
        flex-wrap: wrap;
        justify-content: center;
    }
}
/* 登录遮罩层 */
#login-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 3000;
    display: none;
}

/* 购物车模态样式（统一） */
#cart-modal, .cart-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 3001;
    background: #fff;
    width: 90%;
    max-width: 520px;
    border-radius: 12px;
    box-shadow: 0 18px 40px rgba(0,0,0,0.35);
    display: none;
    overflow: hidden;
    font-family: inherit;
}

#cart-modal .cart-header, .cart-modal .cart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 18px;
    background: linear-gradient(90deg,var(--primary),var(--secondary));
    color: #fff;
}

.cart-modal .cart-header h3 {
    margin: 0;
    font-size: 1.1rem;
}

.cart-modal .close-cart {
    background: transparent;
    border: none;
    color: #fff;
    font-size: 1.4rem;
    cursor: pointer;
    padding: 6px 8px;
    border-radius: 6px;
}

.cart-modal .close-cart:hover {
    background: rgba(255,255,255,0.08);
    transform: scale(1.05);
}

.cart-modal .cart-items {
    padding: 16px;
    max-height: 360px;
    overflow-y: auto;
    background: #fafafa;
}

.cart-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-radius: 8px;
    background: #fff;
    margin-bottom: 10px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.04);
}

.cart-item .name {
    font-weight: 600;
    color: var(--dark);
}
.cart-item .price {
    color: var(--danger);
    font-weight: 700;
}
.cart-item .remove {
    background: transparent;
    border: none;
    color: var(--danger);
    cursor: pointer;
    font-size: 0.95rem;
}

.cart-modal .cart-footer {
    padding: 14px 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #fff;
    border-top: 1px solid #eee;
}

.checkout-btn {
    background-color: var(--accent);
    color: var(--dark);
    padding: 10px 16px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    font-weight: 700;
}

.checkout-btn:hover {
    filter: brightness(0.98);
}

/* 购物车遮罩 */
#cart-overlay, .cart-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.45);
    z-index: 3000;
    display: none;
}

/* 搜索栏按钮修复：确保按钮与输入高度一致，避免塌陷 */
.search-bar {
    display: flex;
    align-items: center;
    gap: 0;
}
.search-bar input {
    flex: 1;
    padding: 12px 18px;
    border: none;
    font-size: 1rem;
    height: 44px;
}
.search-bar button {
    padding: 0 22px;
    height: 44px;
    border: none;
    background-color: var(--accent);
    color: var(--dark);
    font-weight: bold;
    cursor: pointer;
    border-radius: 0 22px 22px 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.search-bar button:hover {
    background-color: #ffd700;
}
