/**
 * Kultiva Agricultural Equipment - Products Page Styles
 *
 * This file contains styles specific to the products page
 *
 * @version 1.0.0
 * @updated 2026-01-05
 */

/* ============================================
   PRODUCTS LAYOUT WITH SIDEBAR
   ============================================ */

.products-layout {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 2rem;
    align-items: start;
}

.products-main {
    min-width: 0; /* Prevent grid overflow */
}

.products-main .row {
    row-gap: 1.5rem;
}

/* ============================================
   PRODUCT BADGES
   ============================================ */

.product-badges {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    flex-wrap: wrap;
    justify-content: center;
}

.product-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: var(--font-weight-semibold);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.product-badge-category {
    background: var(--color-primary);
    color: white;
}

.product-badge-subcategory {
    background: var(--color-accent);
    background-image: repeating-linear-gradient(
        135deg,
        transparent,
        transparent 5px,
        rgba(0, 0, 0, 0.05) 5px,
        rgba(0, 0, 0, 0.05) 6px
    );
    color: var(--color-primary);
}

/* ============================================
   FILTER SIDEBAR
   ============================================ */

.products-sidebar {
    position: sticky;
    top: 20px;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    z-index: 100;
}

.filter-sidebar-container {
    background: var(--color-card-bg);
    border-radius: var(--radius-lg);
    padding: 1rem;
    box-shadow: var(--shadow-md);
    border: 1px solid #e9ecef;
}

.filter-sidebar-title {
    color: var(--color-primary);
    font-size: 1.1rem;
    font-weight: var(--font-weight-bold);
    margin-bottom: 0.75rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--color-accent);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.filter-sidebar-title i {
    color: var(--color-accent);
}

/* Sidebar Product Count */
.sidebar-product-count {
    background: #f8f9fa;
    padding: 0.4rem 0.6rem;
    border-radius: var(--radius-sm);
    text-align: center;
    margin-bottom: 0.75rem;
    font-size: 0.8rem;
    color: var(--color-text);
}

.sidebar-product-count strong {
    color: var(--color-primary);
    font-size: 0.9rem;
    font-weight: var(--font-weight-bold);
}

/* Sidebar Active Filters */
.sidebar-active-filters {
    background: #e8f5e9;
    padding: 0.75rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1rem;
    border-left: 3px solid var(--color-primary);
}

.sidebar-section-title {
    font-weight: var(--font-weight-semibold);
    color: var(--color-primary);
    margin-bottom: 0.5rem;
    font-size: 0.8rem;
}

.sidebar-active-filters .filter-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.35rem 0.75rem;
    background: var(--color-primary);
    color: white;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: var(--font-weight-semibold);
    margin: 0.15rem;
}

.filter-badge-remove {
    color: white;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    transition: all var(--transition-fast);
}

.filter-badge-remove:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.filter-badge-remove i {
    font-size: 0.75rem;
}

.btn-clear-filters-sidebar {
    width: 100%;
    margin-top: 0.75rem;
    padding: 0.5rem;
    background: #dc3545;
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-weight: var(--font-weight-semibold);
    cursor: pointer;
    transition: all var(--transition-base);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-size: 0.875rem;
}

.btn-clear-filters-sidebar:hover {
    background: #c82333;
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

/* Sidebar Filter Groups */
.sidebar-filter-group {
    margin-bottom: 1rem;
}

.sidebar-filter-label {
    display: flex;
    font-weight: var(--font-weight-semibold);
    color: var(--color-primary);
    margin-bottom: 0.4rem;
    font-size: 0.85rem;
    align-items: center;
    gap: 0.4rem;
}

.sidebar-filter-select {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 2px solid #e9ecef;
    border-radius: var(--radius-sm);
    background: var(--color-card-bg);
    color: var(--color-text);
    font-size: 0.85rem;
    font-family: var(--font-body);
    transition: all var(--transition-base);
    cursor: pointer;
}

.sidebar-filter-select:hover {
    border-color: var(--color-primary);
}

.sidebar-filter-select:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(45, 80, 22, 0.1);
}

.sidebar-filter-select:disabled {
    background: #f8f9fa;
    cursor: not-allowed;
    opacity: 0.6;
}

/* ============================================
   HP SLIDER STYLES
   ============================================ */

.slider-group {
    margin-bottom: 0.75rem;
}

.slider-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.35rem;
    font-size: 0.8rem;
    color: var(--color-text);
}

.slider-value {
    font-weight: var(--font-weight-bold);
    color: var(--color-primary);
    background: #e8f5e9;
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
    min-width: 45px;
    text-align: center;
    font-size: 0.8rem;
}

.hp-slider {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: #e9ecef;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    cursor: pointer;
}

.hp-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--color-primary);
    cursor: pointer;
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    transition: all var(--transition-fast);
}

.hp-slider::-webkit-slider-thumb:hover {
    transform: scale(1.1);
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}

.hp-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--color-primary);
    cursor: pointer;
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.btn-apply-hp-filter {
    width: 100%;
    padding: 0.45rem;
    margin-top: 0.35rem;
    background: var(--color-accent);
    background-image: repeating-linear-gradient(
        135deg,
        transparent,
        transparent 5px,
        rgba(0, 0, 0, 0.05) 5px,
        rgba(0, 0, 0, 0.05) 6px
    );
    color: var(--color-primary);
    border: none;
    border-radius: var(--radius-sm);
    font-weight: var(--font-weight-semibold);
    cursor: pointer;
    transition: all var(--transition-base);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    font-size: 0.8rem;
}

