/* Base styles with !important to prevent theme override */
.oswald-filter-container {
    position: relative;
    z-index: 9999 !important;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Ubuntu, Cantarell, 'Helvetica Neue', sans-serif !important;
    box-sizing: border-box !important;
}

.oswald-filter-container * {
    box-sizing: border-box !important;
}

/* Filter toggle button */
#filter-toggle-btn {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    padding: 10px 20px !important;
    background: linear-gradient(to right, #4a6cf7, #3b5fe2) !important;
    color: #fff !important;
    border: none !important;
    border-radius: 30px !important;
    cursor: pointer !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    box-shadow: 0 4px 10px rgba(59, 95, 226, 0.2) !important;
    transition: all 0.3s ease !important;
}

#filter-toggle-btn:hover {
    background: linear-gradient(to right, #3b5fe2, #2a4fd8) !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 8px 15px rgba(59, 95, 226, 0.3) !important;
}

.filter-icon {
    display: inline-flex !important;
}

/* Filter panel */
.oswald-filter-panel {
    display: none !important;
    position: absolute !important;
    top: 100% !important;
    left: 0 !important;
    width: 100% !important;
    min-width: 720px !important;
    max-width: 90vw !important;
    background: #fff !important;
    padding: 0 !important;
    border-radius: 10px !important;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15) !important;
    margin-top: 15px !important;
    z-index: 10000 !important;
    transform: translateY(-10px) !important;
    opacity: 0 !important;
    visibility: hidden !important;
    transition: all 0.3s cubic-bezier(0.165, 0.84, 0.44, 1) !important;
}

.oswald-filter-panel.visible {
    display: block !important;
    transform: translateY(0) !important;
    opacity: 1 !important;
    visibility: visible !important;
}

/* Filter form */
#oswald-filter-form {
    display: flex !important;
    flex-direction: column !important;
}

/* Filter header */
.oswald-filter-header {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    padding: 15px 20px !important;
    background: #f8f9fa !important;
    border-bottom: 1px solid #e9ecef !important;
    border-top-left-radius: 10px !important;
    border-top-right-radius: 10px !important;
}

.oswald-filter-header h3 {
    margin: 0 !important;
    font-size: 18px !important;
    color: #2c3e50 !important;
    font-weight: 600 !important;
}

.close-filter {
    font-size: 24px !important;
    cursor: pointer !important;
    color: #7b8a8b !important;
    transition: color 0.2s ease !important;
}

.close-filter:hover {
    color: #e74c3c !important;
}

/* Filter body - simplified with only categories */
.oswald-filter-body {
    display: flex !important;
    flex-direction: column !important;
    padding: 20px !important;
    max-height: 70vh !important;
    overflow-y: auto !important;
}

/* Filter sections */
.filter-section {
    margin-right: 30px !important;
    margin-bottom: 15px !important;
    min-width: 150px !important;
}

/* Hide all non-category sections */
.filter-section.onsale,
.filter-section.availability,
.filter-section.price {
    display: none !important;
}

/* Only display the categories section */
.filter-section.categories {
    display: block !important;
    width: 100% !important;
}

.filter-section h4 {
    margin: 0 0 10px 0 !important;
    font-size: 14px !important;
    color: #2c3e50 !important;
    font-weight: 600 !important;
}

/* Checkbox styling */
.checkbox-container {
    display: block !important;
    position: relative !important;
    padding-left: 30px !important;
    margin-bottom: 12px !important;
    cursor: pointer !important;
    font-size: 14px !important;
    user-select: none !important;
    color: #34495e !important;
}

.checkbox-container input {
    position: absolute !important;
    opacity: 0 !important;
    cursor: pointer !important;
    height: 0 !important;
    width: 0 !important;
}

.checkmark {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    height: 20px !important;
    width: 20px !important;
    background-color: #fff !important;
    border: 2px solid #ddd !important;
    border-radius: 4px !important;
    transition: all 0.2s ease !important;
}

