/* --- Global Styles & Variables (Original Red Theme) --- */
html {
  box-sizing: border-box;
}
*, *:before, *:after {
  box-sizing: inherit;
}

:root {
    --font-primary: 'Poppins', sans-serif;
    --font-serif: 'Lora', serif;
    --color-primary: #8C2D2D; /* Deep Red */
    --color-secondary: #F5F5DC; /* Beige/Cream */
    --color-dark: #333333;
    --color-light: #FFFFFF;
    --color-border: #EAEAEA;
    --box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
}

body {
    font-family: var(--font-primary);
    color: var(--color-dark);
    background-color: var(--color-light);
    margin: 0;
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

a {
    color: var(--color-primary);
    text-decoration: none;
    transition: color 0.3s ease;
}

a:hover {
    color: #6b2222; /* Darker red for hover */
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* --- Header --- */
.main-header {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--color-border);
    position: sticky;
    top: 0;
    z-index: 1000;
    padding: 1rem 0;
}

.header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
}

.logo a {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--color-dark);
    text-decoration: none;
    font-family: var(--font-serif);
}

.main-nav .nav-links {
    margin: 0;
    padding: 0;
    list-style: none;
    display: flex;
    gap: 2rem;
}

.main-nav a {
    text-decoration: none;
    color: var(--color-dark);
    font-weight: 500;
    transition: color 0.3s ease;
}

.main-nav a:hover {
    color: var(--color-primary);
}

.header-icons .cart-icon {
    color: var(--color-dark);
    font-size: 1.2rem;
    text-decoration: none;
    position: relative;
    display: inline-block;
}

.cart-count {
    background: var(--color-primary);
    color: var(--color-light);
    font-size: 0.7rem;
    font-weight: bold;
    padding: 2px 6px;
    border-radius: 50%;
    position: absolute;
    top: -10px;
    right: -10px;
}

/* --- HERO SLIDER STYLES (Integrated) --- */
.hero-slider-container {
    position: relative;
    height: 60vh;
    min-height: 400px;
    width: 100%;
    overflow: hidden;
    margin-bottom: 2rem;
    background-color: #000;
}

.hero-slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    opacity: 0;
    transition: opacity 1s ease-in-out;
    z-index: 1;
}

.hero-slide.active {
    opacity: 1;
    z-index: 2;
}

.hero-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1;
}

.hero-content {
    position: relative;
    z-index: 3;
    padding: 0 1rem;
    color: var(--color-light);
}

.hero-content h1 {
    font-size: 3rem;
    margin-bottom: 1rem;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.7);
    font-family: var(--font-serif);
}

.hero-content p {
    font-size: 1.2rem;
    margin-bottom: 1.5rem;
    text-shadow: 1px 1px 3px rgba(0,0,0,0.7);
}

/* Slider Controls */
.slider-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.5);
    color: white;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    z-index: 10;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

.slider-btn:hover {
    background: var(--color-primary);
    border-color: var(--color-primary);
}

.slider-btn.prev { left: 20px; }
.slider-btn.next { right: 20px; }

.slider-dots {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 10px;
    z-index: 10;
}

.dot {
    width: 12px;
    height: 12px;
    background-color: rgba(255, 255, 255, 0.5);
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s;
}

.dot.active {
    background-color: var(--color-primary);
    transform: scale(1.2);
}


/* --- Buttons & Sections --- */
.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    border-radius: 5px;
    font-weight: bold;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
    text-align: center;
}
.btn-primary {
    background-color: var(--color-primary);
    color: var(--color-light);
}
.btn-primary:hover {
    background-color: #6b2222;
    transform: translateY(-2px);
    color: var(--color-light);
}
.section {
    padding: 2rem 0;
}
.section-title {
    font-size: 2.2rem;
    text-align: center;
    margin-bottom: 3rem;
    font-weight: 700;
    font-family: var(--font-serif);
}

/* --- Products Page Layout --- */
.products-page-container {
    display: flex;
    flex-direction: column; /* Mobile first */
    gap: 2rem;
}

.sidebar {
    flex-shrink: 0;
    background: #f9f9f9;
    padding: 1.5rem;
    border-radius: 8px;
}

.sidebar h3 {
    margin-top: 0;
    border-bottom: 2px solid var(--color-border);
    padding-bottom: 0.5rem;
}

.sidebar ul {
    list-style: none;
    padding: 0;
}

.sidebar li a {
    display: block;
    padding: 0.5rem 0;
    color: var(--color-dark);
}

