:root {
    --accent: #ff6600;
    --accent-blue: #2563eb; /* Modern Blue */
    --border-color: #e5e7eb;
    --text-main: #1f2937;
    --text-secondary: #6b7280;
    --bg-hover: #f9fafb;
    --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);
    --radius-md: 12px;
}

/* Modern Layout */
.parts-layout {
    display: grid;
    grid-template-columns: 240px 1fr; /* Wider sidebar */
    gap: 24px;
    align-items: start;
    margin-top: 24px;
}

/* Sidebar: Category Directory */
.sidebar-directory {
    background: #fff;
    border: none;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    padding: 8px 0;
    overflow: hidden;
}

.sidebar-header {
    display: none;
}

.directory-tree {
    padding: 0;
    list-style: none;
    margin: 0;
}

.directory-item {
    border: none;
    margin-bottom: 2px;
}

.directory-title {
    padding: 14px 20px;
    height: auto;
    line-height: 1.5;
    font-size: 15px;
    font-weight: 500;
    color: var(--text-main);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #fff;
    transition: all 0.2s ease;
    border: none;
}

.directory-title:hover {
    background: #f3f4f6;
    color: var(--accent-blue);
}

.directory-title.active {
    background: #eff6ff; /* Light blue bg */
    color: var(--accent-blue);
    font-weight: 600;
}

/* Rotate arrow when active */
.directory-title.active .dt-arrow {
    transform: rotate(180deg);
    color: var(--accent-blue) !important;
}

/* Force icon color in active state */
.directory-title.active i:not(.dt-arrow) {
    color: var(--accent-blue) !important;
}

/* Clean up conflicting rules */

/* Sublist: Single Column List Layout (Modern) */
.directory-sublist {
    padding: 5px 0;
    background: #fff;
    display: none;
}

.directory-title.active + .directory-sublist {
    display: block;
}

.directory-subitem {
    display: block;
    width: 100%;
    height: 36px;
    line-height: 36px;
    font-size: 13px;
    color: #666;
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
    padding-left: 48px; /* Indent to align with text */
    border-radius: 4px;
}

.directory-subitem:hover {
    color: var(--accent-blue);
    background: #f9fafb;
}
.directory-subitem.active {
    color: var(--accent-blue);
    font-weight: 500;
    background: #eff6ff;
}

/* Main Content: Parameter Filters */
.parts-main-header {
    background: transparent;
    border: none;
    box-shadow: none;
    margin-bottom: 24px;
    overflow: visible;
}

.filter-header-title {
    padding: 0 0 16px 0;
    height: auto;
    line-height: 1.2;
    font-size: 24px;
    font-weight: 700;
    border-bottom: none;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 0;
}

.city-selector {
    font-size: 13px;
    font-weight: 400;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 4px 10px;
    cursor: pointer;
    background: #fff;
    margin-left: 15px;
    transition: all 0.2s;
    height: 28px;
    line-height: 20px;
    display: inline-flex;
    align-items: center;
}

.city-selector:hover {
    border-color: var(--accent-blue);
    color: var(--accent-blue);
}

.filter-container {
    padding: 0;
    border: none;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    background: #fff;
    overflow: hidden;
}

.filter-row {
    display: flex;
    border-bottom: 1px solid var(--border-color);
    font-size: 13px;
    line-height: 24px;
    padding: 12px 20px;
    position: relative;
    background: #fff;
}

.filter-row:last-child {
    border-bottom: none;
}

.filter-row:nth-child(even) {
    background: #fff; /* Remove zebra striping for cleaner look */
}

.filter-label {
    width: 70px;
    color: #999;
    flex-shrink: 0;
    text-align: right;
    padding-right: 15px;
    font-weight: normal;
}

.filter-options {
    flex: 1;
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    height: 24px;
    overflow: hidden;
}

.filter-row.expanded .filter-options {
    height: auto;
    overflow: visible;
}

.filter-option {
    padding: 0 6px;
    color: #3671cf; /* Classic link blue */
    cursor: pointer;
    border-radius: 0;
    transition: none;
}

.filter-option:hover {
    color: var(--accent);
    background: transparent;
    text-decoration: underline;
}

.filter-option.active {
    background: var(--accent);
    color: #fff;
    text-decoration: none;
}

/* "Unlimited" option specific style */
.filter-option:first-child.active {
    background: var(--accent);
    color: #fff;
}

