:root {
    --bg-dark: #12121c;
    --card-dark: #1e1e2f;
    --border-color: rgba(255, 255, 255, 0.1);
    --text-primary: #e0e0e0;
    --text-secondary: #a0a0b0;
    --accent-primary: #667eea;
    --accent-secondary: #764ba2;
    --gradient: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-secondary) 100%);
}

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

body {
    font-family: 'Poppins', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.7;
    color: var(--text-primary);
    background-color: var(--bg-dark);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

header {
    background: var(--gradient);
    color: white;
    padding: 2rem;
    text-shadow: 0 2px 4px rgba(0,0,0,0.2);
    /* === FLEXBOX FOR LAYOUT === */
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
}

/* === NEW LOGO STYLES === */
.header-logo {
    height: 70px;
    width: auto;
    border-radius: 8px; /* Optional: adds rounded corners to the logo */
}

.header-text {
    text-align: left;
}

/* Footer Auth Links */
footer a {
    color: var(--accent-primary);
    text-decoration: none;
}

footer a:hover {
    text-decoration: underline;
}

/* Utility Classes */
.hidden {
    display: none !important;
}

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

.modal.hidden {
    display: none !important;
}

.modal-content {
    background: var(--card-dark);
    padding: 2rem;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    width: 90%;
    max-width: 400px;
    position: relative;
}

.modal-content h2 {
    color: var(--text-primary);
    margin-bottom: 1.5rem;
    text-align: center;
}

.close {
    position: absolute;
    top: 1rem;
    right: 1.5rem;
    font-size: 2rem;
    color: var(--text-secondary);
    cursor: pointer;
    line-height: 1;
}

.close:hover {
    color: var(--text-primary);
}

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

#auth-form input {
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-dark);
    color: var(--text-primary);
    font-size: 1rem;
}

#auth-form input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.2);
}

#auth-form button {
    padding: 0.75rem;
    border: none;
    border-radius: 6px;
    background: var(--gradient);
    color: white;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

#auth-form button:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.error-message {
    color: #ff6b6b;
    background: rgba(255, 107, 107, 0.1);
    padding: 0.5rem;
    border-radius: 4px;
    border-left: 4px solid #ff6b6b;
    font-size: 0.9rem;
}

.success-message {
    color: #51cf66;
    background: rgba(81, 207, 102, 0.1);
    padding: 0.5rem;
    border-radius: 4px;
    border-left: 4px solid #51cf66;
    font-size: 0.9rem;
}

/* ======================== */


header h1 {
    font-size: clamp(2.5rem, 5vw, 3.5rem);
    margin-bottom: 0.25rem; /* Reduced margin */
    font-weight: 700;
}

header p {
    font-size: clamp(1rem, 2.5vw, 1.25rem);
    opacity: 0.9;
    font-weight: 300;
}

main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
    width: 100%;
    flex: 1; 
}

section {
    margin-bottom: 4rem;
}

h2 {
    font-size: clamp(1.8rem, 4vw, 2.5rem);
    /* margin-bottom: 2rem; */
    color: #fff;
    font-weight: 600;
}

