/* ==========================================================
   Essence Perfume Store - Stylesheet
   Front-End Development Course Project
   ========================================================== */

/* ----- CSS Variables (Color Palette & Fonts) ----- */
:root {
    --color-black: #1a1a1a;
    --color-white: #ffffff;
    --color-beige: #f5f0e8;
    --color-gold: #c9a24b;
    --color-gold-light: #e6cf9c;
    --color-text: #333333;

    --font-heading: 'Playfair Display', serif;
    --font-body: 'Poppins', sans-serif;

    --transition-speed: 0.3s;
}

/* ----- Reset / Base Styles ----- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-body);
    color: var(--color-text);
    background-color: var(--color-white);
    line-height: 1.6;
    overflow-x: hidden;
}

h1, h2, h3 {
    font-family: var(--font-heading);
    color: var(--color-black);
}

a {
    text-decoration: none;
    color: inherit;
}

ul {
    list-style: none;
}

img {
    max-width: 100%;
    display: block;
}

/* ----- Header and Navigation (Flexbox) ----- */
.main-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 40px;
    background-color: var(--color-black);
    position: sticky;
    top: 0;
    z-index: 100;
}

.logo {
    font-family: var(--font-heading);
    font-size: 1.8rem;
    color: var(--color-gold);
    letter-spacing: 2px;
}

.navbar .nav-list {
    display: flex;
    gap: 30px;
}

.navbar .nav-list a {
    color: var(--color-white);
    font-weight: 400;
    padding-bottom: 5px;
    border-bottom: 2px solid transparent;
    transition: border-color var(--transition-speed), color var(--transition-speed);
}

.navbar .nav-list a:hover,
.navbar .nav-list a.active {
    color: var(--color-gold);
    border-bottom: 2px solid var(--color-gold);
}

/* ----- Hamburger Button (hidden on desktop, JS-controlled) ----- */
.nav-toggle {
    display: none;
    flex-direction: column;
    justify-content: space-between;
    width: 28px;
    height: 20px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
}

.nav-toggle span {
    display: block;
    height: 2px;
    width: 100%;
    background-color: var(--color-gold);
    border-radius: 2px;
    transition: transform var(--transition-speed), opacity var(--transition-speed);
}

/* Turns the 3 lines into an "X" when the menu is open */
.nav-toggle.open span:nth-child(1) {
    transform: translateY(9px) rotate(45deg);
}
.nav-toggle.open span:nth-child(2) {
    opacity: 0;
}
.nav-toggle.open span:nth-child(3) {
    transform: translateY(-9px) rotate(-45deg);
}

/* ----- Hero Section ----- */
.hero {
    background: linear-gradient(rgba(0,0,0,0.6), rgba(0,0,0,0.6)),
                url('https://images.unsplash.com/photo-1593487568720-92097fb460fb?auto=format&fit=crop&w=1600&q=80') center 30%/cover no-repeat;
    height: 60vh;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: var(--color-white);
    padding: 20px;
}

.hero-text {
    max-width: 600px;
    animation: fadeIn 1.5s ease-in-out;
}

.hero-text h1 {
    color: var(--color-white);
    font-size: 2.5rem;
    margin-bottom: 15px;
}

.hero-text p {
    margin-bottom: 25px;
    font-weight: 300;
}

/* ----- Buttons ----- */
.btn-primary,
.btn-secondary {
    display: inline-block;
    padding: 12px 30px;
    border-radius: 30px;
    font-weight: 600;
    cursor: pointer;
    transition: transform var(--transition-speed), background-color var(--transition-speed);
    border: none;
}

.btn-primary {
    background-color: var(--color-gold);
    color: var(--color-black);
}

.btn-primary:hover {
    background-color: var(--color-gold-light);
    transform: translateY(-3px);
}

.btn-secondary {
    background-color: var(--color-black);
    color: var(--color-white);
    margin-top: 10px;
}

.btn-secondary:hover {
    background-color: var(--color-gold);
    color: var(--color-black);
    transform: translateY(-3px);
}

/* ----- Sections General ----- */
section {
    padding: 60px 40px;
}

.featured h2,
.about-section h2,
.page-title h1 {
    text-align: center;
    margin-bottom: 10px;
}

.page-title {
    text-align: center;
    background-color: var(--color-beige);
    padding: 50px 20px;
}

.about-section {
    background-color: var(--color-beige);
    text-align: center;
}

.about-section p {
    max-width: 700px;
    margin: 20px auto 0 auto;
}

/* ----- Product Grid (CSS Grid) ----- */
.product-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 30px;
    margin-top: 40px;
}

.featured-grid {
    grid-template-columns: repeat(3, 1fr);
}

