/* Products Page Specific Styles */
.products-container {
    margin-top: 130px;
    min-height: calc(100vh - 130px);
    display: flex;
    background: var(--bg-light);
}

.products-sidebar {
    width: 280px;
    background: white;
    box-shadow: var(--shadow);
    position: sticky;
    top: 155px;
    height: fit-content;
    max-height: calc(100vh - 185px);
    overflow-y: auto;
    z-index: 100;
}

.products-content {
    flex: 1;
    padding: 30px;
    margin-left: 20px;
    background: white;
    min-height: 1500px; /* For demonstration of scrolling */
}

.sidebar-header {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: var(--text-light);
    padding: 20px;
    text-align: center;
}

.sidebar-header h2 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
}

.search-container {
    padding: 20px 15px;
    border-bottom: 1px solid #eee;
}

.search-form {
    display: flex;
    gap: 4px;
}

.search-box {
    flex: 0.35;
    padding: 12px 8px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.3s ease;
    outline: none;
    box-sizing: border-box;
}

.search-box:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(30, 74, 139, 0.1);
}

.search-btn {
    background: var(--primary-color);
    border: none;
    color: white;
    padding: 12px 6px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 65px;
}

.search-btn i {
    font-size: 16px;
}

.search-btn:hover {
    background: var(--primary-dark);
}

.category-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.category-item {
    border-bottom: 1px solid #f0f0f0;
}

.category-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px 20px;
    color: var(--text-dark);
    text-decoration: none;
    transition: all 0.3s ease;
    font-weight: 500;
}

.category-link:hover {
    background: var(--bg-light);
    color: var(--primary-color);
    padding-left: 25px;
}

.category-link.active {
    background: var(--primary-color);
    color: white;
}

.category-icon {
    margin-right: 10px;
    width: 20px;
    text-align: center;
}

.arrow-icon {
    transition: transform 0.3s ease;
}

.category-item.expanded .arrow-icon {
    transform: rotate(90deg);
}

.subcategory-list {
    list-style: none;
    padding: 0;
    margin: 0;
    background: #fafafa;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.category-item.expanded .subcategory-list {
    max-height: 500px;
}

.subcategory-item {
    border-bottom: 1px solid #f0f0f0;
}

.subcategory-link {
    display: block;
    padding: 12px 20px 12px 50px;
    color: var(--text-gray);
    text-decoration: none;
    transition: all 0.3s ease;
    font-size: 14px;
}

.subcategory-link:hover {
    background: white;
    color: var(--primary-color);
    padding-left: 55px;
}

.subcategory-link.active {
    background: white;
    color: var(--accent-color);
    font-weight: 600;
}

/* Content Area Styles */
.content-header {
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid var(--primary-color);
}

.content-header h1 {
    color: var(--primary-color);
    font-size: 36px;
    margin-bottom: 15px;
}

/* Product Grid Styles */
.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 25px;
    margin-top: 30px;
    padding: 20px 0;
}

@media (min-width: 1400px) {
    .product-grid {
        grid-template-columns: repeat(5, 1fr);
    }
}

.product-card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    border: 1px solid #e8e8e8;
    display: flex;
    flex-direction: column;
    height: 100%;
    text-decoration: none;
    color: inherit;
}

.product-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 12px 32px rgba(30, 74, 139, 0.2);
    border-color: var(--primary-color);
}

.product-thumbnail {
    width: 100%;
    aspect-ratio: 1/1;
    object-fit: cover;
    background: linear-gradient(135deg, #f5f7fa 0%, #e4e8ec 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    transition: all 0.3s ease;
}

.product-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.product-card:hover .product-thumbnail img {
    transform: scale(1.1);
}

.product-thumbnail .placeholder {
    font-size: 48px;
    color: var(--primary-color);
    opacity: 0.3;
}

.product-info {
    padding: 15px;
    text-align: center;
    flex-grow: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    transition: background 0.3s ease;
}

.product-card:hover .product-info {
    background: linear-gradient(135deg, #fafbfc 0%, #f5f7fa 100%);
}

.product-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-dark);
    margin: 0;
    line-height: 1.5;
    transition: all 0.3s ease;
    word-break: break-word;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    min-height: 21px;
    max-height: 63px;
}

.product-card:hover .product-name {
    color: var(--primary-color);
    transform: scale(1.05);
}

.products-section {
    margin-top: 20px;
}

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-gray);
    font-size: 14px;
}

.breadcrumb a {
    color: var(--primary-color);
    text-decoration: none;
}

.breadcrumb a:hover {
    color: var(--accent-color);
}

.product-description {
    line-height: 1.8;
    color: var(--text-gray);
    margin-bottom: 30px;
}

