/* ===== 品艺家居 - 品牌样式 ===== */

/* 品牌色 */
:root {
    --primary: #8B4513;
    --primary-light: #A0522D;
    --primary-dark: #6B3410;
    --accent: #D4A574;
    --gold: #C9A96E;
    --bg-warm: #FFF8F0;
    --bg-cream: #FAF5EF;
    --text-dark: #2C1810;
    --text-muted: #8B7355;
    --font-serif: 'Georgia', 'Noto Serif SC', serif;
}

/* 全局 */
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
    color: #333;
    background: #fff;
}

/* 导航栏 */
.navbar {
    padding: 16px 0;
    transition: all .3s;
    z-index: 1030;
}

.navbar.sticky-top {
    backdrop-filter: blur(8px);
    background: rgba(255,255,255,.95) !important;
}

.navbar .brand-text {
    font-size: 24px;
    font-weight: 700;
    color: var(--primary);
    letter-spacing: 2px;
}

.navbar .nav-link {
    font-size: 15px;
    padding: 8px 16px !important;
    color: #555 !important;
    position: relative;
    transition: color .3s;
}

.navbar .nav-link:hover,
.navbar .nav-link.active {
    color: var(--primary) !important;
}

.navbar .nav-link.active::after {
    content: '';
    position: absolute;
    bottom: 2px;
    left: 16px;
    right: 16px;
    height: 2px;
    background: var(--primary);
}

/* Hero 区域 */
.hero-section {
    background: linear-gradient(135deg, var(--bg-warm) 0%, var(--bg-cream) 100%);
    padding: 80px 0;
    position: relative;
    overflow: hidden;
}

.hero-section h1 {
    font-size: 48px;
    font-weight: 700;
    color: var(--text-dark);
    line-height: 1.2;
}

.hero-section .hero-subtitle {
    font-size: 18px;
    color: var(--text-muted);
    max-width: 500px;
}

.hero-image-wrapper {
    position: relative;
    text-align: center;
}

.hero-image-wrapper img {
    max-width: 100%;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(139,69,19,.15);
}

/* 通用标题 */
.section-title {
    text-align: center;
    margin-bottom: 48px;
}

.section-title h2 {
    font-size: 32px;
    font-weight: 700;
    color: var(--text-dark);
    position: relative;
    display: inline-block;
}

.section-title h2::after {
    content: '';
    display: block;
    width: 60px;
    height: 3px;
    background: var(--primary);
    margin: 12px auto 0;
}

.section-title p {
    color: var(--text-muted);
    margin-top: 12px;
}

/* 产品卡片 */
.product-card {
    border: none;
    border-radius: 12px;
    overflow: hidden;
    transition: transform .3s, box-shadow .3s;
    background: #fff;
    box-shadow: 0 2px 12px rgba(0,0,0,.06);
}

.product-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 12px 30px rgba(139,69,19,.12);
}

.product-card .card-img-top {
    height: 280px;
    object-fit: cover;
    transition: transform .5s;
    background: #f0ece6; /* 占位底色 */
    aspect-ratio: 1 / 1;
}

/* 图片加载中底色（所有 img 泛用） */
img {
    color: transparent; /* 防止 alt 文字在加载中闪烁 */
    background: #f0ece6;
}
img[loading="lazy"] {
    opacity: 0;
    transition: opacity .3s;
}
img[loading="lazy"].loaded,
img[loading="lazy"]:not([src^="data:"]):not([src=""]) {
    opacity: 1;
}

/* 产品详情轮播图 */
.product-detail .carousel-item img {
    aspect-ratio: 1 / 1;
    background: #f0ece6;
}

/* 缩略图 */
.product-detail .d-flex.gap-2.mt-3 img {
    aspect-ratio: 1 / 1;
    background: #f0ece6;
}

/* Hero 图片 */
.hero-image-wrapper img {
    aspect-ratio: 6 / 5;
    background: #f0ece6;
}

.product-card:hover .card-img-top {
    transform: scale(1.05);
}

.product-card .card-body {
    padding: 20px;
}

.product-card .product-name {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 8px;
}

.product-card .product-category {
    font-size: 13px;
    color: var(--text-muted);
}

.product-card .product-price {
    font-size: 22px;
    font-weight: 700;
    color: var(--primary);
}

.product-card .product-original-price {
    font-size: 14px;
    color: #999;
    text-decoration: line-through;
    margin-left: 8px;
}

/* 品牌故事 */
.brand-story {
    background: var(--bg-cream);
    padding: 80px 0;
}

.brand-story h2 {
    font-size: 36px;
    font-weight: 700;
    color: var(--text-dark);
}

.brand-story .story-text {
    font-size: 16px;
    line-height: 1.8;
    color: #666;
}

