/* =========================================
   1. 全局变量与重置 (Global Variables & Reset)
   ========================================= */
:root {
    --ikea-blue: #0058A3;
    --ikea-yellow: #FFCC00;
    --light-gray: #F5F5F5;
    --dark-gray: #333333;
    --mid-gray: #666666;
    --border-gray: #E0E0E0;
    --spacing-unit: 20px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: "Arial", "Microsoft YaHei", sans-serif;
    color: var(--dark-gray);
    background-color: #fff;
    line-height: 1.6;
}

a { text-decoration: none; color: inherit; }
ul { list-style: none; }
button { cursor: pointer; border: none; background: none; }

/* 通用工具类 */
.container { max-width: 1200px; margin: 0 auto; padding: 0 var(--spacing-unit); }
.hidden { display: none !important; }
.btn {
    display: inline-block;
    padding: 10px 25px;
    font-size: 14px;
    font-weight: 600;
    border-radius: 2px;
    transition: background-color 0.3s ease;
}
.btn-primary { background-color: var(--ikea-blue); color: white; }
.btn-primary:hover { background-color: #004A8C; }
.btn-secondary { background-color: var(--light-gray); color: var(--dark-gray); }
.btn-secondary:hover { background-color: #EAEAEA; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* =========================================
   2. 头部导航 (Header & Navigation)
   ========================================= */
.site-header {
    border-bottom: 1px solid var(--border-gray);
    position: sticky;
    top: 0;
    background-color: white;
    z-index: 100;
}

.header-top {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    font-size: 13px;
    color: var(--mid-gray);
}

.header-top-left, .header-top-right { display: flex; gap: 20px; }

.header-main { display: flex; flex-direction: column; }

.header-logo { padding: 15px 0; }
.header-logo img { height: 40px; display: block; }

.header-nav {
    display: flex;
    gap: 40px;
    padding: 10px 0;
    font-weight: 500;
    border-top: 1px solid var(--border-gray);
}

.header-nav li:hover { color: var(--ikea-blue); }

.cart-icon { position: relative; font-weight: 600; }
.cart-count {
    position: absolute;
    top: -8px;
    right: -12px;
    background-color: var(--ikea-yellow);
    color: var(--dark-gray);
    font-size: 11px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

/* =========================================
   3. 首页 (Home Page)
   ========================================= */
.banner {
    position: relative;
    height: 500px;
    margin-bottom: 40px;
    overflow: hidden;
}

.banner img { width: 100%; height: 100%; object-fit: cover; }

.banner-text {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: white;
    text-shadow: 0 2px 4px rgba(0,0,0,0.5);
}
.banner-text h1 { font-size: 48px; margin-bottom: 20px; }

.section-title {
    font-size: 24px;
    margin-bottom: 30px;
    text-align: center;
    font-weight: 700;
}

.category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 50px;
}

.category-card {
    position: relative;
    height: 300px;
    overflow: hidden;
    cursor: pointer;
}

.category-card img {
    width: 100%; height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.category-card:hover img { transform: scale(1.05); }

.category-card-text {
    position: absolute;
    bottom: 0; width: 100%;
    padding: 20px;
    background: linear-gradient(transparent, rgba(0,0,0,0.7));
    color: white;
}

/* =========================================
   4. 产品列表页 (Product List Page)
   ========================================= */
.filter-layout { display: flex; gap: 30px; margin-bottom: 50px; }
.sidebar-filter { width: 220px; flex-shrink: 0; }

.filter-title { font-weight: 700; margin-bottom: 15px; border-bottom: 1px solid var(--border-gray); padding-bottom: 5px; }
.filter-group { margin-bottom: 25px; }
.filter-options li {
    margin-bottom: 8px;
    font-size: 14px;
    cursor: pointer;
    color: var(--mid-gray);
}
.filter-options li.active, .filter-options li:hover { color: var(--ikea-blue); font-weight: 600; }

.product-content { flex: 1; }
.sort-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border-gray);
    padding-bottom: 10px;
}

.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 30px;
}

.product-card {
    border: 1px solid transparent;
    transition: all 0.3s;
    cursor: pointer;
}
.product-card:hover { border-color: var(--border-gray); box-shadow: 0 4px 12px rgba(0,0,0,0.05); }

