:root {
    --blue: rgb(12, 135, 232);
    --card-radius: 15px;
    --search-bar-radius: 16px;
}

.product-page-title {
    width: 100%;
    text-align: center;
    padding: 20px 0 0 0;
}

/* product page layout */
.product-top-container {
    display: grid;
    grid-template-columns: 300px 1fr;
    column-gap: 1rem;
}

/* product-filter-section */
.product-filter-section {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 10px;
}

.single-filter {
    display: flex;
    flex-direction: column;
    margin-bottom: 1rem;
}

.single-filter label {
    display: block;
    font-size: 14px;
    margin-bottom: 8px;
}

.single-filter select {
    width: 100%;
    padding: 8px;
    font-size: 14px;
    border: 1px solid #ccc;
    border-radius: 4px;
}

.single-filter select option:first-child {
    color: rgb(255, 255, 255);
}

/* Apply Button */
#applyFilters {
    display: block;
    width: 100%;
    padding: 5px 0;
    background-color: transparent;
    color: black;
    font-size: 16px;
    font-weight: bold;
    letter-spacing: 1px;
    border: 1px solid black;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
}

#applyFilters:hover {
    background-color: black;
    color: white;
}

.filter {
    padding: 2px;
    font-size: 1rem;
    border: 2px solid #ccc;
    border-radius: 1px;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
}

.filter:hover,
.filter:focus {
    border: 2px solid black;
    outline: none;
}

.filter option {
    padding: 10px;
}

.filter-icon {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: nowrap;
    background-color: lightgrey;
    width: 100%;
    padding: 3px 13px;
}

.filter-icon-img {
    height: 20px;
    width: 25px;
}

.filter-icon-text {
    font-weight: normal;
    font-size: 1.3rem;
}

.filter-icon:disabled:hover {
    border: none;
}

@media screen and (max-width: 768px) {
    .product-top-container {
        grid-template-columns: 1fr;
    }

    .filters {
        display: none;
    }

    .filters.active {
        display: flex;
        flex-direction: column;
        padding: 5px;
    }

    .filter-icon:hover {
        border: 1px solid black;
        cursor: pointer;
    }
}

.search-container {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.search-bar {
    display: flex;
    width: 90%;
    margin: 0 auto;
    border-radius: var(--search-bar-radius);
    border: 1px solid lightgrey;
}

.search-bar input {
    width: 100%;
    font-size: 1rem;
    padding: 8px;
    border: none;
    border-top-left-radius: var(--search-bar-radius);
    border-bottom-left-radius: var(--search-bar-radius);
}

.search-icon {
    background-color: lightblue;
    padding: 6px 10px;
    border: none;
    border-top-right-radius: var(--search-bar-radius);
    border-bottom-right-radius: var(--search-bar-radius);
}

.search-icon:hover {
    border: 1px solid black;
}

.search-matched-prod-list {
    width: 90%;
    transition: all 0.3s ease;
}

.match-prod-list {
    list-style: none;
    width: 100%;
}

.match-prod-list-item {
    font-size: 0.85rem;
    background-color: rgba(225, 225, 225, 0.3);
    padding: 8px;
    margin-bottom: 1px;
    border-bottom: 1px solid rgb(40, 40, 40);
    border-radius: 8px;
}

.match-prod-list-item a {
    color: black;
    text-decoration: none;
}

/* product-container */
.product-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    margin: 20px;
}

.product-card {
    position: relative;
    display: flex;
    flex-direction: column;
    border-radius: var(--card-radius);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    transition: all 0.2s ease-in-out;
    max-height: max-content;
}

.product-card:hover {
    cursor: pointer;
    transform: translateY(-5px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1);
}

.product-content {
    padding: 10px;
    font-weight: 500;
}

.product-card img {
    width: 100%;
    max-height: 60%;
    object-fit: contain;
    border-bottom: 1px solid rgba(0, 0, 0, 0.2);
    border-top-left-radius: var(--card-radius);
    border-top-right-radius: var(--card-radius);
}

.product-title {
    text-align: center;
    font-size: 1.5rem;
    font-weight: 500;
    margin-bottom: 10px;
    text-overflow: ellipsis;
}

.product-price {
    font-size: 1.1rem;
    color: #28a745;
    margin: 8px 0;
}

.stock-status {
    position: absolute;
    font-size: 1rem;
    margin: 8px 0;
    padding: 4px 8px;
    border-radius: 4px;
    top: 0;
    right: 10px;
    z-index: 10;
}

.stock-status.in-stock {
    background-color: #d4edda;
    color: #155724;
}

.stock-status.low-stock {
    background-color: #fff3cd;
    color: #856404;
}

.stock-status.out-of-stock {
    background-color: #f8d7da;
    color: #721c24;
}