/* 品牌优势 */
.advantage-card {
    text-align: center;
    padding: 32px 20px;
    border-radius: 12px;
    transition: transform .3s;
}

.advantage-card:hover {
    transform: translateY(-4px);
}

.advantage-card .advantage-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 16px;
    background: var(--bg-warm);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    color: var(--primary);
}

.advantage-card h5 {
    font-weight: 600;
    color: var(--text-dark);
}

.advantage-card p {
    font-size: 14px;
    color: var(--text-muted);
}

/* 按钮 */
.btn-primary {
    background: var(--primary);
    border-color: var(--primary);
}

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

.btn-outline-primary {
    color: var(--primary);
    border-color: var(--primary);
}

.btn-outline-primary:hover {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

/* 产品列表 */
.product-list-header {
    background: var(--bg-warm);
    padding: 40px 0;
}

.product-list-header h1 {
    color: var(--text-dark);
    font-weight: 700;
}

/* 分类筛选 */
.category-filter .btn {
    border-radius: 20px;
    padding: 6px 20px;
    margin: 4px;
    font-size: 14px;
}

.category-filter .btn.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

/* 产品详情 */
.product-detail .price-display {
    font-size: 32px;
    font-weight: 700;
    color: var(--primary);
}

.product-detail .spec-list {
    list-style: none;
    padding: 0;
}

.product-detail .spec-list li {
    padding: 8px 0;
    border-bottom: 1px solid #eee;
    display: flex;
}

.product-detail .spec-list li strong {
    width: 100px;
    color: #666;
}

/* 关于页 */
.about-hero {
    background: linear-gradient(135deg, var(--text-dark), var(--primary-dark));
    color: #fff;
    padding: 80px 0;
}

.about-hero h1 {
    font-size: 42px;
    font-weight: 700;
}

/* 联系我们 */
.contact-section {
    padding: 60px 0;
}

.contact-info-card {
    padding: 32px;
    border-radius: 12px;
    background: var(--bg-warm);
    text-align: center;
}

.contact-info-card .contact-icon {
    width: 56px;
    height: 56px;
    margin: 0 auto 12px;
    background: var(--primary);
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

/* 下单页面 */
.order-form-section {
    padding: 40px 0;
}

/* 空状态 */
.empty-state {
    padding: 60px 20px;
    text-align: center;
    color: var(--text-muted);
}

.empty-state i {
    font-size: 48px;
    margin-bottom: 16px;
}

/* 页脚 */
.footer {
    margin-top: 0;
}

.footer p,
.footer li,
.footer small {
    color: rgba(255,255,255,0.68) !important;
}

.footer a {
    color: rgba(255,255,255,0.78) !important;
    text-decoration: none;
    transition: color .2s;
}

.footer a:hover {
    color: var(--accent) !important;
    text-decoration: none;
}

.footer h6 {
    color: #fff !important;
}

.footer .list-unstyled li {
    margin-bottom: 6px;
}

/* 提示消息 */
.alert-auto-hide {
    transition: opacity .5s;
}

/* 响应式 */
@media (max-width: 768px) {
    .hero-section h1 {
        font-size: 32px;
    }

    .hero-section {
        padding: 40px 0;
    }

    .section-title h2 {
        font-size: 24px;
    }

    .product-card .card-img-top {
        height: 220px;
    }
}

/* ===== AI 智能助手 ===== */
#ai-chat-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
}

/* 浮动按钮 */
#ai-chat-toggle {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(139,69,19,0.3);
    transition: transform .3s, box-shadow .3s;
    position: relative;
}

#ai-chat-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 24px rgba(139,69,19,0.4);
}

#ai-chat-toggle::after {
    content: '';
    width: 10px;
    height: 10px;
    background: #22c55e;
    border: 2px solid #fff;
    border-radius: 50%;
    position: absolute;
    bottom: 2px;
    right: 2px;
}

/* 对话框 */
#ai-chat-dialog {
    position: absolute;
    bottom: 68px;
    right: 0;
    width: 440px;
    height: 540px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 8px 40px rgba(0,0,0,0.15);
    display: none;
    flex-direction: column;
    overflow: hidden;
    animation: ai-slide-up .3s ease;
}

@keyframes ai-slide-up {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: translateY(0); }
}

#ai-chat-container.open #ai-chat-dialog {
    display: flex;
}

/* 头部 */
#ai-chat-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px 20px;
    background: var(--primary);
    color: #fff;
}

.ai-chat-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255,255,255,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
}

.ai-chat-title {
    flex: 1;
    font-weight: 600;
    font-size: 15px;
}

#ai-chat-close {
    width: 28px;
    height: 28px;
    border: none;
    background: rgba(255,255,255,0.2);
    color: #fff;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .2s;
}

#ai-chat-close:hover {
    background: rgba(255,255,255,0.35);
}

