/* ============================================
   优品科技商城 - 优化版样式
   设计理念：现代、简洁、专业
   主色调：科技蓝 + 活力橙
   ============================================ */

/* ---------- 基础重置与变量 ---------- */
:root {
    /* 主色调 */
    --primary-color: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #3b82f6;
    
    /* 辅助色 */
    --accent-color: #f59e0b;
    --accent-dark: #d97706;
    --success-color: #10b981;
    --danger-color: #ef4444;
    
    /* 中性色 */
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --text-muted: #9ca3af;
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-tertiary: #f1f5f9;
    --border-color: #e5e7eb;
    
    /* 阴影 */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    
    /* 圆角 */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 9999px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--bg-secondary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a {
    text-decoration: none;
    color: inherit;
    transition: all 0.3s ease;
}

ul {
    list-style: none;
}

img {
    max-width: 100%;
    height: auto;
}

input, button {
    outline: none;
    border: none;
    font-family: inherit;
}

/* ---------- 布局工具类 ---------- */
.w1200 {
    max-width: 1224px;
    margin: 0 auto;
    padding: 0 20px;
}

.w100 {
    width: 100%;
    background: var(--bg-primary);
}

.pb30 {
    padding-bottom: 40px;
}

/* ---------- 顶部导航栏 ---------- */
.toptou {
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary-color) 100%);
    height: 42px;
    line-height: 42px;
    color: rgba(255, 255, 255, 0.9);
    font-size: 13px;
}

.toptou .w1200 {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.huanying {
    font-weight: 500;
}

.topright {
    display: flex;
    align-items: center;
    gap: 20px;
}

.topright a {
    color: rgba(255, 255, 255, 0.9);
    padding: 4px 12px;
    border-radius: var(--radius-sm);
    transition: all 0.3s ease;
}

.topright a:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.15);
}

/* ---------- 头部搜索区域 ---------- */
.header-main {
    background: var(--bg-primary);
    padding: 20px 0;
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-main .w1200 {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 40px;
}

.logo {
    flex-shrink: 0;
}

.logo_text {
    font-size: 32px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--accent-color) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    cursor: pointer;
    letter-spacing: -0.5px;
}

.sousuo {
    flex: 1;
    max-width: 600px;
}

.ssbox {
    display: flex;
    align-items: center;
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-full);
    overflow: hidden;
    transition: all 0.3s ease;
}

.ssbox:focus-within {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}

.sinput {
    flex: 1;
    height: 48px;
    padding: 0 20px;
    font-size: 15px;
    background: transparent;
    color: var(--text-primary);
}

.sinput::placeholder {
    color: var(--text-muted);
}

.sbtn {
    width: 60px;
    height: 48px;
    background: var(--primary-color);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.sbtn:hover {
    background: var(--primary-dark);
}

.sbtn::before {
    content: "";
    width: 20px;
    height: 20px;
    background: url(../../img/ypkj/glass.svg) center center no-repeat;
    background-size: contain;
    filter: brightness(0) invert(1);
}

.gouwuche {
    position: relative;
}

.gwc {
    width: 50px;
    height: 50px;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.gwc::before {
    content: "";
    width: 24px;
    height: 24px;
    background: url(../../img/ypkj/gwc.svg) center center no-repeat;
    background-size: contain;
}

.gwc:hover {
    background: var(--primary-color);
}

.gwc:hover::before {
    filter: brightness(0) invert(1);
}

.gico {
    position: absolute;
    top: -5px;
    right: -5px;
    min-width: 20px;
    height: 20px;
    background: var(--danger-color);
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 6px;
    box-shadow: var(--shadow-sm);
}

/* ---------- 主导航 ---------- */
.daohang {
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
    padding: 0;
}

.daohang ul {
    display: flex;
    gap: 8px;
}

.daohang ul li {
    position: relative;
}

.daohang ul li a {
    display: block;
    padding: 16px 24px;
    font-size: 15px;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all 0.3s ease;
    position: relative;
}

.daohang ul li a::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 3px;
    background: var(--primary-color);
    border-radius: 3px 3px 0 0;
    transition: all 0.3s ease;
}

.daohang ul li:hover a,
.daohang ul li.cur a {
    color: var(--primary-color);
}

.daohang ul li:hover a::after,
.daohang ul li.cur a::after {
    width: 60%;
}

/* ---------- 主内容区域 ---------- */
.main-content {
    display: flex;
    gap: 24px;
    padding: 24px 0;
    min-height: 600px;
    align-items: flex-start;
}

/* ---------- 左侧分类树 ---------- */
.mleft {
    width: 260px;
    flex-shrink: 0;
}

.scroll-div {
    position: sticky;
    top: 100px;
}

.msou {
    margin-bottom: 16px;
    position: relative;
}

.msinput {
    width: 100%;
    height: 44px;
    padding: 0 44px 0 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 14px;
    background: var(--bg-primary);
    transition: all 0.3s ease;
}

.msinput:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.msinput::placeholder {
    color: var(--text-muted);
}

.mico {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    background: url(../../img/ypkj/mico.svg) center center no-repeat;
    background-size: contain;
    opacity: 0.5;
    cursor: pointer;
}

.tree {
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    overflow: hidden;
    max-height: calc(100vh - 200px);
    overflow-y: auto;
}

.tree li {
    border-bottom: 1px solid var(--border-color);
}

.tree li:last-child {
    border-bottom: none;
}

.tree li span,
.tree li .a1,
.tree li .a2 {
    display: flex;
    align-items: center;
    padding: 14px 16px;
    color: var(--text-primary);
    font-size: 14px;
    transition: all 0.2s ease;
    cursor: pointer;
}

.tree li span:hover,
.tree li .a1:hover,
.tree li .a2:hover,
.tree li span.cur,
.tree li .a1.cur,
.tree li .a2.cur {
    background: var(--bg-secondary);
    color: var(--primary-color);
}

.ico, .ico2 {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 12px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
}

.ico img, .ico2 img {
    width: 18px;
    height: 18px;
    object-fit: contain;
}

.stitle, .stitle2 {
    flex: 1;
    font-weight: 500;
}

.icon-plus-sign,
.icon-minus-sign {
    width: 16px;
    height: 16px;
    opacity: 0.4;
    transition: all 0.2s ease;
}

.tree li:hover .icon-plus-sign,
.tree li:hover .icon-minus-sign {
    opacity: 0.7;
}

/* 子分类样式 */
.tree li .a2 {
    padding-left: 32px;
    font-size: 13px;
    color: var(--text-secondary);
}

.tree li .a2::before {
    content: "";
    width: 6px;
    height: 6px;
    background: var(--border-color);
    border-radius: 50%;
    margin-right: 12px;
}

.tree li .a2:hover::before,
.tree li .a2.cur::before {
    background: var(--primary-color);
}

/* ---------- 右侧内容区 ---------- */
.mright {
    flex: 1;
    min-width: 0;
}

.rbox {
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    overflow: hidden;
    margin-bottom: 24px;
}

.mtitle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
}

