body {
    background: #f5f7fa;
    font-family: 'HW2';
}
.products-list {
    max-width: 980px;
    margin: 32px auto 0;
    display: flex;
    flex-wrap: wrap;
    gap: 32px;
}
.product-item {
    flex: 1 1 260px;
    min-width: 260px;
    max-width: 400px;
    background: #fff;
    border-radius: 12px;
    padding: 32px 24px 24px 24px;
    box-shadow: 0 4px 24px #0001;
    transition: box-shadow 0.2s;
    border-left: 6px solid #2cacd1;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
}
.product-item:hover {
    box-shadow: 0 8px 32px #2cacd133;
}
.product-title {
    color: #0066a1;
    font-size: 1.18rem;
    font-weight: bold;
    margin-bottom: 10px;
    letter-spacing: 1px;
}
.product-type {
    color: #35eb93;
    font-size: 0.98rem;
    margin-bottom: 8px;
}
#product-type{
    border:none;
}
.product-content {
    color: #444;
    font-size: 1.05rem;
    flex: 1;
}
@media (max-width: 700px) {
    .products-list { gap: 12px; }
    .product-item { padding: 16px 8px 12px 12px; }
    .product-title { font-size: 1rem; }
    .product-content { font-size: 0.95rem; }
}
.custom-select {
    position: relative;
    width: 200px;
    font-size: 1rem;
}
.custom-select select {
    width: 100%;
    padding: 8px 38px 8px 16px;
    border-radius: 8px;
    border: 1px solid #2cacd1;
    background: #fff url("data:image/svg+xml,%3Csvg width='16' height='16' viewBox='0 0 16 16' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M4 6L8 10L12 6' stroke='%232cacd1' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat right 12px center/18px 18px;
    color: #0066a1;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    cursor: pointer;
    transition: border 0.2s;
}
.custom-select select:focus {
    border: 1.5px solid #35eb93;
    outline: none;
}
.products-list { max-width: 980px; margin: 32px auto 0; display: flex; flex-wrap: wrap; gap: 32px; }
.product-item {
    flex: 1 1 260px;
    min-width: 260px;
    max-width: 500px;
    background: #fff;
    border-radius: 12px;
    padding: 32px 24px 24px 24px;
    box-shadow: 0 4px 24px #0001;
    transition: box-shadow 0.2s;
    border-left: 6px solid #2cacd1;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    margin:0 1rem 32px 1rem;
}
.product-item:hover { box-shadow: 0 8px 32px #2cacd133; }
.product-title { color: #0066a1; font-size: 1.18rem; font-weight: bold; margin-bottom: 10px; letter-spacing: 1px; }
.product-type { color: #35eb93; font-size: 0.98rem; margin-bottom: 8px; }
.product-content { color: #444; font-size: 1.05rem; flex: 1; }
@media (max-width: 700px) {
    .products-list { gap: 12px; }
    .product-item { padding: 16px 8px 12px 12px; }
    .product-title { font-size: 1rem; }
    .product-content { font-size: 0.95rem; }
    .custom-select { width: 100%; }
}
.product-container {
    position: relative;
    margin-bottom: 30px;
    border: 1px solid #eee;
    padding: 28px 28px 18px 28px;
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 4px 24px #2cacd111;
    transition: box-shadow 0.2s;
}
.product-container:hover {
    box-shadow: 0 8px 32px #2cacd133;
}
.product-main-area {
    margin-bottom: 18px;
}
.product-main-header {
    display: flex;
    align-items: center;
    gap: 18px;
    margin-bottom: 10px;
}
.product-main-title {
    font-size: 1.35rem;
    font-weight: bold;
    color: #0066a1;
    letter-spacing: 1px;
}
.product-main-type {
    font-size: 1rem;
    color: #35eb93;
    background: #e6fff3;
    border-radius: 8px;
    padding: 2px 14px;
    font-weight: 500;
}
.product-main-imgs {
    margin-bottom: 12px;
}
.product-main-imgs img {
    max-width: 120px;
    max-height: 80px;
    margin-right: 8px;
    border-radius: 8px;
    box-shadow: 0 2px 8px #2cacd122;
    border: 1px solid #eee;
}
.product-desc-list {
    margin-bottom: 10px;
}
.product-desc-item {
    margin-bottom: 8px;
    padding: 8px 12px;
    background: #f7fafd;
    border-radius: 6px;
    border-left: 4px solid #2cacd1;
}
.product-desc-title {
    font-weight: bold;
    color: #007bff;
    margin-right: 8px;
}
.product-desc-content {
    color: #444;
}
.sub-products-area {
    display: none;
    margin-top: 10px;
    border-top: 1px dashed #ccc;
    padding-top: 10px;
}
.sub-products-area.active {
    display: block;
}
.sub-products-header {
    font-size: 1.08rem;
    font-weight: bold;
    color: #0066a1;
    margin-bottom: 8px;
    letter-spacing: 1px;
}
.sub-product-item {
    margin-bottom: 12px;
    padding: 10px 14px;
    background: #fafafa;
    border-radius: 6px;
    border: 1px solid #eee;
    box-shadow: 0 2px 8px #2cacd111;
}
.sub-product-title {
    font-weight: bold;
    color: #2cacd1;
    font-size: 1.05rem;
    margin-bottom: 4px;
}
.sub-product-desc {
    color: #444;
    margin-bottom: 6px;
}
.sub-product-imgs img {
    max-width: 80px;
    max-height: 60px;
    margin-right: 4px;
    border-radius: 6px;
    border: 1px solid #eee;
    box-shadow: 0 1px 4px #2cacd122;
}
#add-product-form {
    background: #f9f9f9;
    border: 1px solid #eee;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 30px;
}
#add-product-form label {
    display: inline-block;
    width: 100px;
    font-weight: bold;
}
#add-product-form input[type="text"] {
    margin-bottom: 8px;
    width: 220px;
}
#add-product-form input[type="file"] {
    margin-bottom: 8px;
}
#add-product-form button {
    margin: 6px 0;
}
.subproduct-block {
    border: 1px dashed #bbb;
    padding: 10px;
    margin-bottom: 10px;
    border-radius: 6px;
    background: #fff;
    position: relative;
}
.subproduct-block .remove-sub-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    background: #e74c3c;
    color: #fff;
    border: none;
    border-radius: 3px;
    padding: 2px 8px;
    cursor: pointer;
    font-size: 12px;
}

