:root {
    --primary-color: #111;
    --secondary-color: #f4f4f4;
    --text-color: #333;
}

* {
    font-family: 'Montserrat', sans-serif;
}

body {
    margin: 0;
    padding: 20px;
    color: #333;
    background: #fff;
}

/* Navigation & Header */
.nav-header {
    max-width: 1200px;
    margin: 20px auto 40px auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-back {
    text-decoration: none;
    color: #666;
    font-size: 0.9rem;
    transition: color 0.2s;
}

.nav-back:hover {
    color: #111;
}

.title {
    font-size: 2.2rem;
    font-weight: 400;
    text-transform: capitalize;
    margin: 0;
}

.cart-btn {
    background: none;
    border: none;
    font-size: 16px;
    cursor: pointer;
    font-weight: 600;
    font-family: 'Montserrat', sans-serif;
    flex-shrink: 0;
}

/* Product & Category Grid Architecture */
.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    max-width: 1200px;
    margin: 40px auto;
    gap: 40px;
}

.product-card {
    display: flex;
    flex-direction: column;
}

/* Category Card Specific Layout Animation */
.category-link-card {
    text-decoration: none;
    color: inherit;
}

.category-wrapper {
    display: flex;
    flex-direction: column;
    cursor: pointer;
}

.category-img-container {
    width: 100%;
    height: 400px;
    overflow: hidden;
    border-radius: 4px;
    background: #f4f4f4;
}

.category-img-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.category-link-card:hover .category-img-container img {
    transform: scale(1.03);
}

.category-meta {
    padding: 15px 0;
    font-size: 1.2rem;
    font-weight: 500;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Image Carousel Viewport and Tracks */
.carousel-container {
    position: relative;
    width: 100%;
    height: 400px;
    overflow: hidden;
    border-radius: 4px;
    background: #f4f4f4;
}

.carousel-viewport {
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.carousel-track {
    display: flex;
    width: 100%;
    height: 100%;
    transition: transform 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.carousel-track img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    flex-shrink: 0;
}

/* Full-screen Dark Overlay background */
.lightbox-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.85);
    z-index: 99999;
    /* Sits completely on top of headers and carousels */
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease-in-out;
}

/* Activated state trigger */
.lightbox-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

/* Lightbox Image Viewport sizing constraint rules */
.lightbox-overlay img {
    max-width: 90%;
    max-height: 85%;
    object-fit: contain;
    border-radius: 4px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    transform: scale(0.95);
    transition: transform 0.25s ease-in-out;
}

.lightbox-overlay.active img {
    transform: scale(1);
}

/* Close Window UI Button */
.lightbox-close {
    position: absolute;
    top: 20px;
    right: 30px;
    color: #ffffff;
    font-size: 40px;
    font-weight: 300;
    cursor: pointer;
    user-select: none;
    transition: color 0.2s;
}

.lightbox-close:hover {
    color: #dddddd;
}

/* Carousel Controls */
.carousel-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.85);
    font-size: 1.4rem;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
    border: 1px solid rgba(0, 0, 0, 0.05);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.carousel-btn:hover {
    background: #fff;
}

.carousel-btn.prev {
    left: 10px;
}

.carousel-btn.next {
    right: 10px;
}

/* Carousel Navigation Dots */
.carousel-dots {
    position: absolute;
    bottom: 12px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 6px;
    z-index: 2;
}

.carousel-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.4);
    transition: background 0.2s;
}

.carousel-dot.active {
    background: #fff;
    width: 16px;
    border-radius: 4px;
}

/* Hide controls if the product layout contains only 1 image */
.carousel-container.single-image .carousel-btn,
.carousel-container.single-image .carousel-dots {
    display: none;
}

.product-details {
    padding: 15px 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.product-title {
    font-size: 1.1rem;
    font-weight: 500;
}

.product-description {
    font-size: 0.88rem;
    color: #666;
    line-height: 1.4;
    margin: 4px 0 8px 0;
    height: 50px;
}

.product-price {
    color: #666;
    font-size: 0.95rem;
    margin-top: 4px;
}

.product-options {
    display: flex;
    gap: 10px;
    margin-top: 5px;
}

select,
input[type="number"] {
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #fff;
    font-size: 0.9rem;
}

input[type="number"] {
    width: 60px;
}

.add-to-cart {
    background-color: var(--primary-color);
    color: #fff;
    border: none;
    padding: 10px 20px;
    cursor: pointer;
    width: 100%;
    transition: background 0.3s;
    font-family: 'Montserrat', sans-serif;
}

.add-to-cart:hover {
    background-color: #333;
}

.cart-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    z-index: 1000;
}

.cart-modal {
    position: fixed;
    top: 0;
    right: -1000px;
    width: 400px;
    max-width: 100%;
    height: 100%;
    background: #fff;
    padding: 20px;
    box-shadow: -2px 0 5px rgba(0, 0, 0, 0.1);
    transition: right 0.3s ease;
    display: flex;
    flex-direction: column;
    z-index: 1001;
}

.cart-modal.active {
    right: 0;
}

.close-cart {
    align-self: flex-end;
    font-size: 24px;
    cursor: pointer;
    border: none;
    background: none;
}

.cart-items {
    overflow-y: auto;
    margin: 20px 0;
}

.cart-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 15px;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
}

.cart-total {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 20px;
    text-align: right;
}

.checkout-btn {
    background-color: var(--primary-color);
    color: #fff;
    border: none;
    padding: 15px;
    cursor: pointer;
    width: 100%;
    font-size: 1rem;
}

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

.modal-content {
    background-color: #fff;
    padding: 30px;
    border-radius: 8px;
    max-width: 600px;
    width: 90%;
    max-height: 85vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

/* Close Button */
.close-modal-btn {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 1.5rem;
    background: none;
    border: none;
    cursor: pointer;
    color: #666;
}

.close-modal-btn:hover {
    color: #000;
}

/* Toast Notifications Window */
#toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
}

.toast {
    background: #333;
    color: #fff;
    padding: 12px 24px;
    border-radius: 4px;
    font-size: 0.9rem;
    margin-top: 10px;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s ease;
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

@media (max-width: 767px) {
    .back-text {
        display: none;
    }

    #nav-back-link {
        padding: 3px;
        flex-shrink: 0;
    }
}