/* --- Base & Mobile-First Styles --- */
:root {
    --primary-bg: #1a1a1a;
    --secondary-bg: #2c2c2c;
    --accent-color: #ff9900;
    --text-color: #f0f0f0;
    --shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

body {
    margin: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--primary-bg);
    /* Fallback color */
    color: var(--text-color);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    overflow: hidden;
    background-color: #1a2a2a;
    /* A dark, foresty fallback color */
    background-image: url('https://images.unsplash.com/photo-1448375240586-882707db888b');
    /* Background Forest Only */
    background-size: cover;
    background-position: center center;
}

/* --- Foreground Element for Parallax --- */
body::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: url('../images/forest-fg.png');
    background-size: cover;
    background-position: center center;
    z-index: 1;
    /* Places it above the body background but below the avatar */
    animation: sway 25s ease-in-out infinite alternate;
}


/* --- Main Layout Container --- */
#avatar-container {
    z-index: 2;
    /* Ensure avatar is on top of the new foreground */
    position: relative;
    /* For speech bubble */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

/* --- Avatar Styles --- */
#avatar-placeholder {
    width: 200px;
    height: 200px;
    border-radius: 50%;
    background-image: url('../images/littlefoot-avatar.png');
    background-size: cover;
    background-position: center;
    box-shadow: var(--shadow);
    cursor: pointer;
    animation:
        float 6s ease-in-out infinite,
        breathing 8s ease-in-out infinite;
    /* Combined idle animations */
}

/* --- Speech Bubble Styles --- */
#speech-bubble {
    position: absolute;
    bottom: 100%;
    margin-bottom: 20px;
    background-color: var(--accent-color);
    color: var(--primary-bg);
    padding: 15px 25px;
    border-radius: 25px;
    max-width: 300px;
    text-align: center;
    font-size: 16px;
    font-weight: bold;
    box-shadow: var(--shadow);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
    z-index: 10;
}

#speech-bubble::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 10px solid transparent;
    border-right: 10px solid transparent;
    border-top: 10px solid var(--accent-color);
}

#speech-bubble.visible {
    opacity: 1;
    visibility: visible;
}

/* --- Interaction Controls --- */
#interaction-controls {
    margin-top: 20px;
}

#micButton {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    border: none;
    background-color: var(--accent-color);
    color: var(--primary-bg);
    font-size: 30px;
    cursor: pointer;
    box-shadow: var(--shadow);
    transition: background-color 0.3s;
}

#micButton:hover {
    background-color: #ffb84d;
}

#micButton.listening {
    animation: pulse 1.5s infinite;
}

/* --- Animations --- */
@keyframes float {
    0% {
        transform: translateY(0px);
    }

    50% {
        transform: translateY(-10px);
    }

    100% {
        transform: translateY(0px);
    }
}

@keyframes breathing {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.02);
    }

    100% {
        transform: scale(1);
    }
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(255, 153, 0, 0.7);
    }

    70% {
        box-shadow: 0 0 0 20px rgba(255, 153, 0, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(255, 153, 0, 0);
    }
}

@keyframes speaking {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.03);
    }

    100% {
        transform: scale(1);
    }
}

@keyframes sway {
    from {
        transform: rotate(-1.5deg) scale(1.05);
    }

    to {
        transform: rotate(1.5deg) scale(1.05);
    }
}

/* --- State-Specific Animations --- */
#avatar-placeholder.is-speaking {
    /* The speaking animation should be prominent */
    animation:
        float 6s ease-in-out infinite,
        speaking 1.5s ease-in-out infinite;
}

#avatar-placeholder.is-loading {
    /* Loading combines idle animations with a pulse */
    animation:
        float 6s ease-in-out infinite,
        breathing 8s ease-in-out infinite,
        pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* --- Modal Styles (Gallery & Contact) --- */
.modal {
    display: none;
    position: fixed;
    z-index: 100;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.7);
    animation: fadeIn 0.5s;
}

.modal-content {
    background-color: var(--secondary-bg);
    margin: 10% auto;
    padding: 30px;
    border-radius: 15px;
    width: 80%;
    max-width: 600px;
    box-shadow: var(--shadow);
    position: relative;
}

.close-button {
    color: #aaa;
    position: absolute;
    top: 15px;
    right: 25px;
    font-size: 35px;
    font-weight: bold;
    cursor: pointer;
}

.close-button:hover,
.close-button:focus {
    color: var(--accent-color);
    text-decoration: none;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* --- Contact Form Styles --- */
#contact-form,
#review-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-top: 20px;
}

#contact-form input,
#contact-form textarea,
#review-form input,
#review-form textarea,
#review-form select {
    width: 100%;
    padding: 12px;
    border-radius: 8px;
    border: 1px solid #555;
    background-color: var(--secondary-bg);
    color: var(--text-color);
    font-size: 16px;
}

#contact-form button {
    padding: 15px;
    border: none;
    border-radius: 8px;
    background-color: var(--accent-color);
    color: var(--primary-bg);
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
}

.gallery-grid {
    margin-top: 20px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 10px;
}

.gallery-grid img {
    width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: var(--shadow);
}

/* Testimonials Styles */
.testimonials-container {
    max-height: 60vh;
    overflow-y: auto;
    padding: 10px;
    text-align: left;
}

.testimonial-item {
    background: #ffffff;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    border-left: 6px solid #007bff;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s, box-shadow 0.2s;
}

.testimonial-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

.testimonial-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
}

.testimonial-author {
    display: flex;
    flex-direction: column;
}

.testimonial-author .name {
    font-weight: bold;
    font-size: 1.1em;
    color: #333;
}

.testimonial-author .date {
    font-size: 0.85em;
    color: #777;
}

.testimonial-rating {
    color: #ffc107;
    /* Gold color for stars */
    font-size: 1.2em;
    letter-spacing: 2px;
}

.testimonial-body {
    font-style: italic;
    color: #555;
    line-height: 1.6;
}

.action-button {
    background: linear-gradient(135deg, #28a745 0%, #218838 100%);
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 30px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.action-button:hover {
    background: linear-gradient(135deg, #34ce57 0%, #28a745 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(40, 167, 69, 0.3);
}

.rating-input {
    margin: 10px 0;
    text-align: left;
}

.star-rating {
    display: inline-block;
    font-size: 24px;
    cursor: pointer;
}

.star-rating .fa-star {
    color: #ccc;
    transition: color 0.2s;
}

.star-rating .fa-star.checked,
.star-rating .fa-star.hover {
    color: #ffc107;
}

/* --- Lightbox Styles --- */
.lightbox {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    justify-content: center;
    align-items: center;
}

.lightbox-content {
    max-width: 90%;
    max-height: 80%;
    animation: fadeIn 0.5s;
}

.lightbox-close {
    position: absolute;
    top: 20px;
    right: 40px;
    color: #fff;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.3s;
}

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

/* --- Desktop Styles --- */
@media (min-width: 768px) {
    #avatar-placeholder {
        width: 300px;
        height: 300px;
    }

    .modal-content {
        margin-top: 5%;
    }
}