.intro {
    text-align: center;
    background: var(--card-dark);
    padding: 1.5rem;
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.intro h2 {
    color: var(--accent-primary);
}

.grid-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

.project-item {
    background: var(--card-dark);
    padding: 2rem;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    transition: transform 0.3s ease, border-color 0.3s ease;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.project-item:hover {
    transform: translateY(-8px);
    border-color: var(--accent-primary);
}

.card-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.card-header p {
    margin-bottom: 0px
}

.card-header i {
    font-size: 2rem;
    color: var(--accent-primary);
}

.project-item h3 {
    font-size: 1.5rem;
    color: #fff;
    font-weight: 600;
}

.project-item p {
    color: var(--text-secondary);
    flex-grow: 1; /* Pushes button to the bottom */
}

.project-link {
    text-decoration: none;
    color: inherit;
}

.button {
    display: inline-block;
    align-self: flex-start; /* Align button to the start of the flex item */
    padding: 0.8rem 1.8rem;
    background: var(--gradient);
    color: white;
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.3s ease;
    font-weight: 500;
    border: none;
    margin-top: 1rem;
}

.button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(102, 126, 234, 0.3);
}

.button.disabled {
    background: #444;
    cursor: not-allowed;
    color: #888;
}

.button.disabled:hover {
    transform: none;
    box-shadow: none;
}

footer {
    text-align: center;
    padding: 2rem;
    background: #0c0c14; /* Even darker footer */
    color: var(--text-secondary);
    margin-top: auto;
}

/* Mobile footer adjustments */
@media (max-width: 768px) {
    footer p {
        font-size: 0.85rem;
        line-height: 1.4;
    }

    footer {
        padding: 1.5rem 1rem;
    }

    /* Ensure modal works properly on mobile */
    .modal {
        position: fixed !important;
        z-index: 9999 !important;
    }

    .modal.hidden {
        display: none !important;
        visibility: hidden !important;
    }

    .modal-content {
        width: 95%;
        max-width: 350px;
        margin: 0 auto;
    }
}

@media (max-width: 768px) {
    main {
        padding: 1rem;
    }

    header {
        flex-direction: column; /* Stack logo and text vertically */
        padding: 2rem 1rem;
    }

    .header-text {
        text-align: center; /* Center the text on mobile */
    }

    .header-logo {
        height: 200px; /* Make logo slightly smaller on mobile */
    }
}

/* Chat Interface Styles */
.chat-container {
    background: var(--card-dark);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    overflow: hidden;
    max-width: 800px;
    margin: 0 auto;
}

.chat-header {
    background: var(--gradient);
    padding: 1rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.chat-header i {
    font-size: 1.5rem;
    color: white;
}

.chat-header h3 {
    color: white;
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
}

.chat-messages {
    overflow-y: auto;
    padding: 1rem;
    background: var(--bg-dark);
}

.message {
    margin-bottom: 1rem;
    display: flex;
}

.user-message {
    justify-content: flex-end;
}

.bot-message {
    justify-content: flex-start;
}

.message-content {
    max-width: 70%;
    padding: 0.75rem 1rem;
    border-radius: 18px;
    word-wrap: break-word;
}

.user-message .message-content {
    background: var(--gradient);
    color: white;
    border-bottom-right-radius: 4px;
}

.bot-message .message-content {
    background: var(--card-dark);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-bottom-left-radius: 4px;
}

.message-content p {
    margin: 0;
    line-height: 1.4;
}

.chat-input-container {
    display: flex;
    padding: 1rem;
    background: var(--card-dark);
    border-top: 1px solid var(--border-color);
    gap: 0.75rem;
}

#chatInput {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 24px;
    background: var(--bg-dark);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.3s ease;
}

#chatInput:focus {
    border-color: var(--accent-primary);
}

#chatInput::placeholder {
    color: var(--text-secondary);
}

#sendButton {
    background: var(--gradient);
    border: none;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    color: white;
}

#sendButton:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(102, 126, 234, 0.3);
}

#sendButton:active {
    transform: translateY(0);
}

#sendButton:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Typing indicator */
.typing-indicator .message-content {
    background: var(--card-dark);
    border: 1px solid var(--border-color);
}

.typing-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--text-secondary);
    margin: 0 2px;
    animation: typing 1.5s infinite ease-in-out;
}

.typing-dot:nth-child(1) { animation-delay: 0s; }
.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing {
    0%, 60%, 100% {
        transform: scale(0.8);
        opacity: 0.5;
    }
    30% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Privacy Policy Styles */
.privacy-content {
    max-width: 800px;
    margin: 0 auto;
    background: var(--card-dark);
    padding: 2rem;
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.privacy-section {
    margin-bottom: 2rem;
}

.privacy-section h3 {
    color: var(--accent-primary);
    font-size: 1.25rem;
    margin-bottom: 1rem;
    font-weight: 600;
}

.privacy-section ul {
    margin-left: 1.5rem;
    margin-bottom: 1rem;
}

.privacy-section li {
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
}

.privacy-section p {
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.back-link {
    text-align: center;
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border-color);
}

.privacy-notice {
    background: rgba(102, 126, 234, 0.1);
    border: 1px solid var(--accent-primary);
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.privacy-notice a {
    color: var(--accent-primary);
    text-decoration: none;
}

.privacy-notice a:hover {
    text-decoration: underline;
}

/* Game Canvas Styles */
.ai-game-canvas, .gameoflife-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 12px;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    z-index: 1;
}

#ai-experiments-card, #gameoflife-card {
    position: relative;
    overflow: hidden;
}

#ai-experiments-card:hover .ai-game-canvas,
#gameoflife-card:hover .gameoflife-canvas {
    opacity: 1;
}

#ai-experiments-card .card-header,
#ai-experiments-card p,
#ai-experiments-card .button,
#gameoflife-card .card-header,
#gameoflife-card p,
#gameoflife-card .button {
    position: relative;
    z-index: 2;
}

/* Fullscreen Game of Life Background */
.gameoflife-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    opacity: 0.3;
    pointer-events: none;
    background: transparent;
}

/* Mobile responsiveness for chat */
@media (max-width: 768px) {
    .chat-messages {
        max-height: 300px;
    }

    .message-content {
        max-width: 85%;
    }

    .chat-input-container {
        padding: 0.75rem;
    }

    #chatInput {
        font-size: 16px; /* Prevents zoom on iOS */
    }

    .privacy-content {
        padding: 1.5rem;
    }
}

