:root {
    --primary-color: #0a0a0a;
    --secondary-color: #1a1a1a;
    --accent-color: #00aaff;
    --text-color: #f0f0f0;
    --card-bg-color: #2a2a2a;
    --footer-bg-color: #050505;
}

body {
    font-family: 'Poppins', sans-serif;
    margin: 0;
    padding: 0;
    background-color: var(--primary-color);
    color: var(--text-color);
    overflow-x: hidden;
}

/* --- Header --- */
.main-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    background-color: rgba(10, 10, 10, 0.8);
    position: fixed;
    width: 100%;
    top: 0;
    z-index: 1000;
    backdrop-filter: blur(10px);
}

.logo img {
    height: 50px;
    transition: transform 0.3s ease;
}

.logo img:hover {
    transform: scale(1.1);
}

.main-nav a {
    color: var(--text-color);
    text-decoration: none;
    margin: 0 1rem;
    font-weight: bold;
    transition: color 0.3s ease, transform 0.3s ease;
}

.main-nav a:hover {
    color: var(--accent-color);
    transform: translateY(-2px);
}

/* --- Hero Image --- */
.hero-image {
    height: 100vh;
    background: linear-gradient(45deg, var(--primary-color), var(--secondary-color));
    background-position: center;
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    position: relative;
    transition: opacity 1s ease-out;
}

.hero-text {
    animation: fadeIn 2s ease-in-out;
}

.hero-text h1 {
    font-size: 4rem;
    margin: 0;
    text-shadow: 2px 2px 8px rgba(0, 0, 0, 0.7);
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.1ch; /* Add a small gap between letters */
}

.hero-text p {
    font-size: 1.5rem;
    text-shadow: 1px 1px 4px rgba(0, 0, 0, 0.7);
}

.emoji-animation {
    margin-top: 2rem;
}

.emoji-animation span {
    display: inline-block;
    font-size: 2rem;
    margin: 0 0.5rem;
    opacity: 0;
    animation: float-up 1s ease-out forwards;
}

.emoji-animation span:nth-child(1) { animation-delay: 2.0s; }
.emoji-animation span:nth-child(2) { animation-delay: 2.2s; }
.emoji-animation span:nth-child(3) { animation-delay: 2.4s; }
.emoji-animation span:nth-child(4) { animation-delay: 2.6s; }
.emoji-animation span:nth-child(5) { animation-delay: 2.8s; }

/* --- Main Content --- */
main {
    padding-top: 100vh; /* Space for the hero image */
}

section {
    padding: 4rem 2rem;
    border-bottom: 1px solid var(--secondary-color);
    text-align: center;
}

section h2 {
    font-size: 2.5rem;
    margin-bottom: 2rem;
    color: var(--accent-color);
}

button, .btn {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    will-change: transform;
}

button:hover, .btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
}

/* --- Project Section --- */
.project-container {
    display: flex;
    flex-direction: column;
    gap: 5rem;
}

.project-item {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    align-items: center;
    background-color: var(--card-bg-color);
    border-radius: 10px;
    padding: 2rem;
    overflow: hidden;
}

.project-item:nth-child(even) {
    grid-template-columns: 1fr 1fr;
}

.project-item:nth-child(even) .project-image {
    order: 2;
}

.project-image img {
    width: 100%;
    border-radius: 10px;
    transition: transform 0.4s ease, filter 0.4s ease;
    filter: saturate(80%);
}

.project-image img:hover {
    transform: scale(1.05);
    filter: saturate(100%);
}

.project-info {
    text-align: left;
}

.project-info h3 {
    margin-top: 0;
    color: var(--accent-color);
    font-size: 2rem;
}

/* Add animations for project items */
.project-item .project-image {
    transform: translateX(-100%);
    opacity: 0;
    transition: transform 0.6s ease-out, opacity 0.6s ease-out;
}
.project-item .project-info {
    transform: translateX(100%);
    opacity: 0;
    transition: transform 0.6s ease-out, opacity 0.6s ease-out;
}
.project-item:nth-child(even) .project-image {
    transform: translateX(100%);
}
.project-item:nth-child(even) .project-info {
    transform: translateX(-100%);
}

