/* Global Styles */
:root {
    --primary-color: #000000;
    --secondary-color: #666666;
    --border-color: #E5E5E5;
    --transition-speed: 0.3s;
}

/* Override Bootstrap's border-radius */
.btn,
.dropdown-menu,
.form-control,
.form-check-input {
    border-radius: 0 !important;
}

body {
    font-family: 'Poppins', sans-serif;
    color: var(--primary-color);
    letter-spacing: 0.5px;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Header Styles */
header {
    border-bottom: 1px solid var(--border-color);
}

.back-link {
    color: var(--primary-color);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
}

.back-link:hover {
    color: var(--primary-color);
}

.points-available {
    text-align: right;
}

.points-number {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--primary-color);
}

.points-text {
    font-size: 0.7rem;
    color: var(--secondary-color);
    letter-spacing: 0.5px;
}

/* Main Content Styles */
h1 {
    font-size: 1.75rem;
    font-weight: 600;
    color: var(--primary-color);
}

.subtitle {
    font-size: 0.9rem;
    color: var(--secondary-color);
}

/* Filter Section Styles */
.filter-section {
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.7rem;
    margin-bottom: 1.5rem;
    position: relative;
    z-index: 1000;
}

.filter-content-inner {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
}

.filters {
    display: flex;
    gap: 1rem;
    flex-grow: 1;
    min-width: 0;
}

