:root {
    --primary-color: #6200ea; /* Deep purple */
    --secondary-color: #00bcd4; /* Cyan */
    --background-color: #f5f5f5; /* Light grey */
    --text-color: #212121; /* Almost black */
    --card-background: #ffffff;
    --card-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --transition: all 0.3s ease;
}

.dark-mode {
    --primary-color: #b388ff; /* Light purple */
    --secondary-color: #80deea; /* Light cyan */
    --background-color: #121212; /* Dark grey */
    --text-color: #e0e0e0; /* Light grey */
    --card-background: #1e1e1e; /* Slightly lighter dark grey */
    --card-shadow: 0 4px 6px rgba(255, 255, 255, 0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    background-color: var(--background-color);
}

body {
    font-family: 'Inter', sans-serif;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    color: var(--text-color);
    position: relative;
    background-color: var(--background-color);
    line-height: 1.6;
    transition: var(--transition);
}

body::after {
    content: '';
    display: block;
    height: 0;
    visibility: hidden;
}

main {
    flex: 1;
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
    background-color: var(--background-color);
    position: relative;
    z-index: 1;
}

footer {
    flex-shrink: 0;
    background-color: var(--primary-color);
    color: var(--card-background);
    text-align: center;
    padding: 1rem;
    width: 100%;
    box-shadow: var(--card-shadow);
    position: relative;
    z-index: 2;
    margin-top: auto;
}

/* Add this new rule */
#avaleht, #tooted, #meist, #kontakt {
    background-color: var(--background-color);
    position: relative;
    z-index: 1;
}

/* Ensure all content is above the pseudo-element */
header, main, footer, .cart-modal {
    position: relative;
    z-index: 1;
}

/* Create a full-height pseudo-element to cover any potential gaps */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--background-color);
    z-index: 0;
}

header {
    background-color: rgba(98, 0, 234, 0.9); /* Semi-transparent primary color */
    padding: 1rem;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
}

nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
}

.logo {
    display: flex;
    align-items: center;
    overflow: hidden;
}

.logo-image {
    max-height: 40px;
    width: auto;
    margin-right: 10px;
    transition: transform 0.3s ease;
}

.logo:hover .logo-image {
    transform: rotate(360deg);
}

.logo-text {
    font-size: 1.8rem;
    font-weight: bold;
    color: #ffffff;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
    opacity: 0;
    transform: translateX(-20px);
    animation: slideInFade 0.5s ease-out 0.2s forwards;
}

@keyframes slideInFade {
    0% {
        opacity: 0;
        transform: translateX(-20px);
    }
    100% {
        opacity: 1;
        transform: translateX(0);
    }
}

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

.nav-links li {
    margin-left: 1.5rem;
}

.nav-links a {
    text-decoration: none;
    color: var(--card-background);
    font-weight: 600;
    transition: all 0.3s ease;
    position: relative;
}

.nav-links a::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: -5px;
    left: 0;
    background-color: var(--secondary-color);
    transition: width 0.3s ease;
}

.nav-links a:hover::after {
    width: 100%;
}

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

.cart-icon {
    display: flex;
    align-items: center;
    margin-right: 1rem;
    padding: 0.5rem 1rem;
    background-color: var(--secondary-color);
    color: var(--card-background);
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.cart-icon:hover {
    background-color: #00a0b4;
    transform: translateY(-2px);
}

.cart-icon i {
    margin-right: 8px;
}

.dark-mode-toggle {
    background: none;
    border: none;
    color: var(--card-background);
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.3s ease;
    padding: 0.5rem;
    border-radius: 50%;
}

.dark-mode-toggle:hover {
    background-color: rgba(255, 255, 255, 0.1);
    transform: rotate(15deg);
}

.hamburger {
    display: none;
    flex-direction: column;
    cursor: pointer;
}

.hamburger span {
    width: 25px;
    height: 3px;
    background-color: var(--text-color);
    margin: 2px 0;
    transition: var(--transition);
}

.hero {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    padding: 6rem 2rem;
    text-align: center;
    border-radius: 0 0 50% 50% / 20px;
}

.hero h1 {
    font-size: 3rem;
    margin-bottom: 1rem;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.1);
}

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

.products h2, .about h2, .contact h2 {
    text-align: center;
    margin-bottom: 2rem;
    color: var(--primary-color);
}

/* Update the product grid styles (around line 157) */
.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 2rem;
    padding: 2rem;
    background-color: var(--background-color);
}

/* Update the product card styles (around line 166) */
.product-card {
    background-color: var(--card-background);
    border-radius: 15px;
    overflow: hidden;
    transition: var(--transition);
    box-shadow: var(--card-shadow);
    display: flex;
    flex-direction: column;
    height: 100%; /* Allow height to adjust */
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.1);
}

.product-card img {
    width: 100%;
    height: 200px; /* Fixed height for images */
    object-fit: cover;
    transition: var(--transition);
}

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

