@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;700&display=swap');

html, body {
    height: 100%;
    overflow: hidden;
    margin: 0;
}

button, a {
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: #000;
    /* Combine background-image, size, and position for landscape/default */
    background-image: 
        linear-gradient(rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.5)), 
        url('/ainexus.webp');
    background-size: cover;
    background-position: center;
    /* Set default repeat to 'repeat' or 'no-repeat' here, or let the browser default. 
       Since 'background-size: cover' often prevents visible repetition anyway unless the viewport is very large,
       but we will explicitly control it for portrait. */
    
    color: #fff;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    /* You can set a default background-repeat here for all orientations if you need to be explicit. 
       If you want it to repeat on landscape, you would use:
       background-repeat: repeat; 
       Since you didn't specify a repeat value in the original code, the default is 'repeat'.
       Let's assume you want it to repeat on landscape (the default) and not repeat on portrait.
    */
}

/* Media Query for Portrait Orientation */
@media screen and (orientation: portrait) {
    body {
        /* This rule applies when the viewport height is greater than or equal to its width. */
        background-repeat: no-repeat;
    }
}

/* Optional: If you want to explicitly ensure it repeats on landscape, you can add this: */
@media screen and (orientation: landscape) {
    body {
        /* This is typically the default, but being explicit can sometimes help */
        background-repeat: repeat; 
    }
}

/* --- Main Chat Interface --- */
.chat-container {
    width: 95%;
    max-width: 800px;
    height: 90vh;
    background-color: #1a1a1a;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}


.chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    border-bottom: 1px solid #333;
    position: relative;
    padding-right: 176px;
    flex-wrap: wrap;
}

.chat-header h1 {
    font-weight: 500;
    font-size: 1.25rem;
    margin-bottom: 2px;
}

.chat-header .account-info p {
    font-size: 0.86rem;
    color: #bbb;
    margin: 0;
}

.header-buttons {
    position: absolute;
    top: 25px;
    right: 16px;
    display: flex;
    gap: 10px;
}

.button-action, .logout-button {
    background-color: transparent;
    border: 2px solid #4a67e2;
    color: #4a67e2;
    font-size: 0.9rem;
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.button-action:hover, .logout-button:hover {
    background-color: rgba(74, 103, 226, 0.1);
}

/* --- Token Top-up Section --- */
.topup-container {
    padding: 16px;
    background-color: #222;
    border-bottom: 1px solid #333;
    display: flex;
    flex-direction: column;
    gap: 10px;
    
     /* NEW: Centering properties */
    align-items: center; /* Centers children horizontally */
    justify-content: center; /* Centers children vertically */
}

.section-title {
    font-size: 1.3rem;
    font-weight: 500;
    margin: 0;
}

.topup-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.topup-content p {
    margin: 0;
}

.input-group {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 10px; /* This will add space below each input group */
}

.topup-input {
    width: 100px;
    padding: 8px 12px;
    border: none;
    background-color: #333;
    color: #fff;
    border-radius: 20px;
    outline: none;
    font-size: 0.9em;
    box-sizing: border-box;
}

.button-buy {
    background-color: #4CAF50;
    color: white;
    font-size: 0.85rem;
    padding: 8px 16px;
    border-radius: 20px;
    border: none;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.button-buy:hover {
    background-color: #45a049;
}

/* --- Chat Messages and Input --- */
.chat-messages {
    flex-grow: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* Scrollbar styling */
.chat-messages::-webkit-scrollbar { width: 8px; }
.chat-messages::-webkit-scrollbar-thumb { background-color: #444; border-radius: 4px; }
.chat-messages::-webkit-scrollbar-track { background: #1a1a1a; }

.message {
    padding: 12px 18px;
    border-radius: 24px;
    max-width: 75%;
    word-wrap: break-word;
    line-height: 1.6;
}

.user-message {
    background-color: #4a67e2;
    color: #fff;
    align-self: flex-end;
    font-size: 14px;
}

.bot-message {
    background-color: #19461A;
    color: #e8e8e8;
    align-self: flex-start;
    font-size: 14px;
}

.bot-message a {
  color: #ffffff; /* Sets the link color to white */
}
.intro-message {
    background-color: transparent;
    color: #aaa;
    align-self: center;
    text-align: center;
    font-size: 1.0em;
    padding: 10px;
}

.chat-input-container {
    display: flex;
    align-items: center;
    font-size: 0.9rem;
    padding: 16px;
    border-top: 1px solid #333;
    background-color: #1a1a1a;
    margin-bottom: 20px; /* Adjust the value as needed */

}

#userInput {
    flex-grow: 1;
    padding: 12px 20px;
    border: none;
    background-color: #333;
    color: #fff;
    border-radius: 20px;
    outline: none;
    font-size: 1em;
    box-sizing: border-box;
     /* --- ADDED FOR TEXT WRAPPING --- */
    min-height: 30px; /* Set a minimum height */
    height: auto; /* Allow the height to grow with content */
    resize: none; /* Prevents user from manually resizing the textarea */
    overflow-y: auto; /* Adds a scrollbar if content exceeds the height */
}

#userInput::placeholder {
    color: #888;
}

#sendBtn {
    margin-left: 10px;
    width: 48px;
    height: 48px;
    border: none;
    background-color: #4a67e2;
    color: #fff;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: background-color 0.2s ease;
}

#sendBtn:hover {
    background-color: #3b52a4;
}

#sendBtn svg {
    transform: rotate(90deg);
}