section.visible .project-item .project-image,
section.visible .project-item .project-info {
    transform: translateX(0);
    opacity: 1;
}

.btn-disabled {
    background-color: #555;
    color: #aaa;
    padding: 0.8rem 1.5rem;
    border: none;
    border-radius: 5px;
    cursor: not-allowed;
}

/* --- Carly Bot Section --- */
.carly-bot-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2rem;
    text-align: left;
}

.carly-bot-container img {
    width: 200px;
    height: 200px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--accent-color);
    transition: transform 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.carly-bot-container:hover img {
    transform: rotate(10deg) scale(1.1);
}

/* --- Flygame Collab Section --- */
#flygame-collab {
    background-color: var(--secondary-color);
    border-top: 1px solid #444;
}

#flygame-collab h2 a:hover {
    text-decoration: underline;
}

/* --- Donation & Footer --- */
#paypal-donate-button-container {
    margin-top: 1rem;
    display: inline-block;
}

.main-footer {
    background-color: var(--footer-bg-color);
    text-align: center;
    padding: 2rem;
}

.social-links a {
    color: var(--text-color);
    text-decoration: none;
    margin: 0 1rem;
    font-size: 1.5rem;
    transition: color 0.3s ease;
}

.social-links a:hover {
    color: var(--accent-color);
}

/* --- Animations --- */
@keyframes float-up {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

@keyframes letterFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.letter-animation span {
    display: inline-block;
    opacity: 0;
    animation: letterFadeIn 0.5s forwards;
}

.carly-bot-container:hover .carly-bot-info {
    transform: translateX(10px);
}

.carly-bot-info {
    transition: transform 0.3s ease-out;
}

/* General animation for sections */
section {
    opacity: 0;
    transform: translateY(50px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

section.visible {
    opacity: 1;
    transform: translateY(0);
}

/* --- Project Image Overlay --- */
.project-image-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 1rem;
    font-weight: bold;
    opacity: 0;
    transition: opacity 0.3s ease;
    border-radius: 10px; /* Match the image's border-radius */
}

.project-image:hover .project-image-overlay {
    opacity: 1;
}

/* --- Modal --- */
.modal {
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.6);
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background-color: var(--secondary-color);
    padding: 2rem;
    border: 1px solid var(--accent-color);
    border-radius: 10px;
    width: 80%;
    max-width: 500px;
    position: relative;
    animation: slideIn 0.5s ease-out;
}

.close-button {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    position: absolute;
    top: 10px;
    right: 20px;
}

.close-button:hover,
.close-button:focus {
    color: white;
    text-decoration: none;
    cursor: pointer;
}

#creative-engine-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

#creative-engine-form input,
#creative-engine-form textarea {
    padding: 0.8rem;
    border: 1px solid #555;
    background-color: var(--primary-color);
    color: var(--text-color);
    border-radius: 5px;
}

#creative-engine-form button {
    background-color: var(--accent-color);
    color: white;
    padding: 0.8rem 1.5rem;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

#creative-engine-form button:hover {
    background-color: #0088cc;
}

#creative-engine-form .form-status {
    margin-top: 1rem;
    padding: 0.8rem;
    border-radius: 5px;
    text-align: center;
    font-weight: bold;
    border: 1px solid transparent;
}