.search-sort-section {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* Search Styles */
.search-container {
    position: relative;
    min-width: 40px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
}

.search-input {
    width: 0;
    padding: 0;
    border: none;
    border-bottom: 1px solid var(--border-color);
    outline: none;
    font-size: 0.875rem;
    transition: all 0.3s ease;
    opacity: 0;
    visibility: hidden;
    position: absolute;
    right: 40px;
    background: white;
}

.search-container.active .search-input {
    width: 200px;
    padding: 0.5rem;
    opacity: 1;
    visibility: visible;
}

.btn-search {
    border: none;
    background: none;
    padding: 0.5rem;
    color: var(--primary-color);
    cursor: pointer;
    z-index: 2;
    position: relative;
}

.btn-search:hover {
    opacity: 0.8;
}

/* Dropdown Styles */
.dropdown {
    position: relative;
}

.dropdown-menu {
    position: relative;
    top: 100%;
    left: 0;
    z-index: 1050;
    display: none;
    min-width: 200px;
    padding: 1rem;
    margin: 0.5rem 0 0;
    background-color: #fff;
    border: none;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.dropdown-menu.show {
    display: block;
}

.filter-dropdown .dropdown-menu {
    margin-top: calc(1rem + 2px); /* Account for the hover line space */
}

/* Filter Dropdowns */
.filter-dropdown {
    position: static; /* Change to static so dropdown is positioned relative to filter-section */
}

.dropdown-footer {
    border-top: 1px solid var(--border-color);
    padding-top: 1rem;
    margin-top: 1rem;
    display: flex;
    justify-content: space-between;
    gap: 0.5rem;
}

.btn-filter {
    font-size: 0.75rem;
    font-weight: 500;
    padding: 0.5rem 1.25rem;
    border: none;
    color: var(--primary-color);
    background-color: transparent;
    white-space: nowrap;
    position: relative;
}

.btn-filter::after {
    display: none;
}

.btn-filter:hover {
    background-color: transparent;
    color: var(--primary-color);
}

.filter-dropdown .btn-filter:hover::before {
    content: '';
    position: absolute;
    bottom: -1rem;
    left: 1.25rem;
    right: 1.25rem;
    height: 2px;
    background-color: var(--primary-color);
    z-index: 1001; /* Above the filter section border */
}

.sort-dropdown .btn-filter:hover::before {
    display: none;
}

.btn-filter:focus {
    box-shadow: none;
    background-color: transparent;
    color: var(--primary-color);
}

.btn-apply,
.btn-clear {
    font-size: 0.75rem;
    font-weight: 500;
    padding: 0.5rem 1rem;
    border: 1px solid var(--primary-color);
    color: var(--primary-color);
    background-color: transparent;
    transition: all var(--transition-speed);
    flex: 1;
}

.btn-apply {
    background-color: var(--primary-color);
    color: white;
}

.btn-apply:hover {
    opacity: 0.9;
    color: white;
}

.btn-clear:hover {
    background-color: var(--primary-color);
    color: white;
}

/* Nested Dropdowns */
.nested-item {
    padding-left: 1.5rem;
}

/* Product Card Styles */
.product-card {
    text-align: center;
    padding: 1.5rem;
    position: relative;
    background-color: white;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.product-image-container {
    position: relative;
    margin-bottom: 1rem;
    flex-shrink: 0;
}

.product-image {
    max-width: 100%;
    height: auto;
    margin: 0 auto;
    display: block;
}

.product-details {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    position: relative;
}

.product-info {
    text-align: center;
}

.product-title {
    font-size: 1rem;
    margin: 0 0 0.5rem;
    font-weight: 500;
    flex-grow: 1;
}

.product-description {
    font-size: 0.8rem;
    color: var(--secondary-color);
    margin-bottom: 0.5rem;
}

.points-cost {
    font-size: 0.8rem;
    color: var(--secondary-color);
    margin-bottom: 1rem;
}

.points-text {
    margin-bottom: 1rem;
    color: var(--primary-color);
}

.btn-info {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: none;
    border: none;
    padding: 0.5rem;
    color: var(--primary-color);
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 2;
    cursor: pointer;
    font-size: 1.25rem;
}

.product-card:hover .btn-info {
    opacity: 1;
}

.redemption-tag {
    font-size: 0.75rem;
    font-weight: 500;
    padding: 0.25rem 0.75rem;
    background: white;
    border: 1px solid var(--primary-color);
    display: inline-block;
    margin: 0 auto 0.75rem;
    white-space: nowrap;
}

.btn-redeem {
    font-size: 0.8rem;
    font-weight: 600;
    padding: 0.75rem 1.5rem;
    background-color: white;
    border: 1px solid var(--primary-color);
    color: var(--primary-color);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    width: 100%;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.3s ease;
    margin-top: auto;
}

.product-card:hover .btn-redeem {
    opacity: 1;
    transform: translateY(0);
}

.btn-redeem:hover {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* Modal Styles */
.modal-content {
    border-radius: 0;
    border: none;
}

.modal-header {
    padding: 1rem 1rem 0;
}

.btn-close {
    opacity: 1;
}

.modal-body {
    padding: 1.5rem;
}

.modal-product-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.modal-points {
    color: var(--primary-color);
    font-size: 0.9rem;
}

.location-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.accordion {
    --bs-accordion-btn-padding-y: 0.75rem;
    --bs-accordion-btn-padding-x: 1rem;
    --bs-accordion-btn-color: var(--primary-color);
    --bs-accordion-btn-bg: transparent;
    --bs-accordion-btn-focus-border-color: none;
    --bs-accordion-btn-focus-box-shadow: none;
    --bs-accordion-body-padding-x: 1rem;
    --bs-accordion-body-padding-y: 1rem;
    --bs-accordion-active-color: var(--primary-color);
    --bs-accordion-active-bg: transparent;
}

.accordion-button {
    font-size: 0.85rem;
    font-weight: 500;
    text-transform: uppercase;
}

.accordion-button:not(.collapsed) {
    box-shadow: none;
}

.terms-list li {
    display: flex;
    align-items: center;
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
}

.terms-list li i {
    font-size: 0.4rem;
    color: var(--primary-color);
}

/* Form Styles */
.form-check {
    margin-bottom: 0.75rem;
}

.form-check:last-child {
    margin-bottom: 0;
}

.form-check-label {
    font-size: 0.85rem;
    font-weight: 400;
    color: var(--primary-color);
    cursor: pointer;
}

.form-check-input {
    margin-top: 0.2rem;
    cursor: pointer;
}

.form-check-input:checked {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.form-check-input:focus {
    box-shadow: none;
    border-color: var(--border-color);
}

/* Dropdown Styles */
.dropdown-item {
    font-size: 0.85rem;
    color: var(--primary-color);
    padding: 0.5rem 1rem;
}

.dropdown-item:hover {
    background-color: #f8f9fa;
    color: var(--primary-color);
}

.dropdown-menu-content {
    max-height: 300px;
    overflow-y: auto;
}

/* Responsive Styles */
@media (max-width: 991px) {
    .filter-section {
        margin: 0 -1rem 1.5rem -1rem;
        padding: 0 1rem 1rem;
        position: relative;
        border-bottom: 1px solid var(--border-color);
    }

    .filter-expand-btn {
        display: flex !important;
        width: 100%;
        justify-content: space-between;
        align-items: center;
        padding: 0.75rem 0;
        background: none;
        border: none;
        font-weight: 500;
        cursor: pointer;
        transition: all 0.3s ease;
    }

    .filter-expand-btn i {
        transition: transform 0.3s ease;
    }

    .filter-expand-btn.active i {
        transform: rotate(180deg);
    }

    .filter-content {
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease-out;
    }

    .filter-content.show {
        max-height: 2000px;
        transition: max-height 0.5s ease-in;
        padding-top: 1rem;
    }

    .filter-content-inner {
        flex-direction: column;
        gap: 1rem;
    }

    .filters {
        flex-direction: column;
        gap: 0.75rem;
        width: 100%;
    }

    .search-sort-section {
        flex-direction: column;
        width: 100%;
        gap: 0.75rem;
        padding-top: 0.75rem;
        border-top: 1px solid var(--border-color);
    }

    .filter-dropdown {
        width: 100%;
    }
    
    .filter-dropdown .dropdown-menu {
        position: relative !important;
        box-shadow: none;
        transform: translate3d(0px, 0px, 0px) !important;
    }

    .btn-filter {
        width: 100%;
        text-align: left;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }

    .btn-filter:hover {
        border-color: transparent !important;
    }

    .search-container {
        width: 100%;
        margin: 0;
    }

    .search-input {
        right: 40px;
        left: 0;
    }

    .search-container.active .search-input {
        width: calc(100% - 40px);
    }

    .btn-search {
        margin-left: auto;
    }

    .sort-dropdown {
        width: 100%;
    }

    .sort-dropdown .btn-filter,
    .sort-dropdown .dropdown-menu {
        width: 100%;
        text-align: left;
    }

    .sort-dropdown .dropdown-item {
        text-align: left;
    }
}

/* Loading Animation */
@keyframes shimmer {
    0% { background-position: -1000px 0; }
    100% { background-position: 1000px 0; }
}

.loading {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 1000px 100%;
    animation: shimmer 2s infinite linear;
}