.product-img{
    width: 100%;
    height: auto;
    object-fit: cover;
    border-radius: 8px;
    margin-bottom: 10px;
    border-radius: 8px;
}

.sub-category-btn{
    background-color: #2cc6d1;
    border-radius: 100%;
    border: none;
    padding: 3px;
    width: calc(1rem + 6px);
    height: calc(1rem + 6px);
    color: white;
    margin:0 2px 10px 2px;
    text-align: center;
}
.sub-category-btn.active{
    background-color: #2c97d1;
}
.product-img{
    width: auto;
    height: 100%;
    object-fit: contain;
    transition: transform 0.65s;
    border-radius: 5%;
    margin:0;
}
.product-img:hover {
    transform: scale(1.2);
}
.product-img-wrap{
    margin: 6% 0 6% 0;
}
.product-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 10px;
    margin: 15px 0;
}

.product-gallery img {
    width: auto;
    height: 200px;
    object-fit: contain;
    border-radius: 8px;
    transition: transform 0.65s;
    margin: 0 auto;
}

.product-desc {
    color: #666;
    margin: 10px 0;
    font-size: 0.95em;
    line-height: 1.5;
}

.product-content-group {
    margin: 15px 0;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 8px;
}

.product-content-group .description {
    margin-bottom: 8px;
}

.product-content-group .description:not(:last-child) {
    border-bottom: 1px dashed #ddd;
    padding-bottom: 8px;
}
.description h4{
    margin-block-start: 6px;
    margin-block-end: 6px;
}
.sub-products-container {
    margin-top: 20px;
    border-top: 2px solid #eee;
    padding-top: 15px;
}

/* 新增：左侧分类栏与主内容布局 */
.products-page {
    max-width: 1200px;
    margin: 32px auto 0;
    display: flex;
    gap: 24px;
    padding: 0 16px;
    align-items: flex-start;
}
.products-side {
    width: 180px;
    background: #fff;
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.04);
    border-left: 6px solid #2cacd1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.products-side .side-title {
    font-weight: 700;
    color: #0066a1;
    margin-bottom: 6px;
    font-size: 1.05rem;
}
.side-btn {
    text-align: left;
    padding: 10px 14px;
    border-radius: 6px;
    border: none;
    background: #fff;
    cursor: pointer;
    color: #17406a;
    font-weight: 500;
    transition: background 0.15s, color 0.15s, transform 0.08s;
    position: relative; /* 使弹层能相对于按钮定位 */
}
.side-btn:hover {
    background: #f1fbff;
}
.side-btn.active {
    background: linear-gradient(90deg,#2b76b9 0%, #2cacd1 100%);
    color: #fff;
    box-shadow: 0 6px 18px rgba(43,150,200,0.12);
    transform: translateX(2px);
}

/* 右侧主区扩展到剩余空间 */
.products-main {
    flex: 1;
    min-width: 0;
}

/* 小弹层（浮动子项菜单） */
.product-detail-popover {
    position: absolute;
    left: 100%;
    top: 0;
    margin-left: 8px;
    min-width: 190px;
    max-width: 320px;
    background: #fff;
    border-radius: 8px;
    padding: 6px 8px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    border: 1px solid #eef7fb;
    z-index: 9999;
    font-size: 13px;
    opacity: 0;
    transform: translateX(6px);
    transition: opacity 0.2s ease 0.1s, transform 0.2s ease 0.1s;
    /* pointer-events: none; */
}
.product-detail-popover.show {
    opacity: 1;
    transform: translateX(0);
    pointer-events: auto;
}

.product-detail-popover a {
    display: block;
    color: #0066a1;
    padding: 6px 8px;
    text-decoration: none;
}
.product-detail-popover a:hover {
    background: #f3fbff;
}

/* 响应式：小屏时左侧收起为顶部横向按钮 */
@media (max-width: 900px) {
    .products-page { flex-direction: column; gap: 12px; padding: 0 8px; }
    .products-side { width: 90%; flex-direction: row; overflow-x: auto; gap: 6px; padding: 8px; }
    .side-btn { white-space: nowrap; padding: 8px 12px; font-size: 0.95rem; }
}

/* 当 JS 判定为移动端时强制移动布局（优先于 media query） */
.products-page.mobile-layout {
    flex-direction: column;
    gap: 12px;
    padding: 0 8px;
}
.products-page.mobile-layout .products-side,
.products-side.mobile-side {
    width: 100%;
    flex-direction: row;
    overflow-x: auto;
    gap: 6px;
    padding: 8px;
    border-left: none; /* 移动端不需要左侧粗条 */
    border-radius: 8px;
    box-shadow: 0 4px 18px rgba(0,0,0,0.04);
}
.products-page.mobile-layout .side-btn,
.products-side.mobile-side .side-btn {
    white-space: nowrap;
    padding: 8px 12px;
    font-size: 0.95rem;
    flex: 0 0 auto;
}

#no-products{
    width: 100%;
    text-align: center;
}