.mtitfont {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    position: relative;
    padding-left: 16px;
}

.mtitfont::before {
    content: "";
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 20px;
    background: linear-gradient(180deg, var(--primary-color) 0%, var(--accent-color) 100%);
    border-radius: 2px;
}

/* ---------- 商品列表 ---------- */
.proul {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1px;
    background: var(--border-color);
    padding: 1px;
}

.proul li {
    background: var(--bg-primary);
    padding: 20px;
    position: relative;
    transition: all 0.3s ease;
}

.proul li:hover {
    z-index: 10;
    box-shadow: var(--shadow-xl);
    transform: translateY(-4px);
}

.proimg {
    aspect-ratio: 3/4;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    border-radius: var(--radius-md);
    background: var(--bg-secondary);
}

.proimg img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    transition: transform 0.5s ease;
}

.proul li:hover .proimg img {
    transform: scale(1.05);
}

.quehuo {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    padding: 12px 24px;
    border-radius: var(--radius-full);
    font-size: 14px;
    font-weight: 500;
    z-index: 20;
    backdrop-filter: blur(4px);
}

.discount_text {
    position: absolute;
    top: 12px;
    left: 12px;
    background: linear-gradient(135deg, var(--danger-color) 0%, #dc2626 100%);
    color: #fff;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 600;
    z-index: 5;
    box-shadow: var(--shadow-sm);
}

.protit {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.protit-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 42px;
}

.proul li:hover .protit-name {
    color: var(--primary-color);
}

/* 商品卡片底部布局 */
.protit-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 8px;
}

.price {
    font-size: 18px;
    font-weight: 700;
    color: var(--danger-color);
    position: relative;
}

.price::before {
    content: "€";
    font-size: 14px;
    margin-right: 2px;
}

.cart-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.add-cart {
    cursor: pointer;
    transition: all 0.3s ease;
}

.add-cart img {
    width: 32px;
    height: 32px;
    padding: 6px;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    transition: all 0.3s ease;
}

.add-cart:hover img {
    background: var(--primary-color);
    filter: brightness(0) invert(1);
}

/* 数量选择器 */
.cart_quantity {
    display: flex;
    align-items: center;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    overflow: hidden;
    height: 32px;
}

.cart_quantity span {
    width: 28px;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-secondary);
    cursor: pointer;
    font-size: 16px;
    color: var(--text-secondary);
    transition: all 0.2s ease;
    user-select: none;
}

.cart_quantity span:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.cart_quantity span:first-child::after {
    content: "-";
}

.cart_quantity span:nth-child(2)::after {
    content: "+";
}