@keyframes slideIn {
    from { transform: translateY(-50px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.feature-modal-content {
    max-width: 700px; /* Wider modal for more content */
}

.feature-modal-content h3 {
    color: var(--accent-color);
    margin-top: 0;
}

.feature-modal-content p {
    line-height: 1.7;
}

.feature-modal-content pre {
    background-color: var(--primary-color);
    padding: 1rem;
    border-radius: 5px;
    border: 1px solid #444;
    white-space: pre-wrap;       /* Since CSS 2.1 */
    white-space: -moz-pre-wrap;  /* Mozilla, since 1999 */
    white-space: -pre-wrap;      /* Opera 4-6 */
    white-space: -o-pre-wrap;    /* Opera 7 */
    word-wrap: break-word;       /* Internet Explorer 5.5+ */
}

.feature-modal-content code {
    font-family: 'Courier New', Courier, monospace;
    color: #f8f8f2;
}


/* --- Creative Engine Section --- */
.creative-engine-layout {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 2rem;
    align-items: center;
    text-align: left;
}

.creative-engine-img img {
    width: 100%;
    border-radius: 10px;
}

.creative-engine-intro {
    max-width: 800px;
    margin: 0 auto;
}

.progress-bar-container {
    margin: 2rem 0;
}

.progress-bar {
    background-color: var(--primary-color);
    border-radius: 5px;
    border: 1px solid var(--accent-color);
    padding: 3px;
}

.progress-bar-fill {
    height: 20px;
    background-color: var(--accent-color);
    border-radius: 3px;
    transition: width 1s ease-in-out;
}

.creative-engine-buttons button {
    background-image: linear-gradient(45deg, var(--accent-color) 0%, #0077be 100%);
    border: none;
    color: white;
    padding: 0.8rem 1.5rem;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    margin: 0.5rem; /* Adjusted margin for better spacing */
    font-weight: 600;
    font-family: 'Poppins', sans-serif; /* Ensure font consistency */
}

.creative-engine-buttons button:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 15px rgba(0, 170, 255, 0.3);
}

.feature-list {
    list-style: none;
    padding: 0;
    margin-top: 2rem;
}

.feature-list li {
    margin-bottom: 1rem;
    padding: 0.75rem;
    border-radius: 8px;
    transition: transform 0.3s ease, background-color 0.3s ease;
    will-change: transform;
    cursor: pointer;
}

.feature-list li:hover {
    transform: translateX(10px);
    background-color: rgba(255, 255, 255, 0.05);
}

/* --- Gallery Modal --- */
.gallery-modal-content {
    width: 90%;
    max-width: 1200px;
    height: 80vh;
}

#gallery-content-container {
    overflow-y: auto;
    height: calc(100% - 50px); /* 50px for header */
    padding-right: 1rem;
}

.gallery-item {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    align-items: center;
    margin-bottom: 2rem;
    padding: 1rem;
    border-bottom: 1px solid var(--secondary-color);
}

.gallery-item:nth-child(even) .gallery-image {
    order: 2;
}

.gallery-image img {
    width: 100%;
    border-radius: 10px;
}

.gallery-text {
    text-align: left;
    font-size: 1.1rem;
    line-height: 1.6;
}

/* --- Custom Donate Button --- */
#donar .paypal-button {
    background-color: #ffc439;
    color: #111;
    padding: 1rem 2rem;
    border-radius: 8px;
    text-decoration: none;
    font-weight: bold;
    display: inline-block;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

#donar .paypal-button:hover {
    transform: scale(1.05);
    box-shadow: 0 5px 15px rgba(255, 196, 57, 0.4);
}

/* Helper class */
.oculto {
    display: none !important;
}

/* --- Chat Widget --- */
#chat-widget-container {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 1001;
}

#open-chat-btn {
    background-color: var(--accent-color);
    color: white;
    border: none;
    border-radius: 50%;
    width: 60px;
    height: 60px;
    font-size: 2rem;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    transition: transform 0.2s ease;
}

#open-chat-btn:hover {
    transform: scale(1.1);
}

#chat-window {
    width: 350px;
    height: 500px;
    background-color: var(--secondary-color);
    border-radius: 15px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.4);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: absolute;
    bottom: 80px; /* Position above the open button */
    right: 0;
}

.chat-header {
    background-color: var(--accent-color);
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-header h3 {
    margin: 0;
    color: white;
}

#close-chat-btn {
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
}

#chat-body {
    flex-grow: 1;
    padding: 1rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.chat-message {
    padding: 0.8rem;
    border-radius: 10px;
    max-width: 80%;
    line-height: 1.4;
}