/* ----- Product Cards ----- */
.product-card {
    background-color: var(--color-white);
    border: 1px solid #eee;
    border-radius: 15px;
    padding: 20px;
    text-align: center;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
    transition: transform var(--transition-speed), box-shadow var(--transition-speed);
}

/* Scroll-reveal effect controlled by IntersectionObserver in script.js */
.product-card {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out, box-shadow var(--transition-speed);
}

.product-card.card-visible {
    opacity: 1;
    transform: translateY(0);
}

/* Hover rule placed last so it always wins over the reveal transform */
.product-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.15);
}

.product-card img {
    border-radius: 10px;
    margin-bottom: 15px;
    height: 220px;
    width: 100%;
    object-fit: cover;
}

.product-card h3 {
    font-size: 1.2rem;
    margin-bottom: 8px;
}

.product-card .description {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 10px;
}

.product-card .price {
    font-weight: 600;
    color: var(--color-gold);
    margin-bottom: 10px;
}

/* ----- Contact Page ----- */
.contact-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
}

.contact-info h2,
.contact-form-wrapper h2 {
    margin-bottom: 20px;
}

.contact-info p {
    margin-bottom: 10px;
}

.social-icons {
    margin: 20px 0;
    display: flex;
    gap: 15px;
    font-size: 1.5rem;
}

.social-icons a {
    transition: transform var(--transition-speed);
}

.social-icons a:hover {
    transform: scale(1.2);
}

.map-frame {
    border-radius: 10px;
    margin-top: 20px;
}

/* ----- Contact Form ----- */
.contact-form {
    display: flex;
    flex-direction: column;
}

.contact-form label {
    margin-top: 12px;
    margin-bottom: 5px;
    font-weight: 600;
}

.contact-form input,
.contact-form textarea {
    padding: 12px;
    border: 1px solid #ccc;
    border-radius: 8px;
    font-family: var(--font-body);
    transition: border-color var(--transition-speed);
}

.contact-form input:focus,
.contact-form textarea:focus {
    outline: none;
    border-color: var(--color-gold);
}

.contact-form button {
    margin-top: 20px;
    align-self: flex-start;
}

/* Success message shown by script.js after the form is "submitted" */
.form-success {
    display: none;
    margin-top: 15px;
    padding: 12px 15px;
    background-color: #eaf7ec;
    color: #2e7d32;
    border-radius: 8px;
    font-size: 0.9rem;
}

.form-success.show-message {
    display: block;
    animation: fadeIn 0.5s ease-in-out;
}

/* ----- Toast Notification (Products Page "Buy Now") ----- */
.toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background-color: var(--color-black);
    color: var(--color-gold);
    padding: 14px 28px;
    border-radius: 30px;
    font-weight: 600;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-speed), transform var(--transition-speed);
    z-index: 200;
}

.toast.show-toast {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ----- Footer (Flexbox) ----- */
.main-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
    background-color: var(--color-black);
    color: var(--color-white);
    padding: 25px 40px;
    text-align: center;
}

.footer-links {
    display: flex;
    gap: 20px;
}

.footer-links a {
    color: var(--color-white);
    transition: color var(--transition-speed);
}

.footer-links a:hover {
    color: var(--color-gold);
}

/* ----- Simple Fade-In Animation ----- */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ==========================================================
   Responsive Design - Media Query for screens 768px or smaller
   ========================================================== */
@media (max-width: 768px) {

    .main-header {
        flex-wrap: wrap;
        padding: 15px 20px;
        position: relative;
    }

    /* Show the hamburger button only on mobile */
    .nav-toggle {
        display: flex;
    }

    /* Navbar is hidden by default on mobile and slides in when opened */
    .navbar {
        width: 100%;
        max-height: 0;
        overflow: hidden;
        transition: max-height var(--transition-speed) ease-in-out;
    }

    .navbar.nav-open {
        max-height: 300px;
        margin-top: 15px;
    }

    .navbar .nav-list {
        flex-direction: column;
        align-items: center;
        gap: 15px;
        padding-bottom: 15px;
    }

    .hero {
        height: auto;
        padding: 60px 20px;
    }

    .hero-text h1 {
        font-size: 1.8rem;
    }

    section {
        padding: 40px 20px;
    }

    .product-grid,
    .featured-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }

    .product-card img {
        height: 180px;
    }

    .contact-section {
        grid-template-columns: 1fr;
    }

    .main-footer {
        flex-direction: column;
        text-align: center;
    }
}

/* Extra small screens (phones) */
@media (max-width: 480px) {
    .product-grid,
    .featured-grid {
        grid-template-columns: 1fr;
    }

    .hero-text h1 {
        font-size: 1.5rem;
    }
}
