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

body {
    font-family: 'Arial', sans-serif;
    background: #000;
    color: white;
    overflow-x: hidden;
    height: 100vh;
    position: relative;
}

#stars-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
}

.star {
    position: absolute;
    background: white;
    border-radius: 50%;
    animation: moveStars 80s linear infinite, twinkle 3s infinite ease-in-out;
}

.star:nth-child(odd) {
    animation-delay: -1s;
}

.star:nth-child(even) {
    animation-delay: -2s;
}

@keyframes moveStars {
    0% {
        transform: translate(-100vw, 50vh);
    }
    100% {
        transform: translate(200vw, -50vh);
    }
}

@keyframes twinkle {
    0%, 100% {
        opacity: 0.3;
    }
    50% {
        opacity: 1;
    }
}

/* Page Styles */
.page {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    min-height: 100%;
    height: auto;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s ease;
    z-index: 1;
    padding: 80px 20px 40px 20px;
    overflow-y: auto;
}

.page.active {
    opacity: 1;
    pointer-events: all;
}

/* Landing Page */
#landing-page {
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.button-container {
    display: flex;
    width: 100%;
    height: 100%;
    position: relative;
}

.half-button {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: background-color 0.3s ease;
    position: relative;
    overflow: hidden;
    background: transparent;
}

.half-button:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

.half-button:nth-child(1) {
    background: transparent;
}

.half-button:nth-child(2) {
    background: transparent;
}

.button-content {
    text-align: center;
    z-index: 2;
    position: relative;
}

.button-content h1 {
    font-size: clamp(2rem, 8vw, 4rem);
    font-weight: 300;
    line-height: 1.1;
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 2px;
}

/* Options Pages */
.back-button {
    position: absolute;
    top: 20px;
    left: 20px;
    cursor: pointer;
    font-size: 1.2rem;
    padding: 10px;
    border-radius: 5px;
    background: rgba(255, 255, 255, 0.1);
    transition: background-color 0.3s ease;
}

.back-button:hover {
    background: rgba(255, 255, 255, 0.2);
}

.page h1 {
    font-size: clamp(1.5rem, 5vw, 2.5rem);
    margin-bottom: 2rem;
    text-align: center;
    max-width: 800px;
}

.option-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
    max-width: 800px;
    width: 100%;
}

.option-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 1.5rem;
    font-size: 1.2rem;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
}

.option-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(255, 255, 255, 0.1);
}

/* Chat Container (ChatGPT Style) */
.chat-container {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 900px;
    height: calc(100vh - 200px);
    min-height: 500px;
    margin-top: 2rem;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    margin-bottom: 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* Chat Message Bubbles */
.chat-message {
    display: flex;
    gap: 0.75rem;
    animation: fadeIn 0.3s ease;
}

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

.chat-message.user {
    flex-direction: row-reverse;
}

.message-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    flex-shrink: 0;
}

.chat-message.user .message-avatar {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.chat-message.assistant .message-avatar {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
}

.message-content {
    max-width: 75%;
    padding: 1rem 1.25rem;
    border-radius: 18px;
    line-height: 1.6;
}

.chat-message.user .message-content {
    background: rgba(102, 126, 234, 0.2);
    border: 1px solid rgba(102, 126, 234, 0.3);
}

.chat-message.assistant .message-content {
    background: rgba(40, 167, 69, 0.15);
    border: 1px solid rgba(40, 167, 69, 0.3);
}

.message-content p {
    margin: 0 0 0.5rem 0;
}

.message-content p:last-child {
    margin-bottom: 0;
}

/* Loading indicator */
.typing-indicator {
    display: flex;
    gap: 0.5rem;
    padding: 1rem;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.6);
    animation: typing 1.4s infinite;
}

.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.6; }
    30% { transform: translateY(-10px); opacity: 1; }
}

/* Schedule Call Section */
.schedule-call-section {
    padding: 1rem;
    text-align: center;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

#schedule-call-btn,
#water-schedule-call-btn {
    padding: 0.75rem 2rem;
    background: linear-gradient(45deg, #28a745, #1e7e34);
    border: none;
    border-radius: 25px;
    color: white;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

#schedule-call-btn:hover,
#water-schedule-call-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(40, 167, 69, 0.3);
}

/* Chat Input Container */
.chat-input-container {
    display: flex;
    gap: 0.75rem;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

#user-query,
#water-user-query {
    flex: 1;
    padding: 0.875rem 1.25rem;
    font-size: 1rem;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 25px;
    color: white;
    outline: none;
    transition: all 0.3s ease;
}

#user-query:focus,
#water-user-query:focus {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.4);
}

#user-query::placeholder,
#water-user-query::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

#submit-query,
#submit-water-query {
    padding: 0.875rem 1.75rem;
    background: linear-gradient(45deg, #007bff, #0056b3);
    border: none;
    border-radius: 25px;
    color: white;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

#submit-query:hover,
#submit-water-query:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 123, 255, 0.4);
}

/* Markdown formatting in chat messages */
.message-content h1,
.message-content h2,
.message-content h3 {
    margin-top: 1rem;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.message-content h1 {
    font-size: 1.5rem;
}

.message-content h2 {
    font-size: 1.3rem;
}

.message-content h3 {
    font-size: 1.1rem;
}

.message-content h4 {
    font-size: 1rem;
    margin-top: 0.75rem;
    margin-bottom: 0.375rem;
}

.message-content ul,
.message-content ol {
    margin-left: 1.5rem;
    margin-bottom: 0.75rem;
}

.message-content li {
    margin-bottom: 0.375rem;
}

.message-content strong {
    font-weight: 700;
}

.message-content code {
    background: rgba(0, 0, 0, 0.3);
    padding: 0.15rem 0.35rem;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
}

.message-content pre {
    background: rgba(0, 0, 0, 0.3);
    padding: 0.75rem;
    border-radius: 5px;
    overflow-x: auto;
    margin: 0.75rem 0;
}

.message-content pre code {
    background: none;
    padding: 0;
}

.hidden {
    display: none !important;
}

/* Responsive Design */
@media (max-width: 768px) {
    .button-content h1 {
        font-size: clamp(1.5rem, 10vw, 3rem);
    }

    .button-container {
        flex-direction: column;
    }

    .half-button {
        min-height: 50vh;
    }

    .option-buttons {
        grid-template-columns: 1fr;
    }

    #text-input-container,
    #water-text-input-container {
        flex-direction: column;
        gap: 0.5rem;
    }

    #user-query,
    #water-user-query {
        width: 100%;
    }

    .page {
        padding: 60px 20px 20px;
    }
}