.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 30px;
    margin: 40px 0;
}

.feature-card {
    background: white;
    padding: 25px;
    border-radius: 10px;
    box-shadow: var(--shadow);
    text-align: center;
    transition: transform 0.3s ease;
}

.feature-card:hover {
    transform: translateY(-5px);
}

.feature-icon {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 15px;
    font-size: 24px;
}

.feature-card h3 {
    color: var(--primary-color);
    margin-bottom: 10px;
}

.feature-card p {
    color: var(--text-gray);
    line-height: 1.6;
}

/* Products Dropdown Menu for Header */
.products-dropdown {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(-10px);
    background: white;
    min-width: 1000px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 1001;
    border: 1px solid #e8e8e8;
}

.main-nav li:nth-child(4):hover .products-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

.dropdown-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(2, 1fr);
    gap: 0;
    padding-top: 10px;
}

.dropdown-grid .dropdown-column:nth-child(4),
.dropdown-grid .dropdown-column:nth-child(5),
.dropdown-grid .dropdown-column:nth-child(6) {
    margin-top: -30px;
}

.dropdown-column {
    padding: 25px 20px;
    border-right: 1px solid #f5f5f5;
}

.dropdown-column:last-child {
    border-right: none;
}

.products-dropdown .dropdown-category-title {
    color: var(--primary-color);
    font-weight: bold !important;
    font-size: 14px !important;
    margin-bottom: 12px;
    padding: 8px 0;
    border-bottom: 1px solid #ddd;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.products-dropdown .dropdown-item {
    display: block;
    padding: 8px 12px;
    color: var(--text-gray);
    text-decoration: none;
    font-size: 14px;
    font-weight: normal !important;
    transition: all 0.3s ease;
    border-radius: 4px;
    margin: 1px 0;
}

.products-dropdown .dropdown-item:hover {
    background: #f8f9fa;
    color: var(--primary-color);
    padding-left: 16px;
    font-weight: normal !important;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .products-container {
        flex-direction: column;
        margin-top: 110px;
    }

    .products-sidebar {
        width: 100%;
        position: relative;
        top: 0;
        max-height: none;
    }

    /* 隐藏移动端的产品分类列表，只保留搜索框 */
    .category-list {
        display: none;
    }

    /* 隐藏移动端的蓝色标题栏（有两个齿轮的Products标题） */
    .sidebar-header {
        display: none;
    }

    /* 移动端搜索框直接与上面的top吻合，删除灰色线和间距 */
    .products-sidebar .search-container {
        padding: 15px 10px;
        border-bottom: none !important;  /* 删除灰色线 */
        margin-top: 0 !important;
        margin-bottom: 0;
    }

    .search-container {
        padding: 15px 10px;
        border-bottom: none !important;
        margin-top: 0 !important;
        margin-bottom: 0;
    }

    .products-content {
        margin-left: 0;
        padding: 20px;
    }

    /* 移动端缩小 "Products Center" 标题字号 */
    .content-header h1 {
        font-size: 24px;
        margin-bottom: 10px;
    }

    /* 移动端面包屑导航样式，增加字体大小 */
    .breadcrumb {
        font-size: 14px;  /* 从12px增加到14px */
        gap: 5px;
        flex-wrap: nowrap;
        overflow-x: auto;
        white-space: nowrap;
    }

    /* 使用右尖括号代替图标 */
    .breadcrumb i {
        font-size: 10px;
        color: var(--text-gray);
    }

    /* 移动端产品网格改成一行两个 */
    .product-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
        padding: 10px 0;
    }

    .product-card {
        box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
    }

    .product-info {
        padding: 10px;
    }

    .product-name {
        font-size: 12px;
        -webkit-line-clamp: 2;
        max-height: 42px;
    }

    .dropdown-grid {
        grid-template-columns: 1fr;
        min-width: 300px;
        grid-template-rows: auto;
    }
}

@media (max-width: 480px) {
    /* 小屏幕手机端仍然保持一行两个 */
    .product-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .product-name {
        font-size: 11px;
        -webkit-line-clamp: 2;
        max-height: 38px;
    }

    .product-info {
        padding: 8px;
    }

    /* 更小屏幕的标题 */
    .content-header h1 {
        font-size: 20px;
    }

    .breadcrumb {
        font-size: 13px;  /* 小屏幕稍微小一点 */
    }

    /* 小屏幕搜索框padding调整 */
    .search-container,
    .products-sidebar .search-container {
        padding: 10px 8px;
        border-bottom: none !important;
        margin-top: 0 !important;
        margin-bottom: 0;
    }
}
