
/* Products Tab Toolbar & Search */
#products.tab-content {
    display: flex;
    flex-direction: column;
    height: 100%;
}

#products-toolbar {
    flex-shrink: 0;
    z-index: 4;
    background-color: #e0e0e0;
    padding: 5px 10px;
    display: flex;
    align-items: center;
    gap: 5px;
    border-bottom: 1px solid #ccc;
}
#products-toolbar button {
    background-color: #f0f0f0;
    border: 1px solid #ccc;
    border-radius: 5px;
    font-size: 20px;
    cursor: pointer;
    width: 40px;
    height: 34px;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #555; /* Default icon color */
}
#products-toolbar button:hover {
    background-color: #e0e0e0;
    color: #333;
}
#products-toolbar button svg {
    display: block;
}
#product-list-count {
    margin-left: auto;
    font-size: 14px;
    font-weight: bold;
    color: #555;
    padding-left: 5px;
    white-space: nowrap;
}

#filter-btn {
    width: auto;
    padding: 0 10px;
    font-size: 16px;
}
#filter-btn.active-filter {
    background-color: #28a745;
    color: white;
    border-color: #28a745;
}
.filter-container {
    position: relative;
    display: inline-block;
}
#filter-menu {
    position: absolute;
    top: 100%;
    left: 0;
    background-color: white;
    border: 1px solid #ccc;
    border-radius: 5px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.15);
    z-index: 5;
    min-width: 150px;
}
#filter-menu a {
    display: block;
    padding: 10px 15px;
    text-decoration: none;
    color: #333;
}
#filter-menu a:hover {
    background-color: #f0f0f0;
}
#search-bar {
    flex-shrink: 0;
    z-index: 3;
    background-color: #f0f0f0;
    padding: 5px 10px;
    display: flex;
    border-bottom: 1px solid #ccc;
}
#search-input {
    flex-grow: 1;
    border: 1px solid #ccc;
    border-radius: 5px;
    padding: 8px;
    font-size: 16px;
    background-color: #fff;
    caret-color: #007bff; /* Explicit caret color for visibility */
}
/* No readonly style anymore as we use inputmode=none */

#clear-search-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0 10px;
    color: #666;
    display: flex;
    align-items: center;
    justify-content: center;
}
#clear-search-btn:hover {
    color: #333;
}

#products-list {
    list-style-type: none;
    padding: 0;
    margin: 0;
    overflow-y: auto;
    flex-grow: 1;
}
.category-group, .subcategory-group {
    margin-bottom: 0;
}
.category-title {
    font-weight: bold;
    color: #334;
    position: sticky;
    top: 0;
    background-color: #d4eaf7; /* Light blue */
    padding: 0 20px;
    z-index: 2;
    border-bottom: 1px solid #b8d9ee;
    height: 45px; /* Fixed height to match offsets */
    display: flex;
    align-items: center;
}

.subcategory-title {
    font-weight: bold;
    color: #445;
    position: sticky;
    top: 45px; /* category top + category height */
    background-color: #eaf4fb; /* Lighter blue */
    padding: 8px 20px;
    z-index: 1;
    border-bottom: 1px solid #d4eaf7;
    cursor: pointer;
    display: flex;
    align-items: center;
}

.subcategory-title::before {
    content: '▼';
    display: inline-block;
    margin-right: 10px;
    font-size: 0.8em;
    transition: transform 0.2s ease-in-out;
    transform-origin: center;
}
.subcategory-group.collapsed > .subcategory-title::before {
    transform: rotate(-90deg);
}
.subcategory-group.collapsed > .product-item {
    display: none;
}
.product-item {
    background-color: white;
    padding: 10px 20px;
    margin-bottom: 1px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    border-bottom: 1px solid #eee;
}
.product-item:hover {
    background-color: #f0f0f0;
}
.product-list-empty-message {
    padding: 20px;
    text-align: center;
    color: #666;
}
.product-reference {
    font-size: 0.8em;
    color: #888;
    margin-right: 10px;
    flex-shrink: 0;
}
.product-description {
    flex-grow: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-right: 10px;
}
.product-stock {
    font-weight: bold;
    margin-left: 10px;
    min-width: 40px; /* Helps align numbers */
    text-align: right;
    flex-shrink: 0;
}
.stock-modified {
    color: #28a745;
}

@keyframes highlight-update {
    0% {
        background-color: rgba(0, 86, 179, 0.3);
    }
    50% {
        background-color: rgba(0, 86, 179, 1);
    }
    100% {
        background-color: rgba(0, 86, 179, 0.3);
    }
}
.product-item.highlight-update {
    animation: highlight-update 2s linear;
}