.cart_quantity input {
    width: 40px;
    height: 100%;
    text-align: center;
    font-size: 14px;
    font-weight: 500;
    border-left: 1px solid var(--border-color);
    border-right: 1px solid var(--border-color);
    color: var(--text-primary);
}

/* ---------- 底部 ---------- */
.bottom {
    background: var(--bg-primary);
    border-top: 1px solid var(--border-color);
    padding: 48px 0;
    text-align: center;
    color: var(--text-secondary);
    font-size: 14px;
}

.bottom .w1200 {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.bottom font {
    color: var(--primary-color);
    font-weight: 600;
}

/* ---------- 分页 ---------- */
#fy {
    padding: 24px;
    display: flex;
    justify-content: center;
}

.layui-laypage {
    display: flex;
    gap: 8px;
}

.layui-laypage a,
.layui-laypage span {
    min-width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    background: var(--bg-primary);
    color: var(--text-secondary);
    font-size: 14px;
    transition: all 0.3s ease;
}

.layui-laypage a:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.layui-laypage .layui-laypage-curr {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: #fff;
}

/* ---------- 搜索建议 ---------- */
.suggestionsBox {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    width: 100%;
    background: var(--bg-primary);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    overflow: hidden;
}

.suggestionList li {
    padding: 12px 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--text-primary);
}

.suggestionList li:hover {
    background: var(--bg-secondary);
    color: var(--primary-color);
}

/* ---------- 响应式设计 ---------- */
@media (max-width: 1200px) {
    .w1200 {
        padding: 0 16px;
    }
    
    .main-content {
        flex-direction: column;
    }
    
    .mleft {
        width: 100%;
    }
    
    .scroll-div {
        position: relative;
        top: 0;
    }
    
    .tree {
        max-height: 300px;
    }
}

@media (max-width: 768px) {
    .header-main .w1200 {
        flex-wrap: wrap;
        gap: 16px;
        padding: 0 16px;
    }
    
    .logo_text {
        font-size: 24px;
    }
    
    .sousuo {
        order: 3;
        max-width: 100%;
        width: 100%;
    }
    
    .sinput {
        height: 44px;
        font-size: 14px;
    }
    
    .sbtn {
        width: 56px;
        height: 44px;
    }
    
    .gwc {
        width: 44px;
        height: 44px;
    }
    
    .daohang ul {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding: 0 16px;
    }
    
    .daohang ul li a {
        padding: 12px 16px;
        white-space: nowrap;
        font-size: 14px;
    }
    
    .main-content {
        padding: 16px 0;
    }
    
    .mright {
        padding: 0 16px;
    }
    
    .proul {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
        padding: 8px;
    }
    
    .proul li {
        padding: 16px;
    }
    
    .proimg {
        aspect-ratio: 1/1;
        margin-bottom: 12px;
    }
    
    .protit-name {
        font-size: 13px;
        min-height: 36px;
    }
    
    .protit-footer {
        gap: 8px;
        margin-top: 4px;
    }
    
    .price {
        font-size: 16px;
    }
    
    .cart-actions {
        gap: 6px;
    }
    
    .cart_quantity {
        height: 28px;
    }
    
    .cart_quantity span {
        width: 24px;
        font-size: 14px;
    }
    
    .cart_quantity input {
        width: 36px;
        font-size: 13px;
    }
    
    .add-cart img {
        width: 28px;
        height: 28px;
        padding: 5px;
    }
    
    .mtitle {
        padding: 16px 20px;
    }
    
    .mtitfont {
        font-size: 16px;
    }
    
    .bottom {
        padding: 32px 0;
    }
}

/* 小屏移动端适配 */
@media (max-width: 480px) {
    .proul {
        grid-template-columns: 1fr;
    }
    
    .protit-name {
        font-size: 14px;
        min-height: 40px;
    }
    
    .price {
        font-size: 18px;
    }
    
    .cart_quantity {
        height: 32px;
    }
    
    .cart_quantity span {
        width: 28px;
        font-size: 16px;
    }
    
    .cart_quantity input {
        width: 40px;
        font-size: 14px;
    }
    
    .add-cart img {
        width: 32px;
        height: 32px;
        padding: 6px;
    }
}

/* ---------- 滚动条美化 ---------- */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-tertiary);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: var(--text-muted);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* ---------- 动画 ---------- */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.proul li {
    animation: fadeIn 0.5s ease forwards;
}

.proul li:nth-child(1) { animation-delay: 0.05s; }
.proul li:nth-child(2) { animation-delay: 0.1s; }
.proul li:nth-child(3) { animation-delay: 0.15s; }
.proul li:nth-child(4) { animation-delay: 0.2s; }
.proul li:nth-child(5) { animation-delay: 0.25s; }
.proul li:nth-child(6) { animation-delay: 0.3s; }
.proul li:nth-child(7) { animation-delay: 0.35s; }
.proul li:nth-child(8) { animation-delay: 0.4s; }