/* Price Input */
.price-range-input {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin-left: auto; /* Push to right */
    margin-right: 60px; /* Space for button */
}

.price-range-input input {
    width: 50px;
    height: 20px;
    border: 1px solid #ccc;
    border-radius: 0;
    font-size: 12px;
    padding: 0 4px;
    outline: none;
    transition: none;
}

.price-range-input input:focus {
    border-color: #999;
}

.price-range-input button {
    height: 22px;
    padding: 0 8px;
    border: 1px solid #ccc;
    border-radius: 0;
    background: #f5f5f5;
    cursor: pointer;
    font-size: 12px;
    transition: none;
    color: #333;
}

.price-range-input button:hover {
    border-color: #bbb;
    color: #333;
}

.filter-more {
    position: absolute;
    right: 15px;
    top: 10px;
    padding: 0;
    text-align: right;
    color: #666;
    cursor: pointer;
    font-size: 12px;
    border: none;
    border-radius: 0;
    line-height: 24px;
    transition: none;
}

.filter-more:hover {
    color: var(--accent);
    border-color: transparent;
    text-decoration: underline;
}

/* Toolbar */
.parts-toolbar {
    background: #f9f9f9;
    border: 1px solid #e6e6e6;
    border-radius: 0;
    box-shadow: none;
    padding: 0;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 38px;
    margin-top: 20px;
}

.sort-group {
    display: flex;
    gap: 0;
}

.sort-btn {
    padding: 0 20px;
    height: 38px;
    line-height: 38px;
    border: none;
    border-right: 1px solid #e6e6e6;
    border-radius: 0;
    background: transparent;
    color: #333;
    font-size: 12px;
    cursor: pointer;
    transition: none;
}

.sort-btn:hover {
    color: var(--accent-blue);
    background: #fff;
}

.sort-btn.active {
    background: var(--accent-blue); /* Blue background for active tab */
    color: #fff;
    border-color: var(--accent-blue);
}

.sort-btn.text-only {
    border: none;
    border-right: 1px solid #e6e6e6;
    background: transparent;
}
.sort-btn.text-only.active {
    background: transparent;
    color: var(--accent);
    font-weight: bold;
}

.page-info {
    font-size: 12px;
    color: #666;
    margin-right: 10px;
}

.page-info b {
    color: #e11d48;
}

.view-toggle {
    display: flex;
    gap: 5px;
    border: none;
    border-radius: 0;
    overflow: visible;
    margin-right: 10px;
}

.view-btn {
    width: 20px;
    height: 20px;
    border: none;
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #999;
    transition: none;
}

.view-btn:last-child {
    border-right: none;
}

.view-btn:hover {
    background: transparent;
    color: var(--accent-blue);
}

.view-btn.active {
    background: transparent;
    color: var(--accent-blue);
}

/* Product Grid */
.parts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 15px;
}

.part-card {
    background: #fff;
    border: 1px solid #fff;
    border-radius: 0;
    box-shadow: none;
    transition: border-color 0.2s;
    position: relative;
    padding: 10px;
    display: flex;
    flex-direction: column;
    overflow: visible;
}

.part-card:hover {
    transform: none;
    box-shadow: none;
    border-color: #ddd; /* Only border change on hover */
    z-index: 10;
}

.part-img-wrapper {
    padding: 5px;
    background: #fff;
    height: 180px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 10px;
    border-radius: 0;
}

.part-img-wrapper img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    transition: none;
}

.part-card:hover .part-img-wrapper img {
    transform: none;
}

.part-info {
    padding: 0;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.part-price {
    color: #e11d48;
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 5px;
    line-height: 1;
}

.part-price sub {
    font-size: 12px;
    font-weight: 400;
    margin-right: 2px;
}

.part-title {
    font-size: 12px;
    line-height: 20px;
    height: 40px;
    overflow: hidden;
    margin-bottom: 5px;
    color: #333;
}

.part-title a {
    color: #333;
    transition: none;
    text-decoration: none;
}

.part-title a:hover {
    color: var(--accent);
    text-decoration: underline;
}

.part-shop {
    font-size: 12px;
    color: #999;
    margin-bottom: 5px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.part-stats {
    font-size: 12px;
    color: #999;
    display: flex;
    gap: 10px;
    margin-top: auto;
    border-top: none;
    padding-top: 5px;
}

.part-stats span {
    display: flex;
    align-items: center;
    gap: 2px;
}

.part-stats b {
    color: #646bf8;
    font-weight: normal;
}
