/**
 * Semi Truck Parts Filter Styles
 */

.stpf-filter-widget {
    background: #f9f9f9;
    padding: 20px;
    border-radius: 5px;
    margin-bottom: 20px;
}

.stpf-filter-widget h3 {
    margin-top: 0;
    margin-bottom: 15px;
    color: #333;
}

.stpf-filter-group {
    margin-bottom: 15px;
}

.stpf-filter-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
    color: #555;
}

.stpf-filter-select {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 3px;
    background-color: #fff;
}

.stpf-filter-actions {
    margin-top: 20px;
    display: flex;
    gap: 10px;
}

.stpf-filter-button,
.stpf-reset-button {
    padding: 10px 15px;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    font-weight: bold;
    transition: background-color 0.3s;
}

.stpf-filter-button {
    background-color: #0073aa;
    color: white;
}

.stpf-filter-button:hover {
    background-color: #005177;
}

.stpf-reset-button {
    background-color: #dc3232;
    color: white;
}

.stpf-reset-button:hover {
    background-color: #aa0000;
}

#stpf-loading {
    text-align: center;
    padding: 20px;
    background: #f0f0f0;
    border-radius: 3px;
    margin-top: 15px;
}

#stpf-loading p {
    margin: 0;
    font-style: italic;
}

/* Shortcode styles */
.stpf-filter-shortcode {
    background: #fff;
    padding: 25px;
    border: 1px solid #e5e5e5;
    border-radius: 5px;
    margin-bottom: 30px;
}

.stpf-filter-field {
    margin-bottom: 20px;
}

.stpf-filter-field label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
}

.stpf-filter-field select {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background-color: #fff;
    font-size: 14px;
}

.stpf-filter-field select:focus {
    outline: none;
    border-color: #0073aa;
    box-shadow: 0 0 0 1px #0073aa;
}

/* Product results styles */
.stpf-product-results {
    margin-top: 30px;
}

.stpf-results-count {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 20px;
    color: #333;
}

.stpf-no-results {
    text-align: center;
    padding: 40px;
    background: #f9f9f9;
    border-radius: 5px;
    font-size: 16px;
    color: #666;
}

/* Compatibility info on products */
.stpf-compatibility-info {
    margin-top: 10px;
    padding: 8px;
    background: #f0f8ff;
    border-radius: 3px;
    font-size: 12px;
    color: #555;
}

.stpf-compatibility-info small {
    display: block;
}

/* Year/Makes/Models table */
.stpf-year-makes-models-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

.stpf-year-makes-models-table th,
.stpf-year-makes-models-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

.stpf-year-makes-models-table th {
    background-color: #f9f9f9;
    font-weight: bold;
}

.stpf-year-makes-models-table tr:hover {
    background-color: #f5f5f5;
}

/* Part categories list */
.stpf-part-categories {
    list-style: none;
    padding: 0;
    margin: 0;
}

.stpf-part-categories li {
    padding: 8px 0;
    border-bottom: 1px solid #eee;
}

.stpf-part-categories li:last-child {
    border-bottom: none;
}

.stpf-part-categories a {
    text-decoration: none;
    color: #0073aa;
    font-weight: 500;
}

.stpf-part-categories a:hover {
    color: #005177;
}

.stpf-part-categories .count {
    color: #666;
    font-size: 12px;
}

/* Compatible products grid */
.stpf-compatible-products {
    display: grid;
    gap: 20px;
    margin-top: 20px;
}

.stpf-compatible-products.columns-2 {
    grid-template-columns: repeat(2, 1fr);
}

.stpf-compatible-products.columns-3 {
    grid-template-columns: repeat(3, 1fr);
}

.stpf-compatible-products.columns-4 {
    grid-template-columns: repeat(4, 1fr);
}

.stpf-product-item {
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 5px;
    padding: 15px;
    text-align: center;
    transition: box-shadow 0.3s;
}

.stpf-product-item:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.stpf-product-item img {
    max-width: 100%;
    height: auto;
    margin-bottom: 10px;
}

.stpf-product-item h3 {
    margin: 10px 0;
    font-size: 16px;
    font-weight: 600;
}

.stpf-product-item .price {
    display: block;
    font-size: 18px;
    font-weight: bold;
    color: #333;
    margin-top: 10px;
}

/* Prevent Select2 conflicts on frontend */
.stpf-filter-widget .select2-container,
.stpf-filter-shortcode .select2-container {
    display: none !important;
}

.stpf-filter-widget select,
.stpf-filter-shortcode select {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* Remove any Select2 styling - use custom dropdown arrow */
.stpf-filter-select {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url('data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%23333%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E');
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 12px;
    padding-right: 30px;
}

/* Responsive styles */
@media (max-width: 768px) {
    .stpf-filter-actions {
        flex-direction: column;
    }
    
    .stpf-compatible-products.columns-4 {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .stpf-compatible-products.columns-3 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .stpf-compatible-products.columns-4,
    .stpf-compatible-products.columns-3,
    .stpf-compatible-products.columns-2 {
        grid-template-columns: 1fr;
    }
    
    .stpf-year-makes-models-table {
        font-size: 14px;
    }
    
    .stpf-year-makes-models-table th,
    .stpf-year-makes-models-table td {
        padding: 8px;
    }
}

/* Loading states */
.stpf-loading {
    position: relative;
}

.stpf-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #0073aa;
    border-radius: 50%;
    animation: stpf-spin 1s linear infinite;
}

@keyframes stpf-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Admin styles compatibility */
.stpf-compatibility-metabox select[multiple] {
    height: 150px !important;
    width: 100%;
}

.stpf-field-group {
    margin-bottom: 15px;
}

.stpf-field-group label {
    display: block;
    font-weight: bold;
    margin-bottom: 5px;
}

/* WooCommerce integration */
.woocommerce .products .product .stpf-compatibility-info {
    margin-top: 10px;
    padding: 5px 10px;
    background: #f0f8ff;
    border-radius: 3px;
    font-size: 11px;
    color: #555;
}

/* Search and filter enhancements */
.stpf-search-container {
    margin-bottom: 20px;
}

.stpf-search-input {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.stpf-search-results {
    margin-top: 20px;
}

.stpf-search-result-item {
    padding: 15px;
    border: 1px solid #e5e5e5;
    border-radius: 4px;
    margin-bottom: 10px;
    background: #fff;
}

.stpf-search-result-item h4 {
    margin: 0 0 10px 0;
    font-size: 16px;
}

.stpf-search-result-item .part-numbers {
    font-size: 12px;
    color: #666;
    margin-bottom: 10px;
}

.stpf-search-result-item .part-numbers span {
    display: inline-block;
    margin-right: 15px;
}

.stpf-search-result-item .price {
    font-size: 18px;
    font-weight: bold;
    color: #333;
}