:root {
    --primary-color: #4154a1;
    --secondary-color: #2d2d79;
    --accent-color: #2d2d79;
    --text-color: #333;
    --background-color: #f5f5f5;
    --card-background: #ffffff;
    --cart-background: #f1f1f1;
    --shadow-color: rgba(0, 0, 0, 0.1);
    --modal-background: transparent; /* Changed to transparent for non-dimming */
    --modal-content-background: var(--accent-color);
    --close-button-color: #aaa;
    --close-button-hover-color: #000;
    --toast-duration: 3s; /* Duration before toast disappears */
}

body {
    font-family: 'Roboto', Arial, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--background-color);
    margin: 0;
    padding: 0;
}

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

header {
    background-color: var(--card-background);
    box-shadow: 0 2px 4px var(--shadow-color);
    padding: 10px 0;
    position: relative;
}

header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo-container {
    max-width: 100%;
}

.logo {
    width: 100%;
    height: auto;
}

nav ul {
    list-style-type: none;
    padding: 0;
    display: flex;
}

nav ul li {
    margin-left: 20px;
}

nav ul li a {
    text-decoration: none;
    color: var(--primary-color);
    font-weight: 500;
    transition: color 0.3s ease;
}

nav ul li a:hover {
    color: var(--secondary-color);
}

#hero {
    background-color: var(--primary-color);
    color: white;
    text-align: center;
    padding: 60px 0;
    margin-bottom: 40px;
}

#hero h1 {
    font-size: 2.5em;
    margin-bottom: 20px;
}

#hero p {
    font-size: 1.2em;
    max-width: 600px;
    margin: 0 auto;
}

main {
    padding: 40px 0;
}

h2 {
    color: var(--primary-color);
    text-align: center;
    margin-bottom: 30px;
}

#product-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
}

.product {
    background-color: var(--card-background);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 6px var(--shadow-color);
    transition: transform 0.3s ease;
}

.product:hover {
    transform: translateY(-5px);
}

/* Carousel Styles */
.carousel-container {
    position: relative;
    width: 100%;
    height: 300px;
    overflow: hidden;
    border-radius: 8px 8px 0 0;
}

.carousel-slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 0.5s ease-in-out;
    display: flex;
    align-items: center;
    justify-content: center;
}

.carousel-slide.active {
    opacity: 1;
}

.carousel-slide img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 8px 8px 0 0;
}

.carousel-slide model-viewer {
    width: 100%;
    height: 100%;
    border-radius: 8px 8px 0 0;
    background-color: #f0f0f0;
    /* Ensure model viewer maintains its interactive capabilities */
    pointer-events: auto;
}

/* Carousel Navigation */
.carousel-nav {
    position: absolute;
    bottom: 15px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
    z-index: 10;
    pointer-events: auto;
}

.carousel-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(255,255,255,0.6);
    cursor: pointer;
    transition: background-color 0.3s ease;
    pointer-events: auto;
}

.carousel-dot.active {
    background: white;
}

.carousel-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0,0,0,0.4);
    color: white;
    border: none;
    width: 35px;
    height: 35px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.3s ease;
    z-index: 10;
    pointer-events: auto;
}

.carousel-btn:hover {
    background: rgba(0,0,0,0.6);
}

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

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

/* Ensure model viewer controls work properly */
.carousel-slide[data-type="model"] {
    pointer-events: auto;
}

.carousel-slide[data-type="model"] model-viewer {
    pointer-events: auto;
}

/* Only show navigation when hovering over carousel (optional enhancement) */
.carousel-container:hover .carousel-btn,
.carousel-container:hover .carousel-nav {
    opacity: 1;
}

.carousel-btn,
.carousel-nav {
    opacity: 0.8;
    transition: opacity 0.3s ease;
}

.product-info {
    padding: 20px;
}

.product-info h3 {
    margin: 0 0 10px;
    color: var(--secondary-color);
}

.product-info p {
    margin: 0 0 15px;
}

.price {
    font-weight: bold;
    color: var(--primary-color);
    font-size: 1.2em;
    margin-bottom: 15px;
}