.btn-apply-hp-filter:hover {
    background: #d4bc44;
    background-image: repeating-linear-gradient(
        135deg,
        transparent,
        transparent 5px,
        rgba(0, 0, 0, 0.05) 5px,
        rgba(0, 0, 0, 0.05) 6px
    );
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

/* ============================================
   CHECKBOX STYLES
   ============================================ */

.checkbox-group {
    padding: 0.25rem 0;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-size: 0.85rem;
    color: var(--color-text);
    user-select: none;
}

.checkbox-label input[type="checkbox"] {
    display: none;
}

.checkbox-custom {
    width: 18px;
    height: 18px;
    border: 2px solid #ccc;
    border-radius: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
    background: white;
}

.checkbox-label input[type="checkbox"]:checked + .checkbox-custom {
    background: var(--color-primary);
    border-color: var(--color-primary);
}

.checkbox-label input[type="checkbox"]:checked + .checkbox-custom::after {
    content: '✓';
    color: white;
    font-size: 12px;
    font-weight: bold;
}

.checkbox-label:hover .checkbox-custom {
    border-color: var(--color-primary);
}

/* ============================================
   PRODUCT LEASING BADGE
   ============================================ */

.product-leasing-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    margin-top: auto;
    padding: 0.35rem 0.75rem;
    background: #408542;
    background-image: repeating-linear-gradient(
        135deg,
        transparent,
        transparent 5px,
        rgba(0, 0, 0, 0.05) 5px,
        rgba(0, 0, 0, 0.05) 6px
    );
    border-radius: 20px;
    font-size: 0.72rem;
    color: #ffffff;
    font-weight: 600;
    line-height: 1.3;
}

.product-leasing-badge i {
    color: #ffffff;
    font-size: 0.7rem;
    flex-shrink: 0;
}

.product-leasing-badge strong {
    color: #ffffff;
    font-weight: 800;
}

/* ============================================
   PRODUCT SEARCH
   ============================================ */

.products-search-wrapper {
    position: relative;
    max-width: 560px;
    margin: 0 auto 2rem;
    z-index: var(--z-sticky);
}

.products-search-container {
    position: relative;
    display: flex;
    align-items: center;
}

.products-search-icon {
    position: absolute;
    left: 1rem;
    font-size: 1rem;
    color: var(--color-primary);
    pointer-events: none;
    opacity: 0.6;
}

.products-search-input {
    width: 100%;
    padding: 0.75rem 2.5rem 0.75rem 2.75rem;
    border: 2px solid #e9ecef;
    border-radius: var(--radius-lg);
    background: var(--color-card-bg);
    color: var(--color-text);
    font-size: 0.95rem;
    font-family: var(--font-body);
    transition: all var(--transition-base);
}

.products-search-input::placeholder {
    color: #adb5bd;
}

.products-search-input:hover {
    border-color: var(--color-primary);
}

.products-search-input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(45, 80, 22, 0.1);
}

.products-search-clear {
    position: absolute;
    right: 0.75rem;
    background: none;
    border: none;
    font-size: 1.25rem;
    color: #adb5bd;
    cursor: pointer;
    padding: 0.25rem;
    line-height: 1;
    transition: color var(--transition-fast);
}

.products-search-clear:hover {
    color: var(--color-text);
}

/* Search Results Dropdown */
.products-search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 0.25rem;
    background: var(--color-card-bg);
    border: 1px solid #e9ecef;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-xl);
    max-height: 420px;
    overflow-y: auto;
    z-index: var(--z-dropdown);
}

.search-result-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 1rem;
    text-decoration: none;
    color: var(--color-text);
    transition: background var(--transition-fast);
    border-bottom: 1px solid #f1f3f5;
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-item:hover,
.search-result-item.active {
    background: #f8f9fa;
    color: var(--color-text);
    text-decoration: none;
}

.search-result-thumb {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-sm);
    object-fit: cover;
    flex-shrink: 0;
    background: #f8f9fa;
}

.search-result-info {
    flex: 1;
    min-width: 0;
}

.search-result-name {
    font-size: 0.9rem;
    font-weight: var(--font-weight-semibold);
    color: var(--color-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.search-result-category {
    font-size: 0.75rem;
    color: #868e96;
    margin-top: 0.1rem;
}

.search-result-name mark {
    background: rgba(234, 210, 90, 0.4);
    color: inherit;
    padding: 0 1px;
    border-radius: 2px;
}

.search-no-results {
    padding: 1.5rem 1rem;
    text-align: center;
    color: #868e96;
    font-size: 0.9rem;
}

.search-no-results i {
    display: block;
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    opacity: 0.5;
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */

/* Tablet */
@media (max-width: 991.98px) {
    .products-layout {
        grid-template-columns: 1fr;
    }

    .products-sidebar {
        order: -1; /* Move sidebar above products on mobile */
        position: static;
    }

    .filter-sidebar-container {
        padding: 1.25rem;
    }
}

/* Mobile */
@media (max-width: 576px) {
    .filter-sidebar-container {
        padding: 1rem;
    }

    .filter-sidebar-title {
        font-size: 1.1rem;
    }

    .sidebar-product-count strong {
        font-size: 0.9rem;
    }

    .products-search-wrapper {
        margin-bottom: 1.5rem;
    }

    .products-search-input {
        font-size: 0.875rem;
        padding: 0.625rem 2.25rem 0.625rem 2.5rem;
    }
}
