/* Consolidated Product Styles */
:root {
    --primary-color: #3498db;
    --secondary-color: #2ecc71;
    --dark-color: #2c3e50;
    --light-color: #f8f9fa;
    --danger-color: #e74c3c;
    --border-color: #e1e4e8;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --transition: all 0.3s ease;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
}

/* Header Styles */
.page-header {
    text-align: center;
    margin: 2rem 0 3rem;
    padding: 2rem 0;
    background: linear-gradient(135deg, #f5f7fa 0%, #e4e8f0 100%);
    border-radius: 10px;
    box-shadow: var(--shadow);
}

.page-header h1 {
    font-size: 2.5rem;
    color: var(--dark-color);
    margin-bottom: 0.5rem;
}

.page-header p {
    font-size: 1.1rem;
    color: #666;
    max-width: 700px;
    margin: 0 auto;
}

/* Filter Section */
.filters-container {
    background: #fff;
    border-radius: 10px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow);
    display: block;
    /* Override flex from old css if needed, but structure below uses flex */
}

#filterForm {
    display: flex;
    flex-wrap: nowrap;
    gap: 1rem;
    align-items: end;
}

.filter-group {
    flex: 1;
    min-width: 0;
    /* Prevents overflow */
    margin-bottom: 0;
    display: flex;
    flex-direction: column;
}

/* Specific widths for better proportion */
.filter-group:nth-child(1) {
    flex: 2;
}

/* Search */
.filter-group:nth-child(2) {
    flex: 1.5;
}

/* Category */
.filter-group:nth-child(3) {
    flex: 1.5;
}

/* Sort */
.filter-group:nth-child(4) {
    flex: 2;
}

/* Price */
.filter-buttons {
    flex: 0 0 auto;
}

/* Buttons */

.filter-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--dark-color);
}

.filter-group input[type="text"],
.filter-group input[type="number"],
.filter-group select {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 1rem;
    transition: var(--transition);
    box-sizing: border-box;
}

.filter-group input[type="text"]:focus,
.filter-group input[type="number"]:focus,
.filter-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.2);
}

.price-inputs {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.price-inputs input {
    flex: 1;
    min-width: 0;
}

.price-inputs span {
    color: #666;
}

.btn-apply-filters,
.btn-reset-filters {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    text-align: center;
    display: inline-block;
}

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

.btn-apply-filters:hover {
    background-color: #2980b9;
    transform: translateY(-2px);
}

.btn-reset-filters {
    background-color: #f1f1f1;
    color: #333;
    text-decoration: none;
}

.btn-reset-filters:hover {
    background-color: #e1e4e8;
}

/* Results Summary */
.results-summary {
    margin: 1.5rem 0;
    color: #666;
    font-size: 0.95rem;
}

/* Product Grid */
.product-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 2rem;
    margin: 2rem 0;
    padding: 0;
}

.product-card {
    background: #fff;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: var(--transition);
    display: flex;
    flex-direction: column;
}

.product-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.15);
}

.product-card a {
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.product-image {
    height: 200px;
    overflow: hidden;
    position: relative;
    background: #f8f9fa;
    display: flex;
    align-items: center;
    justify-content: center;
}

.product-image img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    transition: transform 0.5s ease;
}

.product-card:hover .product-image img {
    transform: scale(1.1);
}

.product-category {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(255, 255, 255, 0.9);
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--dark-color);
}

.product-info {
    padding: 1.5rem;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.product-info h3 {
    margin: 0 0 0.5rem;
    font-size: 1.1rem;
    color: var(--dark-color);
    font-weight: 600;
}

.price {
    font-size: 1.25rem;
    color: var(--primary-color);
    font-weight: 700;
    margin-top: auto;
}

.mrp {
    text-decoration: line-through;
    text-decoration-color: red;
    color: #999;
    margin-right: 15px;
    font-size: 1rem;
    font-weight: 500;
}

/* No Products Found */
.no-products-found {
    text-align: center;
    padding: 3rem;
    background: #f8f9fa;
    border-radius: 10px;
    margin: 2rem 0;
}

.no-products-found p {
    margin-bottom: 1.5rem;
    color: #666;
    font-size: 1.1rem;
}

.btn-primary {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    background-color: var(--primary-color);
    color: white;
    text-decoration: none;
    border-radius: 6px;
    font-weight: 600;
    transition: var(--transition);
}

.btn-primary:hover {
    background-color: #2980b9;
    transform: translateY(-2px);
}

/* Product Detail Styles (Preserving existing ones) */
.product-detail-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    margin-top: 50px;
    padding: 40px;
    background-color: #fff;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.product-detail-image img {
    width: 100%;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.product-detail-info h1 {
    font-size: 48px;
    margin-bottom: 20px;
}

.product-detail-info .price {
    font-size: 36px;
    font-weight: bold;
    color: #007bff;
    margin-bottom: 30px;
}

.product-detail-info pre {
    font-size: 16px;
    line-height: 1.6;
    color: #666;
    white-space: pre-wrap;
    margin-bottom: 30px;
    font-family: inherit;
}

.btn-buy {
    background-color: #28a745;
    color: white;
    border: none;
    padding: 15px 30px;
    font-size: 18px;
    border-radius: 5px;
    cursor: pointer;
    width: auto;
    transition: background-color 0.3s;
}

.btn-buy:hover {
    background-color: #218838;
}

/* Modal Styles */
.modal {
    display: none !important;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.5);
}

.modal.show {
    display: block !important;
}

.modal-content {
    background-color: #fefefe;
    margin: 10% auto;
    padding: 20px;
    border: 1px solid #888;
    width: 80%;
    max-width: 700px;
    border-radius: 10px;
    position: relative;
}

.close-btn {
    color: #aaa;
    position: absolute;
    top: 10px;
    right: 20px;
    font-size: 28px;
    font-weight: bold;
}

.close-btn:hover,
.close-btn:focus {
    color: black;
    text-decoration: none;
    cursor: pointer;
}

.payment-details {
    display: flex;
    gap: 20px;
}

.qr-code {
    flex: 1;
    text-align: center;
}

#payment-form {
    flex: 1;
    display: flex;
    flex-direction: column;
}

#payment-form h3 {
    margin-top: 0;
}

#payment-form input,
#payment-form textarea {
    padding: 10px;
    margin-bottom: 10px;
    border: 1px solid #ccc;
    border-radius: 5px;
}

#payment-form button {
    background-color: #007bff;
    color: white;
    border: none;
    padding: 12px;
    font-size: 16px;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

#payment-form button:hover {
    background-color: #0056b3;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .product-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 992px) {
    #filterForm {
        flex-wrap: wrap;
    }

    .filter-group {
        flex: 1 1 45%;
        /* 2 per row */
    }

    .filter-buttons {
        flex: 1 1 100%;
        display: flex;
        gap: 1rem;
        justify-content: center;
    }

    .product-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .product-detail-container {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 576px) {
    #filterForm {
        flex-direction: column;
    }

    .filter-group {
        flex: 1 1 100%;
        width: 100%;
    }

    .filter-buttons {
        flex-direction: column;
        width: 100%;
    }

    .btn-apply-filters,
    .btn-reset-filters {
        width: 100%;
        box-sizing: border-box;
    }

    .page-header h1 {
        font-size: 2rem;
    }

    .product-grid {
        grid-template-columns: 1fr;
    }

    .payment-details {
        flex-direction: column;
    }
}