.sidebar li.active a {
    color: var(--color-primary);
    font-weight: bold;
}

.products-main {
    flex-grow: 1;
}


/* --- Products Grid --- */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
}
.product-card {
    background: var(--color-light);
    border-radius: 8px;
    box-shadow: var(--box-shadow);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}
.product-image {
    height: 300px; /* This controls the 4:3 aspect ratio */
    overflow: hidden;
    background-color: #f0f0f0;
}
.product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}
.product-card:hover .product-image img {
    transform: scale(1.05);
}
.product-info {
    padding: 1.5rem;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}
.product-info h3 {
    font-size: 1.2rem;
    margin-top: 0;
    margin-bottom: 0.5rem;
}
.product-description {
    font-size: 0.9rem;
    color: #6c757d;
    flex-grow: 1;
}
.product-info .actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1rem;
}
.product-info .product-price {
    font-size: 1.4rem;
    font-weight: bold;
    color: var(--color-dark);
}


/* --- Cart & Checkout & Forms --- */
.cart-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 2rem;
}
.cart-table thead {
    border-bottom: 2px solid var(--color-dark);
}
.cart-table th, .cart-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--color-border);
    vertical-align: middle;
}
.cart-summary {
    margin-top: 2rem;
    width: 100%;
    max-width: 400px; /* Limit width on desktop */
    background: #f9f9f9;
    padding: 1.5rem;
    border-radius: 8px;
    margin-left: auto; /* Push to the right */
}
.form-group {
    margin-bottom: 1.5rem;
}
.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}
.form-group input, .form-group textarea {
    width: 100%;
    padding: 0.8rem;
    border: 1px solid var(--color-border);
    border-radius: 5px;
}

/* --- Footer --- */
.main-footer {
    background: var(--color-dark);
    color: var(--color-light);
    padding: 3rem 0;
    margin-top: 4rem;
}
.main-footer a {
    color: var(--color-light);
}
.main-footer .container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
    text-align: center;
}
.footer-bottom {
    text-align: center;
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid #4a4a4a;
    font-size: 0.9rem;
    color: #aaa;
}

/* --- Product Details Page --- */
.product-details-container {
    display: grid;
    grid-template-columns: 1fr; /* Single column for mobile */
    gap: 2rem;
    align-items: flex-start;
}

/* This is now the default state for mobile */
.product-gallery {
    position: static; /* The fix: No sticky positioning on mobile */
}

.product-gallery .main-image {
    border-radius: 8px;
    overflow: hidden;
    box-shadow: var(--box-shadow);
    margin-bottom: 1rem;
}

.product-gallery .main-image img {
    width: 100%;
    height: auto;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    transition: transform 0.4s ease, opacity 0.3s ease; /* Smooth transition */
}

.product-gallery .main-image:hover img {
    transform: scale(1.05); /* Gentle zoom on hover */
}

.thumbnail-images {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
    gap: 1rem;
}

.thumbnail {
    border-radius: 5px;
    cursor: pointer;
    border: 2px solid transparent;
    transition: border-color 0.3s ease, transform 0.3s ease;
    aspect-ratio: 1 / 1;
    object-fit: cover;
}

.thumbnail:hover {
    transform: translateY(-3px);
}

.thumbnail.active {
    border-color: var(--color-primary);
    box-shadow: 0 0 8px rgba(140, 45, 45, 0.5);
}

.product-title {
    font-size: 2.5rem;
    font-family: var(--font-serif);
    margin-bottom: 0.5rem;
    line-height: 1.2;
}

.product-category a {
    color: #6c757d;
    text-decoration: none;
}

.product-price-details {
    font-size: 2rem;
    font-weight: bold;
    color: var(--color-primary);
    margin: 1rem 0;
}

.product-description-full {
    line-height: 1.7;
    margin-bottom: 2rem;
    color: #555;
}

.add-to-cart-action .btn-lg {
    padding: 1rem 2.5rem;
    font-size: 1.1rem;
}

/* --- Category Grid Styles --- */
.category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
}

.category-card {
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 3rem 1.5rem;
    background-color: #f9f9f9;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    text-decoration: none;
    transition: all 0.3s ease;
    min-height: 200px;
}

.category-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--box-shadow);
    background-color: var(--color-light);
    border-color: var(--color-primary);
}

.category-info h3 {
    font-family: var(--font-serif);
    font-size: 1.8rem;
    color: var(--color-dark);
    margin: 0 0 1rem 0;
}