/* --- Authentication Section --- */
.auth-container, .register-container {
    width: 90%;
    max-width: 400px;
    background-color: #1a1a1a;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    color: #fff;
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: center;
    justify-content: center;
    text-align: center;
    max-height: 100vh;
    overflow-y: auto;
    box-sizing: border-box;
}

.auth-container h1,
.auth-container p,
.register-container h1,
.register-container p {
    /* Setting margin to 0 is the right first step to remove large defaults */
    margin: 0; 
    
    /* Optional: Also remove default padding, just in case */
    padding: 0; 
}

.auth-logo {
    display: block;
    width: 100px;
    margin-bottom: 5px;
}

.auth-input {
    max-width: 300px;
    width: 100%;
    padding: 12px 20px;
    border: 1px solid #333;
    background-color: #333;
    color: #fff;
    border-radius: 24px;
    outline: none;
    font-size: 1em;
    box-sizing: border-box;
}

.login-button {
    max-width: 200px;
    width: 100%;
    background-color: #4a67e2;
    color: #fff;
    font-size: 1rem;
    padding: 12px;
    border: none;
    border-radius: 24px;
    cursor: pointer;
    font-weight: 500;
    transition: background-color 0.2s ease;
    box-sizing: border-box;
}

.login-button:hover {
    background-color: #3b52a4;
}

.hidden {
    display: none;
}

.message-box, .error-box {
    margin-top: 15px;
    padding: 9px;
    font-size: 0.9rem;
    text-align: center;
    color: #fff;
}

.message-box {
    background-color: #57B164;
}

.error-box {
    background-color: #FF0000;
    border-radius:10px;
}


/* Styling for Predefined Questions */
.predefined-questions-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    padding: 16px;
    border-top: 1px solid #333;
    background-color: #1a1a1a;
    width: 100%;
    box-sizing: border-box;
}

.predefined-question {
    background-color: #3B52A4;
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    border: none;
    cursor: pointer;
    font-size: 0.9em;
    transition: background-color 0.2s ease;
}

.predefined-question:hover {
    background-color: #45a049;
}

/* Styling for the toggle button container */
.predefined-questions-toggle {
    display: flex;
    justify-content: center;
    font-size: 1.0em;
    padding: 16px;
    background-color: #1a1a1a;
    border-top: 1px solid #333;
}

/* Class to hide the questions container */
.hidden {
    display: none;
}

/* The container that defines the viewing area for the scrolling text */
#guestNameDisplay {
    width: 132px; /* Adjust the width as needed */
    height: 1.3rem; /* Match the font size to prevent overflow */
    overflow: hidden; /* This hides any text that goes beyond the width */
    white-space: nowrap; /* Ensures the text stays on one line */
    background-color: transparent; /* Makes the background clear */
    /* All other border, padding, and box-sizing properties are removed */
}

/* The inner element that contains the text and the animation */
#guestNameDisplay span {
    display: inline-block;
    animation: marquee 15s linear infinite;
}

/* Define the scrolling animation */
@keyframes marquee {
    0%   { transform: translate(100%, 0); } /* Start from off-screen right */
    100% { transform: translate(-100%, 0); } /* End off-screen left */
}


/* --- Suggestions Dropdown Styles --- */
.autocomplete-container {
    position: relative;
    /* Ensure it takes full width allowed by auth-container rules */
    width: 100%; 
    max-width: 300px; /* Matches your .auth-input max-width */
}

.suggestions-list {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #666;
    border: 1px solid #ddd;
    border-radius: 12px; /* Matches your theme's rounded look */
    max-height: 200px;
    overflow-y: auto;
    z-index: 1000;
    display: none; /* Hidden by default */
    box-shadow: 0 4px 6px rgba(0,0,0,0.3);
    
    /* Reset default list styles */
    margin: 5px 0 0 0;
    padding: 0;
    list-style: none;
}

.suggestions-list li {
    padding: 12px 20px;
    cursor: pointer;
    border-bottom: 1px solid #eee;
    color: #fff; /* Dark text for readability on white background */
    font-size: 0.9rem;
    text-align: left;
}

.suggestions-list li:last-child {
    border-bottom: none;
}

.suggestions-list li:hover {
    background-color: #f0f0f0;
    color: #000;
}