.product-img { height: 220px; overflow: hidden; background-color: #f9f9f9; }
.product-img img { width: 100%; height: 100%; object-fit: cover; }

.product-info { padding: 15px; }
.product-name { font-size: 14px; font-weight: 700; margin-bottom: 5px; }
.product-price { font-size: 18px; font-weight: 700; margin-bottom: 10px; }

/* =========================================
   5. 产品详情页 (Detail Page)
   ========================================= */
.detail-container { display: flex; gap: 40px; margin: 40px 0; }
.detail-gallery { flex: 1.5; }
.main-img { height: 450px; margin-bottom: 15px; background-color: #f9f9f9; }
.main-img img { width: 100%; height: 100%; object-fit: contain; }

.thumb-img-list { display: flex; gap: 10px; }
.thumb-item { width: 80px; height: 80px; border: 1px solid var(--border-gray); cursor: pointer; object-fit: cover; }
.thumb-item.active { border-color: var(--ikea-blue); border-width: 2px; }

.detail-info { flex: 1; }
.detail-name { font-size: 28px; margin-bottom: 10px; }
.detail-price { font-size: 32px; font-weight: 700; color: var(--ikea-blue); margin-bottom: 20px; }
.detail-desc { color: var(--mid-gray); margin-bottom: 30px; }

.selector-group { margin-bottom: 20px; }
.selector-group h4 { font-size: 14px; margin-bottom: 10px; }

.color-options { display: flex; gap: 10px; }
.color-option { width: 30px; height: 30px; border-radius: 50%; cursor: pointer; border: 2px solid white; outline: 1px solid var(--border-gray); }
.color-option.active { outline: 2px solid var(--ikea-blue); }

.size-options .size-option {
    display: inline-block;
    padding: 8px 15px;
    margin: 0 10px 10px 0;
    border: 1px solid var(--border-gray);
    cursor: pointer;
}
.size-option.active { border-color: var(--ikea-blue); background-color: #e6f0fa; }

.add-to-cart-btn { width: 100%; padding: 15px; margin-top: 20px; }

.qty-group { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.qty-input { width: 60px; height: 30px; border: 1px solid var(--border-gray); text-align: center; }

/* 登录页 */
.login-bg { min-height: 70vh; background: none; display: flex; align-items: center; justify-content: center; padding: 60px 20px; position: relative; }
.login-bg::before { content: ''; position: absolute; inset: 0; background: url('../images/log.png') center/cover no-repeat; opacity: 0.45; pointer-events: none; }
.glass-card { position: relative; z-index: 1; width: 100%; max-width: 420px; border-radius: 16px; padding: 30px; background: rgba(255,255,255,0.25); box-shadow: 0 8px 32px rgba(31,38,135,0.37); backdrop-filter: blur(12px) saturate(180%); -webkit-backdrop-filter: blur(12px) saturate(180%); border: 1px solid rgba(255,255,255,0.3); }
.login-title { text-align: center; margin-bottom: 20px; font-size: 22px; font-weight: 700; }
.login-form .form-row { margin-bottom: 15px; }
.login-form label { display: block; font-size: 13px; color: var(--mid-gray); margin-bottom: 6px; }
.login-form input { width: 100%; padding: 12px; border: 1px solid var(--border-gray); border-radius: 6px; background: rgba(255,255,255,0.7); }
.login-form input:focus { outline: none; border-color: var(--ikea-blue); box-shadow: 0 0 0 3px rgba(0,88,163,0.1); }
.form-actions { display: flex; gap: 10px; align-items: center; justify-content: space-between; }

/* =========================================
   6. 个人中心/购物车 (Profile & Cart)
   ========================================= */
.profile-layout { display: flex; gap: 30px; margin-top: 40px; }
.profile-sidebar { width: 240px; border: 1px solid var(--border-gray); height: fit-content; }
.profile-avatar { padding: 30px; text-align: center; border-bottom: 1px solid var(--border-gray); }
.avatar-circle { width: 60px; height: 60px; background: var(--light-gray); border-radius: 50%; margin: 0 auto 10px; line-height: 60px; font-weight: bold; }

.profile-menu li { padding: 15px 20px; border-bottom: 1px solid var(--light-gray); cursor: pointer; }
.profile-menu li.active { border-left: 4px solid var(--ikea-blue); background-color: #fafafa; font-weight: bold; }

.profile-content { flex: 1; }
.cart-header { display: flex; justify-content: space-between; border-bottom: 1px solid var(--border-gray); padding-bottom: 15px; margin-bottom: 20px; }

.cart-item { display: flex; gap: 20px; padding: 20px 0; border-bottom: 1px solid var(--light-gray); }
.cart-item-img { width: 100px; height: 100px; object-fit: cover; }
.cart-info { flex: 1; }
.cart-controls { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.qty-btn { width: 25px; height: 25px; border: 1px solid var(--border-gray); display: flex; align-items: center; justify-content: center; }
.cart-subtotal { color: var(--mid-gray); font-size: 12px; }

.cart-summary { margin-top: 30px; text-align: right; }
.total-row { font-size: 20px; font-weight: bold; margin-bottom: 20px; display: flex; justify-content: flex-end; gap: 20px; }
.checkout-btn { width: 200px; }
.summary-actions { display: flex; justify-content: flex-end; gap: 10px; }

/* =========================================
   7. 页脚 (Footer)
   ========================================= */
.site-footer { background-color: var(--dark-gray); color: white; padding: 60px 0 20px; margin-top: 80px; }
.footer-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 40px; margin-bottom: 40px; }
.footer-col h3 { font-size: 14px; margin-bottom: 20px; }
.footer-col li { margin-bottom: 10px; font-size: 13px; color: #ccc; cursor: pointer; }
.footer-col li:hover { color: white; text-decoration: underline; }
.copyright { text-align: center; font-size: 12px; color: #999; border-top: 1px solid #444; padding-top: 20px; }

/* 现代轻奢风 Logo */
.logo-luxury {
    font-family: sans-serif;
    font-size: 28px;
    font-weight: 300; /* 极细字体 */
    color: #333;
    letter-spacing: 5px;
    position: relative;
    z-index: 1;
}

.logo-luxury span {
    font-weight: 700; /* 后半部分加粗 */
}

/* 添加一个背景色块装饰 */
.logo-luxury::before {
    content: '';
    position: absolute;
    width: 100%;
    height: 10px;
    bottom: 5px;
    left: -5px;
    background-color: rgba(255, 215, 0, 0.3); /* 淡金色半透明背景 */
    z-index: -1;
}

.nav-toggle { display: none; padding: 8px 12px; border: 1px solid var(--border-gray); border-radius: 2px; background: var(--light-gray); }
.filter-toggle { display: none; }

@media (max-width: 992px) {
    .banner { height: 380px; }
    .banner-text h1 { font-size: 32px; }
    .section-title { font-size: 20px; }
    .product-grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 20px; }
    .detail-container { flex-direction: column; }
    .main-img { height: 360px; }
    .thumb-item { width: 60px; height: 60px; }
    .profile-layout { flex-direction: column; }
    .profile-sidebar { width: 100%; }
}

@media (max-width: 768px) {
    .container { padding: 0 12px; }
    .header-top { display: none; }
    .nav-toggle { display: inline-block; margin-left: auto; }
    .header-logo { display: flex; align-items: center; }
    .header-main { position: relative; }
    .header-nav { display: none; position: absolute; left: 0; right: 0; top: 100%; background: #fff; border-top: 1px solid var(--border-gray); padding: 12px; box-shadow: 0 8px 16px rgba(0,0,0,0.06); flex-direction: column; gap: 8px; word-break: keep-all; }
    .header-nav.open { display: flex; }
    .header-nav a { display: block; padding: 10px 14px; border-radius: 6px; background: #f8f8f8; font-size: 16px; }
    .header-nav a:hover { background: #eee; }
    .logo-luxury { font-size: 24px; letter-spacing: 2px; }
    .banner { height: 260px; }
    .category-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
    .filter-layout { flex-direction: column; gap: 16px; }
    .sidebar-filter { display: none; width: 100%; }
    .sidebar-filter.open { display: block; }
    .sort-bar { gap: 10px; }
    .filter-toggle { display: inline-block; }
    .product-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
    .product-img { height: 160px; }
    .product-name { font-size: 13px; }
    .product-price { font-size: 16px; }
    .banner-text h1 { font-size: 28px; }
    .banner-text p { font-size: 14px; }
    .btn { padding: 10px 18px; }
    .detail-name { font-size: 22px; }
    .detail-price { font-size: 26px; }
    .main-img { height: 280px; }
    .profile-sidebar { order: -1; }
    .cart-item-img { width: 80px; height: 80px; }
    .qty-btn { width: 32px; height: 32px; }
    .login-bg { min-height: 100vh; padding: 40px 16px; }
    .glass-card { max-width: 100%; }
}