.product-card .product-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.product-add-to-cart-btn,
.product-view-details-btn {
    background-color: rgb(0, 28, 212);
    color: white;
    font-size: 0.9rem;
    font-weight: 400;
    padding: 10px 15px;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    margin-top: 10px;
    transition: all 0.2s ease;
}

.product-add-to-cart-btn:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

.product-add-to-cart-btn:disabled:hover {
    background-color: #ccc;
    color: white;
    border: none
}

.product-add-to-cart-btn:hover,
.product-view-details-btn:hover {
    border: 1px solid rgb(0, 28, 212);
    background-color: transparent;
    color: rgb(0, 28, 212);
}

.product-card.product-out-of-stock img {
    opacity: 0.4;
}

.product-card.product-out-of-stock .product-content {
    opacity: 0.4;
}


/* rating stars */
.star {
    display: inline-block;
    line-height: 1;
    vertical-align: middle;
}

.star svg {
    display: block;
}

.star+.star {
    margin-left: 2px;
}


/* product modal */
.productModal {
    position: fixed;
    display: none;
    top: 0;
    left: 0;
    z-index: 10000;
    height: 100%;
    width: 100%;
    background-color: rgba(0, 0, 0, 0.5);
}

.modal-content {
    background-color: white;
    height: 80vh;
    width: 80vw;
    margin: 15vh auto;
    border-radius: 12px;
    box-shadow: 0 2px 2px 2px rgb(225, 225, 225);
    animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }

}

.modal-header {
    display: flex;
    padding: 16px 20px;
    height: 60px;
    width: 100%;
    border-top-left-radius: 12px;
    border-top-right-radius: 12px;
    justify-content: space-between;
    align-items: center;
    background-color: rgb(245, 245, 245);
    box-shadow: 0px 5px 5px rgb(180, 180, 180);
}

.close-modal {
    height: 40px;
    width: 40px;
    font-size: 2.1rem;
    font-weight: 500;
    cursor: pointer;
    background-color: transparent;
    border: 1px solid rgb(40, 40, 40);
    border-radius: 50%;
    padding: 1px;
}

.close-modal:hover {
    background-color: rgb(55, 55, 55);
    color: white;
}

.modal-body {
    position: relative;
    height: calc(100% - 70px);
    padding: 10px;
    margin-top: 3px;
    overflow-y: scroll;
}

.modal-body::-webkit-scrollbar {
    border-radius: 10px;
    background: white;
}

.modal-body::-webkit-scrollbar-thumb {
    border-radius: 10px;
    background: black;
}

.modal-product-details {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    height: 100%;
}

.product-gallery {
    flex: 1;
    max-width: 40%;
    height: 100%;

    display: flex;
    justify-content: center;
    align-items: center;
}

.modal-product-image {
    object-fit: contain;
    max-width: 100%;
    height: 100%;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

.product-info-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-evenly;
    gap: 10px;
    height: 100%;
    width: 100%;
}

.product-info-main h3 {
    font-size: 1.5rem;
    letter-spacing: 1px;
}

.product-info-main .brand {
    font-size: 1rem;
    color: rgb(99 103 147);
    font-style: italic;
}

.price-section .price {
    font-size: 1.3rem;
    color: darkslategrey;
}

.price-section .discount {
    color: red;
    font-size: 1.1rem;
    font-weight: bold;
}

.description {
    font-size: 1rem;
    line-height: 1.5;
    color: #555;
    margin-bottom: 20px;
    text-align: justify;
}

.purchase-info {
    margin-bottom: 10px;
}

.purchase-info h3,
.specifications h3 {
    font-size: 1.2rem;
    color: #333;
    margin-bottom: 10px;
}

.purchase-info p,
.specifications p {
    font-size: 1rem;
    color: #666;
    margin: 5px 0;
}

.modal-body.product-out-of-stock {
    opacity: 0.4;
}

@media screen and (max-width: 768px) {

    .product-container {
        padding: 0;
        grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    }

    .product-card img {
        height: 50%;
    }

    .modal-product-details {
        height: auto;
        flex-direction: column;
    }

    .product-gallery {
        max-width: 80%;
    }
}

/* out of stock */
.product-out-of-stock::after {
    content: 'Out Of Stock';
    position: absolute;
    top: 45%;
    rotate: z -45deg;
    color: #a8a7a7;
    text-align: center;
    font-size: 3.5em;
    z-index: 1000;
}

/* load more button */
.load-more-div {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 60px;
}

#load-btn {
    display: none;
    cursor: pointer;
    border: none;
    background-color: transparent;
    font-size: 1rem;
    padding: 10px 12px;
    box-shadow: 0 2px 2px 2px rgb(180, 180, 180);
    transition: all 0.3s ease;
}

#load-btn:hover {
    transform: translateY(-5px);
}