.category-info .btn-link {
    font-weight: bold;
    color: var(--color-primary);
    text-decoration: none;
}


/* ===========================
   TABLET & DESKTOP STYLES
   =========================== */
@media (min-width: 768px) {
    .header-container {
        flex-wrap: nowrap;
    }
    .products-page-container {
        flex-direction: row;
    }
    .sidebar {
        width: 250px;
    }
    .main-footer .container {
        grid-template-columns: repeat(3, 1fr);
        text-align: left;
    }
    .hero h1 {
        font-size: 3.5rem;
    }
    .product-details-container {
        /* Adjusted grid for a better image-to-text ratio */
        grid-template-columns: 4fr 5fr; 
        gap: 3.5rem; /* Increased gap for more breathing room */
    }

    /* The fix: Apply sticky positioning ONLY on desktop */
    .product-gallery {
        position: sticky;
        top: 100px;
    }
}


/* ===========================
   MOBILE-SPECIFIC STYLES
   =========================== */
@media (max-width: 767px) {
    .header-container {
        flex-direction: column;
        gap: 1rem;
    }
    .main-nav .nav-links {
        justify-content: center;
        flex-wrap: wrap;
        gap: 1rem 1.5rem;
    }
    .hero-content h1 {
        font-size: 2.2rem;
    }
    .section-title {
        font-size: 1.8rem;
    }
    .cart-summary {
        margin-left: 0; /* Center on mobile */
    }
    
    /* Responsive category filter pills */
    .sidebar {
        background: none;
        border: none;
        padding: 0;
        border-radius: 0;
    }
    .sidebar h3 {
        display: none; /* Hide "Categories" title */
    }
    .sidebar ul {
        display: flex;
        overflow-x: auto; /* Makes THIS ELEMENT scrollable */
        -webkit-overflow-scrolling: touch; /* Smooth scrolling for iOS */
        padding-bottom: 10px;
        margin: 0;
        -ms-overflow-style: none;  /* Hide scrollbar for IE and Edge */
        scrollbar-width: none;  /* Hide scrollbar for Firefox */
    }
    .sidebar ul::-webkit-scrollbar {
        display: none; /* Hide scrollbar for Chrome, Safari */
    }
    .sidebar li {
        flex-shrink: 0; /* Prevents items from squishing */
        margin-right: 0.75rem;
    }
    .sidebar li a {
        padding: 0.6rem 1.2rem;
        border: 1px solid var(--color-border);
        border-radius: 50px; /* This creates the pill shape */
        white-space: nowrap; /* Prevents text from wrapping */
        background: var(--color-light);
        font-weight: 500;
        transition: all 0.2s ease-in-out;
        color: var(--color-dark); 
    }
    .sidebar li.active a {
        background-color: var(--color-primary);
        color: var(--color-light) !important;
        border-color: var(--color-primary);
        font-weight: bold;
    }

    /* Responsive cart table */
    .cart-table thead {
        display: none; /* Hide headers on mobile */
    }
    .cart-table tr {
        display: block;
        margin-bottom: 1.5rem;
        border: 1px solid var(--color-border);
        border-radius: 8px;
        padding: 1rem;
    }
    .cart-table td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 0.5rem 0;
        border: none;
        text-align: right;
    }
    .cart-table td::before {
        content: attr(data-label); /* Add labels for data */
        font-weight: bold;
        text-align: left;
        margin-right: 1rem;
    }
    /* Hide image label */
    .cart-table td[data-label="Product Image"]::before {
        display: none;
    }
    .cart-table td[data-label="Product Image"] {
        justify-content: center;
        padding-bottom: 1rem;
    }
}

/* --- About Us Page --- */
.about-hero {
    height: 50vh;
    min-height: 350px;
}

.about-section {
    background-color: #fdfdfd;
}

.about-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 3rem;
    align-items: center;
}

.about-image img {
    border-radius: 8px;
    box-shadow: var(--box-shadow);
}

.about-text h2 {
    font-family: var(--font-serif);
    font-size: 2.5rem;
    margin-bottom: 1.5rem;
}

.about-text p {
    font-size: 1.1rem;
    line-height: 1.8;
    color: #555;
}

.values-section {
    background-color: #f9f9f9;
}

.values-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
    text-align: center;
}

.value-icon {
    font-size: 2.5rem;
    color: var(--color-primary);
    margin-bottom: 1.5rem;
}

.value-item h3 {
    font-family: var(--font-serif);
    font-size: 1.5rem;
    margin-bottom: 1rem;
}