.product-info button {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 10px 25px;
    border-radius: 5px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.product-info button:hover {
    background: var(--secondary-color);
}

footer {
    background-color: var(--primary-color);
    color: white;
    text-align: center;
    padding: 20px 0;
    margin-top: 40px;
}

/* Cart Icon in Upper Right Corner */
.cart-icon {
    position: absolute;
    top: 25px;
    right: 20px;
    display: flex;
    align-items: center;
    cursor: pointer;
    color: var(--primary-color);
    font-size: 1.5em;
}

.cart-icon img {
    width: 30px;
    height: auto;
    margin-right: 5px;
    transition: transform 0.3s ease;
}

.cart-icon:hover img {
    transform: scale(1.1);
}

/* Notification Bubble Styles */
.cart-notification {
    position: absolute;
    top: -8px;
    right: -8px;
    background: var(--accent-color);
    color: white;
    border-radius: 50%;
    padding: 2px 6px;
    font-size: 12px;
    display: none; /* Hidden by default */
    min-width: 20px;
    text-align: center;
}

/* Cart Dropdown */
#cart-content {
    display: none;
    position: absolute;
    top: 60px;
    right: 20px;
    width: 350px;
    border-radius: 8px;
    background-color: var(--cart-background);
    padding: 20px;
    box-shadow: 0 8px 16px var(--shadow-color);
    z-index: 1000;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

#cart-content.show {
    display: block;
    opacity: 1;
    transform: translateY(0);
}

#cart-content.hide {
    opacity: 0;
    transform: translateY(-10px);
}

#cart-items {
    max-height: 250px;
    overflow-y: auto;
    margin-bottom: 10px;
}

#cart-items p {
    margin: 5px 0;
    border-bottom: 1px solid var(--primary-color);
    padding-bottom: 5px;
}

#cart-total {
    font-weight: bold;
    margin-top: 10px;
    text-align: right;
}

#paypal-button-container {
    margin-top: 20px;
}

/* Add Scrollbar Styling */
#cart-items::-webkit-scrollbar {
    width: 8px;
}

#cart-items::-webkit-scrollbar-thumb {
    background-color: var(--primary-color);
    border-radius: 10px;
}

/* Toast Notification Styles */
.modal {
    display: none; /* Hidden by default */
    position: fixed; /* Stay in place */
    z-index: 1001; /* Sit above other elements */
    top: 20px; /* Position from top */
    left: 20px; /* Position from left */
    background-color: var(--accent-color); /* Background color */
    color: white; /* Text color */
    padding: 15px 20px;
    border-radius: 4px;
    box-shadow: 0 2px 8px var(--shadow-color);
    opacity: 0;
    transform: translateX(-100%);
    transition: opacity 0.5s ease, transform 0.5s ease;
    pointer-events: none; /* Allow clicks to pass through */
}

.modal.show {
    opacity: 1;
    transform: translateX(0);
    pointer-events: auto; /* Enable interactions if needed */
}

.modal-content {
    display: flex;
    align-items: center;
}

#modal-message {
    margin: 0;
    font-size: 1em;
}

/* Close Button for Modal (Optional) */
/* If you decide to keep a close button in the toast */
.modal .close-button {
    background: none;
    border: none;
    color: white;
    font-size: 16px;
    margin-left: 15px;
    cursor: pointer;
    transition: color 0.3s ease;
}

.modal .close-button:hover,
.modal .close-button:focus {
    color: #ddd;
}

/* Messenger Button */
.messenger-button {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    transition: transform 0.3s ease;
}

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

.messenger-button img {
    width: 30px;
    height: 30px;
}

/* Responsive Styles */
@media (max-width: 768px) {
    header .container {
        flex-direction: column;
    }

    nav ul {
        margin-top: 20px;
    }

    nav ul li {
        margin: 0 10px;
    }

    #product-list {
        grid-template-columns: 1fr;
    }
    
    .carousel-container {
        height: 250px;
    }
    
    .carousel-btn {
        width: 30px;
        height: 30px;
        font-size: 14px;
    }
}

@media (max-width: 600px) {
    .cart-notification {
        font-size: 10px;
        padding: 1px 4px;
    }

    #hero h1 {
        font-size: 2em;
    }

    #hero p {
        font-size: 1em;
    }

    .product {
        width: 100%;
    }

    #cart-content {
        width: 90%;
        right: 5%;
    }
    
    .carousel-container {
        height: 200px;
    }
    
    .carousel-nav {
        bottom: 10px;
    }
    
    .carousel-dot {
        width: 8px;
        height: 8px;
    }

    /* Adjust Toast Positioning on Smaller Screens */
    .modal {
        top: 10px;
        left: 10px;
        padding: 10px 15px;
    }

    .modal .close-button {
        font-size: 14px;
        margin-left: 10px;
    }
}