/* 消息区域 */
#ai-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    background: #f8f6f4;
}

#ai-chat-messages .message {
    margin-bottom: 12px;
    max-width: 85%;
    line-height: 1.6;
    font-size: 14px;
    word-wrap: break-word;
}

#ai-chat-messages .message.user {
    margin-left: auto;
    background: var(--primary);
    color: #fff;
    padding: 10px 16px;
    border-radius: 16px 16px 4px 16px;
}

#ai-chat-messages .message.assistant {
    margin-right: auto;
    background: #fff;
    color: #333;
    padding: 10px 16px;
    border-radius: 16px 16px 16px 4px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

#ai-chat-messages .message.assistant a.ai-product-link {
    color: var(--primary);
    text-decoration: underline;
    font-weight: 500;
}

#ai-chat-messages .message.assistant a.ai-product-link:hover {
    color: var(--primary-light);
}

/* 产品卡片区 */
.ai-product-cards {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

.ai-product-card {
    display: flex;
    gap: 10px;
    background: #fff;
    border: 1px solid #e8e0d8;
    border-radius: 10px;
    padding: 8px;
    text-decoration: none;
    color: inherit;
    transition: border-color .2s, box-shadow .2s;
    width: calc(50% - 4px);
    min-width: 0;
}

.ai-product-card:hover {
    border-color: var(--primary);
    box-shadow: 0 2px 8px rgba(139,69,19,0.1);
    text-decoration: none;
}

.ai-product-card img {
    width: 48px;
    height: 48px;
    border-radius: 8px;
    object-fit: cover;
    flex-shrink: 0;
}

.ai-product-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.ai-product-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-dark);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ai-product-price {
    font-size: 14px;
    font-weight: 700;
    color: var(--primary);
    margin-top: 2px;
}

/* thinking 动画 */
.ai-thinking {
    display: inline-flex;
    gap: 4px;
    align-items: center;
    padding: 4px 0;
}

.ai-thinking span {
    width: 6px;
    height: 6px;
    background: var(--text-muted);
    border-radius: 50%;
    animation: ai-bounce 1.4s infinite ease-in-out both;
}

.ai-thinking span:nth-child(1) { animation-delay: -0.32s; }
.ai-thinking span:nth-child(2) { animation-delay: -0.16s; }
.ai-thinking span:nth-child(3) { animation-delay: 0s; }

@keyframes ai-bounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

/* 错误消息 */
.ai-error {
    color: #dc2626;
}

/* 输入区域 */
#ai-chat-input-area {
    display: flex;
    gap: 8px;
    padding: 12px 16px;
    border-top: 1px solid #eee;
    background: #fff;
}

#ai-chat-input {
    flex: 1;
    border: 1px solid #ddd;
    border-radius: 20px;
    padding: 8px 16px;
    font-size: 14px;
    outline: none;
    resize: none;
    font-family: inherit;
    line-height: 1.4;
    max-height: 120px;
}

#ai-chat-input:focus {
    border-color: var(--primary);
}

#ai-chat-input::placeholder {
    color: #aaa;
}

#ai-chat-input:disabled {
    background: #f5f5f5;
    cursor: not-allowed;
}

#ai-chat-send {
    width: 36px;
    height: 36px;
    border: none;
    background: var(--primary);
    color: #fff;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background .2s;
}

#ai-chat-send:hover {
    background: var(--primary-light);
}

#ai-chat-send:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* 移动端适配 */
@media (max-width: 480px) {
    #ai-chat-dialog {
        width: calc(100vw - 32px);
        height: 60vh;
        right: -8px;
        bottom: 64px;
    }

    #ai-chat-container {
        bottom: 16px;
        right: 16px;
    }

    .ai-product-card {
        width: 100%;
    }
}

/* ===== 轮播图 ===== */
.carousel-section {
    margin-bottom: 0;
}

.carousel-img {
    height: 500px;
    object-fit: cover;
}

.carousel-caption {
    bottom: 80px;
    text-shadow: 0 2px 8px rgba(0,0,0,.4);
}

.carousel-caption .carousel-title {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 12px;
    letter-spacing: 2px;
}

.carousel-caption .carousel-subtitle {
    font-size: 1.15rem;
    opacity: .95;
    margin-bottom: 10px;
}

.carousel-indicators button {
    width: 40px;
    height: 4px;
    border-radius: 2px;
    margin: 0 4px;
}

.carousel-control-prev-icon,
.carousel-control-next-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background-color: rgba(0,0,0,.25);
    background-size: 50%;
}

@media (max-width: 768px) {
    .carousel-img {
        height: 280px;
    }
    .carousel-caption .carousel-title {
        font-size: 1.4rem;
    }
    .carousel-caption .carousel-subtitle {
        font-size: .95rem;
    }
    .carousel-caption {
        bottom: 40px;
    }
}