.product-card .content {
    padding: 1rem;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.product-card h3 {
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
    /* Remove line clamping */
}

.product-card .description {
    font-size: 0.9rem;
    color: var(--text-color);
    opacity: 0.8;
    margin-bottom: 1rem;
    flex-grow: 1;
    /* Remove line clamping */
}

.product-card .price {
    font-size: 1.2rem;
    font-weight: bold;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.product-card button {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 0.75rem 1rem;
    border-radius: 5px;
    cursor: pointer;
    transition: var(--transition);
    width: 100%;
}

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

/* Add styles for mobile devices */
@media (max-width: 768px) {
    .product-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
        gap: 1rem;
        padding: 1rem;
    }

    .product-card {
        height: 500px; /* Slightly reduced height for mobile */
    }

    .product-card img {
        height: 180px; /* Slightly reduced height for mobile */
    }

    .product-card .description {
        max-height: 120px; /* Reduced max height for mobile */
    }
}

/* Add styles for discount price */
.product-card .discount {
    text-decoration: line-through;
    color: #888;
    margin-right: 0.5rem;
}

.about, .contact {
    background-color: var(--card-background);
    padding: 2rem;
    border-radius: 10px;
    box-shadow: var(--card-shadow);
    margin-bottom: 2rem;
}

form {
    display: flex;
    flex-direction: column;
    max-width: 500px;
    margin: 0 auto;
}

form input, form textarea {
    margin-bottom: 1rem;
    padding: 0.5rem;
    border: 1px solid var(--text-color);
    border-radius: 5px;
    background-color: var(--card-background);
    color: var(--text-color);
}

form button {
    background-color: var(--secondary-color);
    color: var(--card-background);
    border: none;
    padding: 0.5rem;
    cursor: pointer;
    border-radius: 5px;
    transition: var(--transition);
}

form button:hover {
    background-color: var(--primary-color);
}

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

.cart-content {
    background-color: var(--card-background);
    max-width: 600px;
    margin: 2rem auto;
    padding: 2rem;
    border-radius: 10px;
    box-shadow: var(--card-shadow);
}

.cart-content h2 {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.cart-items {
    margin-bottom: 1rem;
    max-height: 300px;
    overflow-y: auto;
}

.cart-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
    padding: 0.5rem;
    background-color: var(--background-color);
    border-radius: 5px;
}

.cart-item-image {
    width: 50px;
    height: 50px;
    object-fit: cover;
    border-radius: 5px;
    margin-right: 1rem;
}

.cart-item-details {
    flex-grow: 1;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.cart-item-info {
    flex-grow: 1;
}

.cart-item-details h4 {
    margin: 0;
    font-size: 1rem;
}

.cart-item-details p {
    margin: 0;
    font-size: 0.9rem;
    color: var(--text-color);
}

.cart-item-price {
    font-weight: bold;
    margin-right: 1rem;
}

.cart-item button {
    background-color: var(--secondary-color);
    color: var(--card-background);
    border: none;
    padding: 0.25rem 0.5rem;
    cursor: pointer;
    border-radius: 3px;
    font-size: 0.8rem;
}

.cart-item button:hover {
    background-color: var(--primary-color);
}

.cart-summary {
    margin-top: 1rem;
    border-top: 1px solid var(--text-color);
    padding-top: 1rem;
}

.cart-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 1rem;
    align-items: center;
    margin-bottom: 0.5rem;
}

.cart-label {
    text-align: left;
}

.cart-value {
    text-align: right;
    font-weight: bold;
}

.cart-total {
    font-size: 1.1rem;
    color: var(--secondary-color);
}

.cart-total .cart-value {
    font-size: 1.2rem;
}

#checkoutBtn {
    background-color: var(--secondary-color);
    color: var(--card-background);
    border: none;
    padding: 0.5rem 1rem;
    cursor: pointer;
    border-radius: 5px;
    transition: var(--transition);
    width: 100%;
    margin-top: 1rem;
}

#checkoutBtn:hover {
    background-color: var(--primary-color);
}

@media (max-width: 768px) {
    nav {
        flex-wrap: wrap;
    }

    .nav-links {
        display: none;
        width: 100%;
        text-align: center;
        padding: 1rem 0;
    }

    .nav-links.active {
        display: flex;
        flex-direction: column;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background-color: rgba(98, 0, 234, 0.9);
        padding: 1rem;
    }

    .nav-links li {
        margin: 0.5rem 0;
    }

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

    .hamburger {
        display: flex;
        margin-left: 1rem;
    }

    .cart-icon {
        display: flex;
        align-items: center;
        cursor: pointer;
    }

    .cart-text {
        display: none;
    }

    .cart-icon::after {
        content: attr(data-count);
        position: absolute;
        top: -8px;
        right: -8px;
        background-color: var(--secondary-color);
        color: white;
        font-size: 0.8rem;
        padding: 2px 5px;
        border-radius: 50%;
    }

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

    .hamburger span {
        width: 25px;
        height: 3px;
        background-color: var(--card-background);
        margin: 2px 0;
        transition: all 0.3s ease;
    }

    .hamburger.active span:nth-child(1) {
        transform: rotate(45deg) translate(5px, 5px);
    }

    .hamburger.active span:nth-child(2) {
        opacity: 0;
    }

    .hamburger.active span:nth-child(3) {
        transform: rotate(-45deg) translate(7px, -6px);
    }
}

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