.checkbox-container:hover input ~ .checkmark {
    border-color: #3b5fe2 !important;
}

.checkbox-container input:checked ~ .checkmark {
    background-color: #3b5fe2 !important;
    border-color: #3b5fe2 !important;
}

.checkmark:after {
    content: "" !important;
    position: absolute !important;
    display: none !important;
}

.checkbox-container input:checked ~ .checkmark:after {
    display: block !important;
}

.checkbox-container .checkmark:after {
    left: 6px !important;
    top: 2px !important;
    width: 5px !important;
    height: 10px !important;
    border: solid white !important;
    border-width: 0 2px 2px 0 !important;
    transform: rotate(45deg) !important;
}

/* Categories section with checkbox on left and toggle on right */
.cat-header {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    width: 100% !important;
}

.checkbox-container {
    flex: 1 !important;
    padding-right: 10px !important;
}

.toggle-sub {
    display: inline-flex !important;
    justify-content: center !important;
    align-items: center !important;
    width: 24px !important;
    height: 24px !important;
    background: #f1f3f5 !important;
    border-radius: 3px !important;
    border: 1px solid #dee2e6 !important;
    font-size: 14px !important;
    font-weight: bold !important;
    cursor: pointer !important;
    user-select: none !important;
    transition: all 0.2s ease !important;
    flex-shrink: 0 !important;
}

.toggle-sub:hover {
    background: #e9ecef !important;
}

.oswald-categories {
    max-height: 300px !important;
    overflow-y: auto !important;
    padding-right: 10px !important;
}

.oswald-category {
    margin-bottom: 8px !important;
    position: relative !important;
}

.subcategories {
    margin-left: 20px !important;
    padding-top: 8px !important;
    padding-left: 10px !important;
    border-left: 1px dashed #dee2e6 !important;
}

/* Filter footer */
.oswald-filter-footer {
    display: flex !important;
    justify-content: flex-end !important;
    gap: 10px !important;
    padding: 15px 20px !important;
    background: #f8f9fa !important;
    border-top: 1px solid #e9ecef !important;
    border-bottom-left-radius: 10px !important;
    border-bottom-right-radius: 10px !important;
}

.reset-btn, .apply-btn {
    padding: 8px 20px !important;
    border-radius: 5px !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
}

.reset-btn {
    background: #f8f9fa !important;
    color: #6c757d !important;
    border: 1px solid #dee2e6 !important;
}

.reset-btn:hover {
    background: #e9ecef !important;
}

.apply-btn {
    background: #3b5fe2 !important;
    color: #fff !important;
    border: none !important;
}

.apply-btn:hover {
    background: #2a4fd8 !important;
}

/* Loading overlay */
.oswald-filter-loading {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    background: rgba(255, 255, 255, 0.7) !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    z-index: 10001 !important;
}

.spinner {
    width: 50px !important;
    height: 50px !important;
    border: 5px solid rgba(59, 95, 226, 0.2) !important;
    border-top: 5px solid #3b5fe2 !important;
    border-radius: 50% !important;
    animation: spin 1s linear infinite !important;
}

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

/* Level-based indentation for subcategories */
.oswald-category.level-1 {
    margin-left: 10px !important;
}
.oswald-category.level-2 {
    margin-left: 20px !important;
}
.oswald-category.level-3 {
    margin-left: 30px !important;
}

/* Count styling */
.count {
    color: #6c757d !important;
    font-size: 12px !important;
    font-weight: normal !important;
}

/* Make sure inputs aren't overridden by theme */
.oswald-filter-container input[type="checkbox"] {
    appearance: none !important;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .oswald-filter-panel {
        min-width: 100% !important;
        left: 0 !important;
        right: 0 !important;
        max-width: 100% !important;
    }
    
    .oswald-filter-body {
        flex-direction: column !important;
    }
    
    .filter-section {
        width: 100% !important;
        margin-right: 0 !important;
    }
}