/* Products Page Styles */

/* --- Product Detail Page Layout --- */
.product-detail {
    width: 100%;
    padding: 60px 0 80px;
    background: #f5f5f0;
    display: flex;
    justify-content: center;
}

.product-detail .container {
    max-width: 1200px;
    width: 100%;
    padding: 0 24px;
}

.product-detail-container {
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: flex-start;
    gap: 60px;
    width: 100%;
    margin: 0 auto;
    background: #fff;
    border-radius: 20px;
    box-shadow: 0 8px 40px rgba(0,0,0,0.06);
    padding: 48px;
    box-sizing: border-box;
}

.product-gallery {
    flex: 0 0 420px;
    max-width: 420px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
}

.main-image {
    width: 100%;
    max-width: 380px;
    aspect-ratio: 1 / 1;
    background: linear-gradient(135deg, #f9f9f9 60%, #ececec 100%);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    box-shadow: 0 4px 24px rgba(0,0,0,0.06), 0 0 0 2px #ededed;
    border: 1.5px solid #e2e2e2;
    transition: all 0.3s ease-in-out;
    cursor: zoom-in;
}

.main-image:hover {
    box-shadow: 0 12px 32px rgba(0,0,0,0.1), 0 0 0 2px var(--primary-color, #8b0000);
    transform: translateY(-4px);
}

.main-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 20px;
    box-sizing: border-box;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.main-image:hover img {
    transform: scale(1.02);
}

@keyframes fadeIn {
    from { opacity: 0.7; transform: scale(0.98); }
    to { opacity: 1; transform: scale(1); }
}

.main-image img.fade-in {
    animation: fadeIn 0.3s ease-out forwards;
}

.thumbnail-container {
    display: flex;
    flex-direction: row;
    gap: 12px;
    align-items: center;
    justify-content: center;
}

.thumbnail {
    width: 64px;
    height: 64px;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #eee;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fafafa;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.thumbnail::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border: 2px solid transparent;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.thumbnail.active {
    border-color: var(--primary-color, #8b0000);
    transform: scale(1.05);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.thumbnail.active::after {
    border-color: var(--primary-color, #8b0000);
}

.thumbnail:hover {
    transform: scale(1.08);
    border-color: var(--primary-color, #8b0000);
    z-index: 1;
}

.thumbnail:active {
    transform: scale(0.98);
}

.thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 4px;
    box-sizing: border-box;
}

/* --- Product Content Styles --- */
.product-content {
    flex: 1 1 0;
    max-width: 600px;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    gap: 1.2rem;
    padding: 12px 0;
    min-width: 0;
}

.product-content h2 {
    font-size: 2.4rem;
    margin: 0;
    color: var(--primary-color, #8b0000);
    font-weight: 700;
    line-height: 1.2;
}

.product-meta {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 24px;
    font-size: 1.1rem;
    color: #555;
}

.product-description, .product-features, .product-usage {
    margin: 0;
}

.product-description h3,
.product-features h3,
.product-usage h3 {
    font-size: 1.25rem;
    margin: 0 0 0.6em 0;
    color: var(--primary-color, #8b0000);
}

.product-description p, .product-usage p {
    font-size: 1.05rem;
    margin: 0;
    line-height: 1.7;
    color: #444;
}

.product-features ul {
    padding-right: 1.2em;
    margin: 0;
    font-size: 1.05rem;
    line-height: 1.7;
    color: #444;
}

.product-features li {
    margin-bottom: 0.4em;
}

.product-content .btn {
    margin-top: 1em;
    align-self: flex-start;
    padding: 12px 28px;
}

/* --- Responsive Adjustments for Product Detail Page --- */
@media (max-width: 992px) {
    .product-detail {
        padding: 40px 0 60px;
    }

    .product-detail-container {
        flex-direction: column;
        align-items: center;
        gap: 40px;
        padding: 32px;
    }

    .product-gallery {
        flex: unset;
        max-width: 100%;
        width: 100%;
    }

    .main-image {
        max-width: 320px;
    }

    .product-content {
        max-width: 100%;
        width: 100%;
        padding: 0;
        align-items: center;
        text-align: center;
    }

    .product-content .btn {
        align-self: center;
    }

    .product-meta {
        justify-content: center;
    }
}

@media (max-width: 600px) {
    .product-detail .container {
        padding: 0 16px;
    }

    .product-detail-container {
        padding: 24px 20px;
        border-radius: 12px;
    }

    .product-content h2 {
        font-size: 1.8rem;
    }

    .main-image {
        max-width: 260px;
    }

    .thumbnail {
        width: 52px;
        height: 52px;
    }
}
/* --- End Product Detail Page Layout --- */

/* --- General Layout & Body Styles --- */
:root {
    --header-height: 80px;
    --footer-height: 60px;
}

html, body {
    height: 100%;
    margin: 0;
    padding: 0;
    font-family: 'Noto Nastaliq Urdu', 'jameel-noori-nastaleeq', Arial, sans-serif;
    line-height: 1.8;
    color: var(--text-color);
    background-color: var(--light-color);
}

body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.main-content-wrapper {
    flex: 1 0 auto;
    width: 100%;
    padding: 0 0 80px 0; /* Add padding at the bottom for footer */
    margin: 0;
    position: relative;
}

/* Footer styling */
#footer-placeholder {
    width: 100%;
    margin-top: auto;
}

/* Products view specific adjustments */
.products-view {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    width: 100%;
    padding-bottom: 40px; /* Extra space above footer */
}

/* --- Page Header Styles --- */
.page-header {
    padding: 0.5rem 0; /* Reduced padding for less vertical space */
    margin: 0; /* Remove any default margins */
}

.page-header h2 {
    font-size: 2rem; /* Adjusted for smaller size */
    margin-bottom: 0; /* Reduced for less space */
    color: var(--primary-color);
}

/* --- Products View Styles --- */
.products-view {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    min-height: 0;
    padding: 1rem 0 2rem 0;
    margin-bottom: 20px;
}

/* --- Product Grid Styles --- */
.product-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin: 0.5rem auto;
    width: 95%;
    max-width: 1200px;
    box-sizing: border-box;
    padding: 0 10px;
}

/* --- Product Card Styles --- */
.product-card {
    position: relative;
    border: 1px solid #f0f0f0;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    height: 320px; /* Taller cards for desktop */
    width: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    background: #fff;
    margin: 0;
    padding: 0;
    transition: all 0.2s ease;
}

.product-card-link {
    transition: transform 0.23s cubic-bezier(.22,.68,.53,1.01), box-shadow 0.23s cubic-bezier(.22,.68,.53,1.01);
    display: block;
}

.product-card-link:hover, .product-card-link:focus {
    transform: scale(1.045);
    box-shadow: 0 6px 24px 0 rgba(0,0,0,0.13);
    z-index: 2;
}

.product-image {
    position: relative;
    width: 100%;
    height: 0;
    padding-bottom: 100%; /* 1:1 Aspect Ratio */
    z-index: 1;
    overflow: hidden;
    background: #f9f9f9;
    display: flex;
    align-items: center;
    justify-content: center;
    border-bottom: 1px solid #f0f0f0;
}

.product-image img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 10px;
    box-sizing: border-box;
    transition: transform 0.3s;
    background: #fff;
}

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

.product-info {
    position: relative;
    z-index: 2;
    background: #fff;
    margin: 0;
    padding: 12px 8px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 60px;
    box-sizing: border-box;
    text-align: center;
}

.product-info h3 {
    margin: 0;
    font-size: 1.1rem;
    line-height: 1.2;
    color: var(--primary-color);
    text-shadow: none;
    font-weight: 600;
    flex: 1 1 auto;
    text-align: center;
    background: none;
    width: 100%;
}

.product-info p {
    margin: 0 0 0.5rem;
    font-size: 0.8rem;
    line-height: 1.3;
    color: #111;
    text-shadow: 0 2px 8px rgba(0,0,0,0.18), 0 1px 0 #fff;
    flex-grow: 1;
}

.product-info .btn {
    align-self: flex-end; /* Align the button to the left */
    padding: 0.3rem 0.6rem;
    font-size: 0.8rem;
    margin-top: 0.5rem;
}

/* --- Pagination Styles --- */
.pagination-top {
    margin: 0.5rem 0 1.5rem 0;
    display: flex;
    justify-content: center;
    width: 100%;
    padding: 0 10px;
}

.pagination-bottom {
    margin: 1.5rem 0 0 0;
    padding: 0 10px 2rem 10px;
    display: flex;
    justify-content: center;
    width: 100%;
    position: relative;
    z-index: 10;
}

@media (max-width: 768px) {
    .pagination-bottom {
        padding-bottom: 1rem;
    }
}

.search-container {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 20px;
}

.pagination-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    margin: 1rem 0;
    position: relative;
    z-index: 1000;
}

.pagination-controls .btn,
.pagination-controls .btn-icon {
    padding: 0.75rem 1.5rem;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-sm);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.pagination-controls .btn-icon {
    padding: 0.75rem;
}

.pagination-controls .btn:hover,
.pagination-controls .btn-icon:hover {
    background-color: #8b0000; /* Darker red for better contrast */
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
    color: white;
    border: 1px solid #ff9999; /* Light border for definition */
}

.pagination-controls .btn:disabled,
.pagination-controls .btn-icon:disabled {
    background-color: #e0e0e0;
    color: #666666;
    cursor: not-allowed;
    transform: none;
    opacity: 0.8;
    box-shadow: none;
    border: 1px solid #cccccc;
}

#page-indicator,
#page-indicator-bottom {
    margin: 0 1rem;
    font-weight: 600;
    color: var(--primary-color);
    font-size: 1.1rem;
}

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

.product-card {
    animation: fadeIn 0.3s ease-out forwards;
    opacity: 0;
    width: 100%; /* Ensure full width within grid column */
}

/* --- Responsive Design --- */
@media (max-width: 1024px) {
    .product-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 15px;
        width: 95%;
    }
    
    .product-card {
        height: 280px;
    }
}

@media (max-width: 768px) {
    .product-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
        padding: 0 10px;
        width: 100%;
    }
    
    .product-card {
        height: 240px; /* Increased height for title space */
        border-radius: 6px;
    }

    .product-image {
        padding-bottom: 80%; /* Reduce image height to free space for title */
    }
    
    .product-image img {
        padding: 8px;
    }

    .product-info h3 {
        font-size: 0.85rem;
        line-height: 1.3;
        padding: 0 4px;
        margin: 0;
    }

    .product-info {
        min-height: 80px; /* Ensure enough room for 2-line titles */
    }

    .product-info p {
        display: none; /* Hide description on mobile to save space */
    }

    .product-card-link:hover, 
    .product-card-link:focus {
        transform: scale(1.03);
        box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    }
}