.fade-in {
    animation: fadeIn 0.5s ease-out forwards;
}

.product-card, .advantage-card {
    opacity: 0;
}

/* Add this after the .product-card .description styles */
.product-card .description::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 20px;
    background: linear-gradient(to top, var(--card-background), transparent);
    pointer-events: none;
}

.dark-mode header,
.dark-mode footer,
.dark-mode .about,
.dark-mode .contact {
    background-color: rgba(44, 44, 44, 0.8);
}

.dark-mode .product-card,
.dark-mode .cart-content {
    background-color: rgba(44, 44, 44, 0.8);
}

/* Remove any potential margins between sections */
section {
    margin: 0;
    padding: 2rem 0;
}

.about {
    padding: 4rem 2rem;
    background-color: var(--card-background);
    border-radius: 10px;
    box-shadow: var(--card-shadow);
}

.about h2 {
    text-align: center;
    margin-bottom: 2rem;
    color: var(--primary-color);
}

.about-intro, .about-outro {
    text-align: center;
    max-width: 800px;
    margin: 0 auto 3rem;
    font-size: 1.1rem;
    line-height: 1.6;
}

.about-outro {
    margin-top: 3rem;
    font-weight: bold;
    color: var(--secondary-color);
}

.advantages-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin-top: 3rem;
}

.advantage-card {
    background-color: var(--background-color);
    padding: 2rem;
    border-radius: 10px;
    text-align: center;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.advantage-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}

.advantage-card i {
    font-size: 2.5rem;
    color: var(--secondary-color);
    margin-bottom: 1rem;
}

.advantage-card h3 {
    margin-bottom: 1rem;
    color: var(--primary-color);
}

.advantage-card p {
    font-size: 0.9rem;
    line-height: 1.5;
}

/* Update the existing rule or add if it doesn't exist */
#tooted, .products {
    background-color: var(--background-color);
    padding: 0 0 2rem 0;
    margin: 0;
    position: relative;
    z-index: 1;
}

.products-header {
    background-image: url('https://images.unsplash.com/photo-1533174072545-7a4b6ad7a6c3?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=1170&q=80');
    background-size: cover;
    background-position: center;
    color: white;
    text-align: center;
    padding: 6rem 2rem;
    margin-bottom: 2rem;
    position: relative;
    overflow: hidden;
}

.products-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, 
        rgba(255, 0, 255, 0.5), 
        rgba(0, 255, 255, 0.5), 
        rgba(255, 255, 0, 0.5));
    z-index: 1;
    animation: gradient-shift 10s linear infinite;
}

@keyframes gradient-shift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

@keyframes psychedelic {
    0% { color: #ff00ff; text-shadow: 2px 2px 0 #00ffff, -2px -2px 0 #ffff00; }
    25% { color: #00ffff; text-shadow: 2px 2px 0 #ffff00, -2px -2px 0 #ff00ff; }
    50% { color: #ffff00; text-shadow: 2px 2px 0 #ff00ff, -2px -2px 0 #00ffff; }
    75% { color: #ff00ff; text-shadow: 2px 2px 0 #00ffff, -2px -2px 0 #ffff00; }
    100% { color: #00ffff; text-shadow: 2px 2px 0 #ffff00, -2px -2px 0 #ff00ff; }
}

@keyframes wobble {
    0%, 100% { transform: translateX(0) rotate(0); }
    25% { transform: translateX(-5px) rotate(-5deg); }
    75% { transform: translateX(5px) rotate(5deg); }
}

.products-header h2 {
    font-size: 4rem;
    margin-bottom: 1rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    animation: psychedelic 5s linear infinite, wobble 3s ease-in-out infinite;
    font-weight: bold;
    -webkit-text-stroke: 1px black;
}

.products-header p {
    font-size: 1.4rem;
    max-width: 600px;
    margin: 0 auto;
    line-height: 1.6;
    color: #ffffff;
    text-shadow: 0 0 5px rgba(255, 255, 255, 0.7);
}

.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 2rem;
    padding: 2rem;
    background-color: var(--background-color);
}

@media (max-width: 768px) {
    .products-header {
        padding: 3rem 1rem;
    }

    .products-header h2 {
        font-size: 2.5rem;
    }

    .products-header p {
        font-size: 1rem;
    }
}

/* Ensure consistent background color */
main, #avaleht, #tooted, #meist, #kontakt {
    background-color: var(--background-color);
}

/* Remove any potential margins between sections */
section {
    margin: 0;
    padding: 2rem 0;
}

/* Ensure the body fills the entire viewport */
body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background-color: var(--background-color);
}

/* Make sure main takes up all available space */
main {
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* Ensure footer sticks to the bottom */
footer {
    margin-top: auto;
}

/* Style for the main heading */
.products h2 {
    font-size: 2.5rem;
    text-align: center;
    margin-bottom: 2rem;
    color: var(--primary-color);
    text-transform: uppercase;
    letter-spacing: 2px;
    padding-top: 2rem;
}
