/* Basic Reset & Body Styles */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* CSS Custom Properties (Variables) */
:root {
    --primary-color: #007bff;
    --primary-color-dark: #0056b3;
    --primary-color-rgb: 0, 123, 255;
    --accent-color: #fff;
    --text-color-dark: #333;
    --text-color-medium: #555;
    --text-color-light: #666;
    --background-light: #f4f4f4;
    --background-white: #fff;
    --border-light: #ddd;
    --shadow-light: rgba(0,0,0,0.1);
    --shadow-medium: rgba(0,0,0,0.15);
    --error-color: #dc3545;
    --success-color: #28a745;
    --success-color-dark: #218838;
    --font-family-primary: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    font-family: var(--font-family-primary);
    line-height: 1.6;
    color: var(--text-color-dark);
    background-color: var(--background-light);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.container {
    width: 90%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px 0;
}

/* Header Styles */
.main-header {
    background-color: var(--background-white);
    padding: 15px 0;
    box-shadow: 0 2px 5px var(--shadow-light);
    position: sticky;
    top: 0;
    z-index: 1000;
    transition: box-shadow 0.3s ease;
}

.main-header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 90%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0;
}

.logo {
    text-decoration: none;
    display: flex;
    align-items: center;
}

.logo img {
    max-height: 50px;
    width: auto;
    display: block;
}

.main-nav {
    display: flex;
    align-items: center;
}

.main-nav ul {
    list-style: none;
    display: flex;
}

.main-nav ul li {
    margin-left: 25px;
}

.main-nav ul li a {
    text-decoration: none;
    color: var(--text-color-medium);
    font-weight: bold;
    transition: color 0.3s ease;
    padding-bottom: 3px;
    display: inline-block;
    background-color: transparent;
    border-bottom: none;
}

.main-nav ul li a.active {
    color: var(--primary-color);
    border-bottom: 2px solid var(--primary-color);
}

.main-nav ul li a:hover:not(.active) {
    color: var(--primary-color-dark);
}

/* Header Icons Styling (Search and Cart) */
.header-icons {
    display: flex;
    align-items: center;
}

.header-icons a {
    color: var(--text-color-medium);
    font-size: 1.2em;
    margin-left: 15px;
    position: relative;
    transition: color 0.3s ease;
}
.header-icons a:first-child {
    margin-left: 0;
}

.header-icons .cart-count {
    background-color: var(--error-color);
    color: var(--accent-color);
    font-size: 0.7em;
    font-weight: bold;
    border-radius: 50%;
    padding: 2px 6px;
    position: absolute;
    top: -8px;
    right: -8px;
    min-width: 18px;
    text-align: center;
    line-height: 1.2;
}
/* Notification Styles */
#notification-container {
    position: fixed;
    top: 70px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1050;
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 90%;
    max-width: 400px;
    pointer-events: none;
}
.notification {
    background-color: var(--background-white);
    color: var(--text-color-dark);
    padding: 15px 20px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    display: flex;
    align-items: center;
    gap: 15px;
    font-size: 1em;
    font-weight: 500;
    opacity: 0;
    transform: translateY(-20px);
    animation: fadeInSlideDown 0.4s ease-out forwards;
    pointer-events: all;
    position: relative;
}
.notification .icon {
    font-size: 1.5em;
    line-height: 1;
}
.notification.success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}
.notification.success .icon {
    color: var(--success-color);
}
.notification.error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}
.notification.error .icon {
    color: var(--error-color);
}
.notification .close-btn {
    background: none;
    border: none;
    font-size: 1.2em;
    color: var(--text-color-medium);
    cursor: pointer;
    position: absolute;
    top: 8px;
    right: 10px;
    transition: color 0.2s ease;
}
.notification .close-btn:hover {
    color: var(--text-color-dark);
}
@keyframes fadeInSlideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
@keyframes fadeOutSlideUp {
    from {
        opacity: 1;
        transform: translateY(0);
    }
    to {
        opacity: 0;
        transform: translateY(-20px);
    }
}

/* Custom Confirmation Modal Styles */
.modal-overlay {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.6);
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}

.modal-overlay.active {
    display: flex;
}

.modal-content {
    background-color: var(--background-white);
    margin: auto;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    width: 90%;
    max-width: 400px;
    text-align: center;
    transform: translateY(-50px);
    opacity: 0;
    animation: fadeInModal 0.3s ease-out forwards;
}