/* Extra small devices (phones, 480px and down) */
@media (max-width: 480px) {
    .product-grid {
        gap: 8px;
        padding: 0 8px;
    }
    
    .product-card {
        height: 220px; /* Increased height for portrait phones */
    }
    
    .product-image {
        padding-bottom: 65%; /* Smaller image to leave more room for text */
    }
    
    .product-image img {
        padding: 8px;
    }
    
    .product-info h3 {
        font-size: 0.8rem;
        padding: 0 4px;
        margin-top: 4px;
    }

    .product-info {
        min-height: 90px; /* More space for title area on very small screens */
    }
}

/* --- Image Modal Styles --- */
.image-modal {
    display: flex;
    align-items: center;
    justify-content: center;
    position: fixed; /* Stay in place */
    z-index: 1000; /* Sit on top */
    width: 100%; /* Full width */
    height: 100%; /* Full height */
    overflow: auto; /* Enable scroll if needed */
    background-color: rgba(0,0,0,0.8); /* Black w/ opacity */
    display: grid;
    place-items: center;
}

.modal-image {
    max-width: 90vw;
    max-height: 90vh;
    object-fit: contain;
}

.image-modal-content {
    margin: auto;
    display: block;
    max-width: 800px;
    max-height: 80vh; /* Limit height to viewport height */
    object-fit: contain;
    transform: scale(1); /* Initial zoom level */
    transition: transform 0.3s ease-out; /* Smooth zoom transition */
}

.image-modal-content.zoom-in {
    cursor: zoom-out;
}

.image-modal-content.zoom-out {
    cursor: zoom-in;
}

.close-button {
    position: absolute;
    top: 20px;
    right: 35px;
    color: #f1f1f1;
    font-size: 40px;
    font-weight: bold;
    transition: 0.3s;
    cursor: pointer;
}

.close-button:hover,
.close-button:focus {
    color: #bbb;
    text-decoration: none;
    cursor: pointer;
}

.zoom-controls {
    position: absolute;
    bottom: 20px;
    display: flex;
    gap: 15px;
    background-color: rgba(0,0,0,0.5);
    padding: 10px 20px;
    border-radius: 5px;
}

.zoom-button {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    transition: transform 0.2s;
}

.zoom-button:hover {
    transform: scale(1.1);
}

/* Responsive adjustments for modal */
@media (max-width: 768px) {
    .image-modal-content {
        width: 90%;
        max-width: 90%;
        max-height: 70vh;
    }

    .close-button {
        top: 10px;
        right: 20px;
        font-size: 30px;
    }

    .zoom-controls {
        bottom: 10px;
        padding: 8px 15px;
        gap: 10px;
    }

    .zoom-button {
        font-size: 20px;
    }
}