.user-message {
    background-color: var(--accent-color);
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 0;
}

.bot-message {
    background-color: var(--card-bg-color);
    color: var(--text-color);
    align-self: flex-start;
    border-bottom-left-radius: 0;
}

.chat-input-container {
    display: flex;
    padding: 1rem;
    border-top: 1px solid var(--primary-color);
}

#chat-input {
    flex-grow: 1;
    border: none;
    background-color: var(--card-bg-color);
    color: var(--text-color);
    padding: 0.8rem;
    border-radius: 5px;
    margin-right: 0.5rem;
}

#chat-send-btn {
    background-color: var(--accent-color);
    color: white;
    border: none;
    padding: 0.8rem 1.2rem;
    border-radius: 5px;
    cursor: pointer;
}

/* --- Avances Modal --- */
.avances-modal .modal-content {
    width: 90%;
    max-width: 1200px;
    height: 85vh;
    padding: 0;
    display: flex;
    flex-direction: column;
}

.avances-modal-content .close-button {
    z-index: 10;
    color: var(--text-color);
    font-size: 32px;
}

.avances-layout {
    display: grid;
    grid-template-columns: 250px 1fr;
    height: 100%;
    overflow: hidden;
}

.avances-sidebar {
    background-color: var(--primary-color);
    padding: 2rem 1rem;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--secondary-color);
}

.avances-logo h2 {
    margin: 0 0 2rem 0;
    text-align: center;
    color: var(--accent-color);
    font-size: 1.8rem;
}

.avances-nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.avances-nav li {
    padding: 1rem;
    margin-bottom: 0.5rem;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.2s ease;
}

.avances-nav li:hover {
    background-color: var(--secondary-color);
    transform: translateX(5px);
}

.avances-nav li.active {
    background-color: var(--accent-color);
    color: white;
    font-weight: bold;
}

.avances-main {
    padding: 2rem;
    overflow-y: auto;
}

.publication {
    background-color: var(--secondary-color);
    padding: 1.5rem;
    border-radius: 10px;
    margin-bottom: 2rem;
    animation: fadeIn 0.5s ease-out;
}

.publication h3 {
    color: var(--accent-color);
    margin-top: 0;
}

.publication-media {
    margin: 1rem 0;
}

.publication-media .image-carousel {
    position: relative;
    width: 100%;
    max-width: 500px;
    margin-bottom: 1rem;
}

.publication-media .image-carousel img {
    width: 100%;
    border-radius: 8px;
    display: none; /* JS will handle display */
}

.publication-media video {
    width: 100%;
    max-width: 500px;
    border-radius: 8px;
}

.youtube-btn {
    display: inline-block;
    background-color: #ff0000;
    color: white;
    padding: 0.6rem 1.2rem;
    border-radius: 5px;
    text-decoration: none;
    font-weight: bold;
    transition: background-color 0.3s ease;
}

.youtube-btn:hover {
    background-color: #cc0000;
}

/* --- Collaborators Page (New Design) --- */
.collaborator-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 2.5rem;
    margin-top: 3rem;
}

.collaborator-card {
    background-color: var(--secondary-color);
    border-radius: 15px;
    padding: 2rem;
    text-align: center;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border: 1px solid var(--primary-color);
}

.collaborator-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
    border-color: var(--accent-color);
}

.collaborator-photo {
    margin-bottom: 1.5rem;
}

.collaborator-photo img {
    width: 150px;
    height: 150px;
    object-fit: cover;
    border-radius: 50%; /* Makes the image circular */
    border: 4px solid var(--accent-color);
    margin: 0 auto;
    display: block;
}

.collaborator-info h3 {
    margin-top: 0;
    margin-bottom: 0.5rem;
    color: var(--accent-color);
    font-size: 1.6rem;
}

.collaborator-info p {
    font-size: 1rem;
    line-height: 1.6;
    color: var(--text-color);
    opacity: 0.9;
}