.modal-content p {
    font-size: 1.1em;
    margin-bottom: 25px;
    color: var(--text-color-dark);
    line-height: 1.5;
}

.modal-buttons {
    display: flex;
    justify-content: space-around;
    gap: 15px;
}

.modal-buttons .button {
    padding: 12px 25px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1em;
    transition: background-color 0.2s ease, transform 0.1s ease;
    flex-grow: 1;
}

.modal-buttons .button-danger {
    background-color: var(--error-color);
    color: var(--accent-color);
}

.modal-buttons .button-danger:hover {
    background-color: #c82333;
    transform: translateY(-1px);
}

.modal-buttons .button-secondary {
    background-color: var(--text-color-medium);
    color: var(--accent-color);
}

.modal-buttons .button-secondary:hover {
    background-color: #5a6268;
    transform: translateY(-1px);
}

@keyframes fadeInModal {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Main Content Sections */
main {
    flex: 1;
}

.hero-section {
    background-color: var(--primary-color);
    color: var(--accent-color);
    text-align: center;
    padding: 80px 20px;
    margin-bottom: 30px;
}

.hero-section h1 {
    font-size: 2.8em;
    margin-bottom: 15px;
}

.hero-section p {
    font-size: 1.2em;
    margin-bottom: 30px;
}

/* Buttons */
.button {
    display: inline-block;
    padding: 12px 25px;
    border-radius: 5px;
    text-decoration: none;
    font-weight: bold;
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

.primary-button {
    background-color: var(--accent-color);
    color: var(--primary-color);
    border: 2px solid var(--accent-color);
}

.primary-button:hover {
    background-color: #e6e6e6;
}

.secondary-button {
    background-color: var(--primary-color);
    color: var(--accent-color);
    border: 1px solid var(--primary-color);
}
.secondary-button:hover {
    background-color: var(--primary-color-dark);
    border-color: var(--primary-color-dark);
}

/* Featured Products Section */
.featured-products {
    margin-bottom: 30px;
    padding: 20px 0;
    text-align: center;
}

.featured-products h2 {
    font-size: 2em;
    margin-bottom: 30px;
    color: var(--primary-color);
}

/* Product Grid and Card Styles for Dynamic Display */
.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    padding: 20px 0;
    justify-content: center;
    align-items: stretch;
    text-align: left;
}

.product-card {
    background-color: var(--background-white);
    border: 1px solid var(--border-light);
    border-radius: 8px;
    box-shadow: 0 2px 5px var(--shadow-light);
    padding: 15px;
    text-align: center;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 100%;
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 4px 10px var(--shadow-medium);
}

.product-card .product-link {
    text-decoration: none;
    color: inherit;
    display: block;
    flex-grow: 1;
}

.product-card .product-image {
    max-width: 100%;
    height: 200px;
    object-fit: cover;
    border-radius: 5px;
    margin-bottom: 15px;
    display: block;
    margin-left: auto;
    margin-right: auto;
}

.product-card .product-name {
    font-size: 1.3em;
    margin-bottom: 8px;
    color: var(--text-color-dark);
}

.product-card .product-price {
    font-size: 1.15em;
    font-weight: bold;
    color: var(--primary-color);
    margin-bottom: 10px;
}

.product-card .product-category {
    font-size: 0.9em;
    color: var(--text-color-medium);
    margin-bottom: 15px;
    text-transform: capitalize;
}

.product-card .add-to-cart-btn {
    background-color: var(--primary-color);
    color: var(--accent-color);
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s ease;
    font-weight: bold;
}

.product-card .add-to-cart-btn:hover {
    background-color: var(--primary-color-dark);
}

.text-center {
    text-align: center;
    margin-top: 40px;
    margin-bottom: 40px;
}

/* Footer Styles */
.main-footer {
    background-color: var(--text-color-dark);
    color: var(--accent-color);
    padding: 20px 0;
    text-align: center;
    margin-top: auto;
}

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

.main-footer p {
    margin: 5px 0;
}

.social-links {
    margin: 10px 0;
}

.social-links a {
    margin: 0 10px;
    text-decoration: none;
    color: var(--accent-color);
    font-size: 24px;
    transition: color 0.3s ease;
}

.social-links a:hover {
    color: var(--primary-color);
}

.main-footer .footer-admin-link {
    color: var(--primary-color);
    text-decoration: none;
    font-size: 0.85em;
    margin-top: 10px;
    display: inline-block;
    transition: color 0.3s ease;
}

.main-footer .footer-admin-link:hover {
    color: var(--primary-color-dark);
    text-decoration: underline;
}

/* Hamburger Menu Icon */
.hamburger-menu {
    display: none;
    flex-direction: column;
    justify-content: space-around;
    width: 30px;
    height: 25px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 1001;
}

.hamburger-menu .bar {
    width: 100%;
    height: 3px;
    background-color: var(--primary-color);
    border-radius: 10px;
    transition: all 0.3s ease;
}

/* Mobile Navigation Specifics */
@media (max-width: 768px) {
    /* --- ADDED THIS RULE TO MAKE THE HEADER STICKY ON MOBILE --- */
    .main-header {
        position: sticky;
        top: 0;
        z-index: 1000;
    }

    .main-header .container {
        flex-wrap: nowrap;
        justify-content: space-between;
        padding: 0 5%;
    }

    .logo img {
        max-height: 30px;
    }

    .main-nav {
        display: flex;
        justify-content: flex-end;
        align-items: center;
        position: static; /* Change from relative to static */
        width: auto;
    }

    .main-nav ul {
        display: none;
        flex-direction: column;
        width: 100%;
        text-align: left;
        background-color: var(--background-white);
        position: absolute;
        top: 100%;
        left: 0;
        box-shadow: 0 5px 10px var(--shadow-light);
        padding: 0;
        z-index: 999;
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.5s ease-out;
    }

    .main-nav ul.active {
        display: flex;
        max-height: 400px;
    }

    .main-nav ul li {
        margin: 0;
        width: 100%;
        line-height: 1;
    }

    .main-nav ul li:last-child {
        border-bottom: none;
    }

    .main-nav ul li a {
        padding: 15px 30px;
        display: block;
        line-height: 1.6;
        color: var(--text-color-medium);
        text-decoration: none;
        font-weight: normal;
        transition: background-color 0.3s ease, color 0.3s ease;
        border-bottom: none;
    }

    .main-nav ul li a.active {
        background-color: var(--background-light);
        color: var(--primary-color);
        border-bottom: none;
    }

    .main-nav ul li a:hover:not(.active) {
        background-color: var(--background-light);
        color: var(--primary-color);
        border-bottom: none;
    }

    .header-icons {
        margin-right: 15px;
        order: 1;
    }

    .hamburger-menu {
        display: flex;
        order: 2;
    }

    .hamburger-menu.open .bar:nth-child(1) {
        transform: translateY(11px) rotate(45deg);
    }
    .hamburger-menu.open .bar:nth-child(2) {
        opacity: 0;
    }
    .hamburger-menu.open .bar:nth-child(3) {
        transform: translateY(-11px) rotate(-45deg);
    }
}

/* Ensure desktop styles don't conflict */
@media (min-width: 769px) {
    .main-nav {
        display: flex !important;
        justify-content: flex-start;
        position: static;
        max-height: none;
        overflow: visible;
        box-shadow: none;
        flex-direction: row;
        width: auto;
    }

    .main-nav ul {
        display: flex !important;
        margin-right: auto;
        position: static;
        max-height: none;
        overflow: visible;
        box-shadow: none;
        flex-direction: row;
        width: auto;
    }
    
    .hamburger-menu {
        display: none !important;
        order: unset;
    }

    .header-icons {
        display: flex;
        align-items: center;
        margin-left: 25px;
        margin-right: 0;
        order: unset;
    }

    .header-icons a {
        margin-left: 15px;
    }
    .header-icons a:first-child {
        margin-left: 0;
    }
}
/* Product Detail Page Styles */
.product-detail-section {
    padding: 40px 0;
    background-color: var(--background-white);
    margin-bottom: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 5px var(--shadow-light);
}

.product-detail-grid {
    display: grid;
    grid-template-columns: 1fr 1.5fr;
    gap: 40px;
    align-items: flex-start;
}

.product-image-gallery {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.product-image-gallery .main-image {
    width: 100%;
    max-width: 500px;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 4px 8px var(--shadow-light);
    margin-bottom: 20px;
}

.thumbnail-gallery {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
}

.thumbnail-gallery img {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 5px;
    border: 2px solid transparent;
    cursor: pointer;
    transition: border-color 0.2s ease, transform 0.2s ease;
}

.thumbnail-gallery img:hover,
.thumbnail-gallery img.active {
    border-color: var(--primary-color);
    transform: scale(1.05);
}

.product-info h1 {
    font-size: 2.5em;
    color: var(--text-color-dark);
    margin-bottom: 15px;
}

.product-info .product-price {
    font-size: 1.8em;
    font-weight: bold;
    color: var(--primary-color);
    margin-bottom: 10px;
}

.product-info .product-category {
    font-size: 1em;
    color: var(--text-color-medium);
    margin-bottom: 20px;
    text-transform: capitalize;
}

.product-info .product-description {
    font-size: 1.1em;
    color: var(--text-color-dark);
    line-height: 1.7;
    margin-bottom: 30px;
}

.product-info .button {
    margin-right: 15px;
}

/* Product Actions (Add to Cart, Buy Now) */
.product-card .product-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 15px;
}

.product-card .product-actions .button {
    padding: 8px 10px;
    font-size: 0.9em;
    text-align: center;
    width: 100%;
}

.product-card .buy-now-btn {
    background-color: var(--success-color);
    color: var(--accent-color);
    border: none;
}

.product-card .buy-now-btn:hover {
    background-color: var(--success-color-dark);
}

/* Category Filter Styles */
.category-filters {
    margin: 2rem 0;
    text-align: center;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.8rem;
}

.category-filter-btn {
    background-color: #e0e0e0;
    color: var(--text-color-medium);
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 500;
    transition: all 0.3s ease;
}

.category-filter-btn:hover {
    background-color: #d0d0d0;
    transform: translateY(-2px);
}

.category-filter-btn.active-category-filter {
    background-color: var(--primary-color);
    color: var(--accent-color);
    font-weight: bold;
    box-shadow: 0 4px 8px rgba(var(--primary-color-rgb), 0.2);
}

/* Homepage Category Section Styling */
.category-section {
    padding: 3rem 0;
}

.category-section h2 {
    text-align: center;
    margin-bottom: 2rem;
    font-size: 2.2em;
}

/* Search Overlay Styles */
.search-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 2000;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding-top: 10vh;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.search-overlay.active {
    opacity: 1;
    visibility: visible;
}

.search-overlay-content {
    background-color: var(--background-white);
    padding: 30px;
    border-radius: 10px;
    width: 90%;
    max-width: 800px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    position: relative;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
}

.close-search-btn {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 2.5em;
    color: var(--text-color-medium);
    cursor: pointer;
}

#searchInput {
    width: 100%;
    padding: 15px 20px;
    font-size: 1.2em;
    border: 2px solid var(--border-light);
    border-radius: 25px;
    margin-bottom: 25px;
}

