.product-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    padding: 30px;
    max-width: 1200px;
    margin: 0 auto;
    min-height: calc(100vh - 150px);
    position: relative;
    z-index: 1;
    flex: 1 0 auto;
}

.product-item {
    display: flex;
    flex-direction: column;
    align-items: center; /* Center everything horizontally */
    border-radius: 25px;
    height: 450px;
    background-color: var(--card-bg-main);
    box-shadow: rgba(50, 50, 93, 0.25) 0px 30px 60px -12px inset, rgba(0, 0, 0, 0.3) 0px 18px 36px -18px inset;
}

.card {
    background: var(--bg-card);
    padding: 10px;
    text-align: center;
    position: relative;
    transition: transform 0.2s, box-shadow 0.3s;
    min-height: 400px; /* Reduced from 400px */
    max-height: 400px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    border-radius: 15px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.741);
    -webkit-transition: all 0.6s cubic-bezier(0.165, 0.84, 0.44, 1);
    transition: all 0.6s cubic-bezier(0.165, 0.84, 0.44, 1);
}

/* Move title out */
.product-item h3 {
    margin: 2px; /* Reset from inside card */
    font-size: 1.1em;
    color: var(--card-text-title);
    font-weight: 600;
    text-transform: uppercase;
    text-align: center; /* Center above card */
    justify-content: center;
}

.card::after {
    content: "";
    border-radius: 15px;
    position: absolute;
    z-index: -1;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.862);
    opacity: 0;
    -webkit-transition: all 0.6s cubic-bezier(0.165, 0.84, 0.44, 1);
    transition: all 0.6s cubic-bezier(0.165, 0.84, 0.44, 1);
  }

.card img {
    max-width: 100%;
    height: 200px;
    object-fit: contain;
    border-radius: 5px;
    margin-bottom: 15px;
    transition: transform 0.3s ease-in-out;
}

/* Scale card and image together */
.card:hover {
    -webkit-transform: scale(1.005);
    transform: scale(1.005);
}

.card:hover img {
    transform: scale(1.01);
}

.card:hover::after {
    opacity: 1;
}


.card p {
    font-size: 0.9em;
    color: var(--text-muted);
    margin: 10px 0;
    text-align: left;
    flex-grow: 1; /* Still fills space */
    line-height: 1.2;
    overflow: hidden; /* Still clips if needed */
}

.card-footer {
    flex-shrink: 0;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    width: 100%;
    padding-top: 10px;
    border-top: 1px solid var(--border-light);
}

.card .price {
    color: var(--text-warning);
    font-weight: bold;
    font-size: 1.8em;
    margin: 0;
    align-self: flex-start;
}

.card .action-buttons {
    display: flex;
    align-items: center;
    justify-content: flex-end;
}

.card .check-out-btn {
    padding: 10px 25px;
    background-color: var(--btn-primary-bg);
    color: var(--btn-primary-text);
    text-decoration: none;
    border-radius: 10px;
    font-weight: 600;
    transition: all 0.3s ease;
    margin-right: 10px;
    box-shadow: 0 2px 4px var(--shadow-light);
}

.card .check-out-btn:hover {
    background-color: var(--btn-primary-hover);
    box-shadow: 0 4px 8px var(--shadow-medium);
}

.card .save-heart {
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    padding: 2px; /* Small padding to avoid SVG clipping */
}

.card .save-heart img {
    width: 24px; /* Consistent size */
    height: 24px;
    transition: opacity 0.3s ease; /* Smooth hover effect */
}

.card .save-heart:hover img {
    opacity: 0.7; /* Slightly dim on hover for feedback */
}

/*
.card .save-heart.saved img {
  No extra color change needed; solid SVG handles it
}
*/

.like-count {
    margin-left: 5px;
    font-size: 0.9em;
    color: var(--text-muted);
}

#loading {
    text-align: center;
    padding: 20px;
    display: none;
    color: var(--text-link);
    font-size: 1.2em;
}

/* FILTER GROUP */
.filter-row {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    padding: 20px;
    max-width: 1200px;
    margin: 0 auto;
    background-color: none;
    border-bottom: 1px solid var(--border-light);
    align-items: center;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 5px;
}

.filter-group label {
    color: var(--text-muted);
    font-size: 0.9em;
    font-weight: 600;
    margin-right: 5px;
}

.dropdown-checkbox {
    position: relative;
}

.dropdown-toggle {
    padding: 5px 10px;
    border: 1px solid var(--input-border);
    border-radius: 20px;
    background-color: var(--input-bg);
    cursor: pointer;
    font-size: 0.9em;
    min-width: 120px; /* Fixed min width for consistency */
    text-align: left;
    color: var(--text-primary);
    transition: background-color 0.3s;
}

.dropdown-toggle:hover {
    background-color: var(--dropdown-hover);
}

.checkbox-list {
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 10px;
    background-color: var(--dropdown-bg);
    border: 1px solid var(--dropdown-border);
    border-radius: 5px;
    padding: 5px;
    max-height: 200px;
    overflow-y: auto;
    z-index: 5;
    min-width: 120px; /* Matches button min-width */
    width: auto; /* Allows natural expansion */
    max-width: 250px; /* Caps width for long names */
    white-space: nowrap; /* Prevents text wrapping */
}

.checkbox-list label {
    display: block;
    padding: 3px 5px;
    font-size: 0.9em;
    cursor: pointer;
    color: var(--text-primary);
}

.checkbox-list input {
    margin-right: 5px;
}

#custom-price {
    display: none;
    padding: 5px;
}

#custom-price input {
    width: 60px;
    padding: 3px;
    border: 1px solid var(--input-border);
    border-radius: 3px;
    background-color: var(--input-bg);
    font-size: 0.9em;
}

#custom-price span {
    color: var(--text-muted);
    margin: 0 5px;
}

#apply-filters {
    padding: 8px 15px;
    background-color: var(--btn-primary-bg);
    color: var(--btn-primary-text);
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-weight: 600;
    transition: background-color 0.3s;
}

#apply-filters:hover {
    background-color: var(--btn-primary-hover);
}

#filter-bubbles {
    padding: 10px 20px;
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.filter-bubble {
    background-color: var(--bg-alt);
    padding: 5px 10px;
    border-radius: 15px;
    font-size: 0.9em;
    display: flex;
    align-items: center;
    gap: 5px;
}

.remove-filter {
    cursor: pointer;
    color: var(--text-error);
    font-weight: bold;
}

.remove-filter:hover {
    color: var(--text-link-hover);
}

.clear-all {
    cursor: pointer;
    color: var(--text-link);
    font-size: 0.9em;
    padding: 5px 10px;
}

.clear-all:hover {
    color: var(--text-link-hover);
    text-decoration: underline;
}