/* Filter section animations */
.filter-section-toggle.active svg,
.measurement-type-toggle.active svg {
    transform: rotate(180deg);
}

/* Custom checkbox styling */
input[type="checkbox"] {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border: 1px solid #d1d5db;
    border-radius: 0.25rem;
    margin-right: 0.5rem;
    position: relative;
    cursor: pointer;
    transition: all 0.2s ease;
    vertical-align: middle; /* Align checkbox with text */
}

input[type="checkbox"]:checked {
    background-color: var(--primary-color); /* Use primary color */
    border-color: var(--primary-color);
}

input[type="checkbox"]:checked::after {
    content: "";
    position: absolute;
    left: 5px;
    top: 1px;
    width: 4px;
    height: 9px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

/* Button hover effects */
.transition {
    transition: all 0.2s ease-in-out;
}

/* Product card hover shadow */
.shadow-md {
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.shadow-lg {
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

.hover\:shadow-lg:hover {
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

/* Line clamping for product names */
.line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis; /* Ensures ellipsis for clamped text */
}

/* Custom scrollbar for filter panel */
#mobile-filter-panel::-webkit-scrollbar {
    width: 6px;
}

#mobile-filter-panel::-webkit-scrollbar-track {
    background: #f9fafb;
}

#mobile-filter-panel::-webkit-scrollbar-thumb {
    background-color: #e5e7eb;
    border-radius: 3px;
}

/* Fix for product grid layout */
.grid.grid-cols-1.sm\:grid-cols-2.lg\:grid-cols-3.xl\:grid-cols-4.gap-6 {
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); /* Adjusted min-width for more items on larger screens */
    gap: 1.5rem;
}

@media (max-width: 640px) {
    .grid.grid-cols-1.sm\:grid-cols-2.lg\:grid-cols-3.xl\:grid-cols-4.gap-6 {
        grid-template-columns: 1fr;
    }
}

/* Ensure product cards are properly sized */
.relative.bg-white.rounded-xl {
    display: flex;
    flex-direction: column;
    height: 100%; /* Ensure cards take full height in grid item */
}

/* Fix image container height */
.relative.h-56.sm\:h-64 {
    height: 14rem;
    flex-shrink: 0;
    width: 100%; /* Ensure image container fills width */
    position: relative; /* For quick view positioning */
}

/* Ensure content area grows properly */
.p-5 {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between; /* Distribute content and push buttons to bottom */
}

/* Push action buttons to bottom */
.relative.bg-white.rounded-xl .p-5 > .bg-green-500, /* Target WhatsApp button directly if it's the last element before the main button group */
.relative.bg-white.rounded-xl .p-5 > .grid.grid-cols-1.gap-2 {
    margin-top: auto; /* Pushes this element and subsequent siblings to the bottom */
}


/* General improvements for filter UI elements */
.filter-section-content a, .filter-section-content label {
    display: flex;
    align-items: center;
    padding: 0.5rem 0.75rem;
    border-radius: 0.375rem; /* rounded-lg */
    transition: background-color 0.2s ease, color 0.2s ease;
}

.filter-section-content a:hover, .filter-section-content label:hover {
    background-color: #f3f4f6; /* hover:bg-gray-100 */
}

.filter-section-content a.bg-indigo-50, .filter-section-content label .peer-checked\:bg-indigo-50 {
    background-color: #eef2ff; /* bg-indigo-50 */
    color: #4f46e5; /* text-indigo-700 */
}

/* Sort dropdown styling */
select {
    appearance: none; /* Remove default arrow */
    background-image: url('data:image/svg+xml;charset=UTF-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2020%2020%22%20fill%3D%22none%22%20stroke%3D%22currentColor%22%20stroke-width%3D%221.5%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Cpath%20d%3D%22M7%207l3-3%203%203m0%206l-3%203-3-3%22%2F%3E%3C%2Fsvg%3E');
    background-repeat: no-repeat;
    background-position: right 0.5rem center;
    background-size: 1.5em 1.5em;
    padding-right: 2.5rem; /* Make space for custom arrow */
}
select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(var(--primary-color-rgb), 0.2);
}

/* Ensure consistent button styling across product card actions */
.bg-yellow-500 {
    background-color: var(--primary-color);
}
.hover\:bg-yellow-600:hover {
    background-color: #c5a032; /* Slightly darker primary */
}
.focus\:ring-yellow-500:focus {
    box-shadow: 0 0 0 2px rgba(212, 175, 55, 0.5);
}

.bg-green-500 {
    background-color: #22c55e;
}
.hover\:bg-green-600:hover {
    background-color: #16a34a;
}
.focus\:ring-green-500:focus {
    box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.5);
}
.bg-blue-100 {
    background-color: #e0f2fe;
}
.text-blue-700 {
    color: #1d4ed8;
}
.bg-red-100 {
    background-color: #fee2e2;
}
.text-red-700 {
    color: #b91c1c;
}

/* Mobile filter panel sticky header/footer */
#mobile-filter-panel {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background-color: white;
    z-index: 50; /* Above other content, below toasts/modals */
    overflow-y: auto;
    transform: translateX(100%); /* Start off-screen */
    transition: transform 0.3s ease-in-out;
}
#mobile-filter-panel.hidden {
    transform: translateX(100%);
}
#mobile-filter-panel:not(.hidden) {
    transform: translateX(0);
}
.sticky.top-0.z-20.bg-white.shadow-sm.py-2 {
    position: sticky;
    top: 0;
    z-index: 10;
}
.p-4.border-t.border-gray-200.bg-white.sticky.bottom-0 {
    position: sticky;
    bottom: 0;
    background-color: white; /* Ensure background is opaque */
    z-index: 10;
}