#searchInput:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(var(--primary-color-rgb), 0.2);
}

#searchResultsContainer {
    overflow-y: auto;
    padding-right: 10px;
}

.search-initial-message, .search-message {
    text-align: center;
    font-size: 1.1em;
    color: var(--text-color-medium);
    margin-top: 30px;
}

/* Swiper Carousel Styles */
/* --- NEW --- This rule fixes the carousel overflow issue */
.swiper-container {
    width: 100%;
    overflow: hidden;
}

.featured-products .swiper-pagination {
    position: relative;
    bottom: auto;
    margin-top: 25px;
    margin-bottom: 25px;
}

.swiper-pagination-bullet {
    background-color: #ccc;
    opacity: 1;
}

.swiper-pagination-bullet-active {
    background-color: var(--primary-color);
}

.swiper-button-next, .swiper-button-prev {
    color: var(--primary-color);
}

/* Empty Cart Message Styles */
#emptyCartMessage {
    text-align: center;
    padding: 50px 20px;
    font-size: 1.2em;
    color: var(--text-color-medium);
}

#emptyCartMessage p {
    margin-bottom: 20px;
}

/* NEW STYLES for Related Products Section */
.related-products-section {
    padding: 40px 0 60px 0;
    background-color: #fff;
    border-top: 1px solid var(--border-light);
}

.related-products-section h2 {
    text-align: center;
    font-size: 2.2em;
    margin-bottom: 30px;
    color: var(--text-color-dark);
}