/* Using the same color variables as previous pages */
:root {
    --background-black: #0A0A0C;
    --panel-background: #1C1C1E;
    --text-color-primary: #FFFFFF;
    --text-color-secondary: #AEAEB2;
    --border-color: #3A3A3C;
    --gradient-purple: #5856d6; /* Indigo/Purple */
    --gradient-blue: #007AFF; /* Blue */
    --button-primary: #007AFF;
    --button-secondary: #3A3A3C;
    --button-text: #FFFFFF;
    --user-message-bubble: #007AFF; /* Blue for user messages */
    --ai-message-bubble: #3A3A3C; /* Dark grey for AI messages */
}

body {
    margin: 0;
    font-family: 'Inter', sans-serif;
    background-color: var(--background-black);
    color: var(--text-color-primary);
    min-height: 100vh;
    position: relative;
    padding-bottom: 50px;
    overflow-x: hidden;
}

.background-gradient {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at top left, var(--gradient-purple) 0%, transparent 25%),
                radial-gradient(circle at bottom right, var(--gradient-blue) 0%, transparent 25%);
    opacity: 0.15;
    z-index: -1;
}

.container {
    max-width: 900px; /* Container width for the chatbot */
    margin: 0 auto;
    padding: 20px;
    position: relative;
    z-index: 5;
    display: flex;
    flex-direction: column;
    min-height: calc(100vh - 100px); /* Adjust height considering header/padding */
}

header {
    padding: 20px;
    display: flex;
    justify-content: flex-end;
    position: relative;
    z-index: 10;
}

.header-content {
    display: flex;
    align-items: center;
}

.clock {
    font-size: 1rem;
    color: var(--text-color-secondary);
    background-color: rgba(28, 28, 30, 0.6);
    padding: 8px 15px;
    border-radius: 20px;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.chatbot-app-container {
    background-color: var(--panel-background);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    flex-grow: 1; /* Allow chatbot container to fill available space */
}

.chatbot-app-container h1 {
    font-size: 2.5em;
    font-weight: 700;
    text-align: center;
    margin-top: 0;
    margin-bottom: 10px;
}

.chatbot-app-container p {
    font-size: 1.1em;
    color: var(--text-color-secondary);
    text-align: center;
    margin-bottom: 20px;
}

.chat-window {
    flex-grow: 1; /* Allow chat window to take available space */
    display: flex;
    flex-direction: column;
    justify-content: flex-end; /* Keep messages at the bottom */
    overflow: hidden; /* Hide scrollbar for aesthetic, but allow scrolling */
    position: relative; /* Needed for chat box height */
}

.chat-box {
    flex-grow: 1; /* Allow chat box to take available space */
    overflow-y: auto; /* Enable vertical scrolling */
    padding-right: 10px; /* Add padding for scrollbar space */
    display: flex;
    flex-direction: column;
    gap: 15px; /* Space between messages */
    padding-bottom: 20px; /* Padding at the bottom */
    /* Hide scrollbar for aesthetic purposes (optional) */
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none;  /* Internet Explorer 10+ */
}

.chat-box::-webkit-scrollbar {
    display: none; /* Safari and Chrome */
}

.message {
    display: flex;
    max-width: 80%; /* Limit message bubble width */
    animation: fadeIn 0.3s ease-out;
}

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


.user-message {
    justify-content: flex-end; /* Align user messages to the right */
    margin-left: auto; /* Push user messages to the right */
}

.ai-message {
    justify-content: flex-start; /* Align AI messages to the left */
    margin-right: auto; /* Keep AI messages on the left */
}

.message-bubble {
    padding: 12px 18px;
    border-radius: 20px; /* Pill shape bubbles */
    font-size: 1em;
    word-break: break-word; /* Break long words */
}

.user-message .message-bubble {
    background-color: var(--user-message-bubble);
    color: var(--text-color-primary);
    border-bottom-right-radius: 5px; /* Pointy corner for user */
}

.ai-message .message-bubble {
    background-color: var(--ai-message-bubble);
    color: var(--text-color-primary);
    border-bottom-left-radius: 5px; /* Pointy corner for AI */
}

.chat-input-area {
    display: flex;
    align-items: center;
    gap: 10px;
    padding-top: 15px;
    border-top: 1px solid var(--border-color); /* Separator line */
    margin-top: 15px;
}

.chat-input-area textarea {
    flex-grow: 1; /* Allow textarea to take available space */
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 20px; /* Rounded input */
    background-color: #2C2C2E;
    color: var(--text-color-primary);
    font-size: 1em;
    box-sizing: border-box;
    resize: none; /* Disable resize handle */
    min-height: 40px; /* Minimum height */
    max-height: 150px; /* Maximum height before scrolling */
    overflow-y: auto; /* Add scrollbar if text exceeds max height */
    scrollbar-width: none; /* Hide scrollbar */
    -ms-overflow-style: none;
}

.chat-input-area textarea::-webkit-scrollbar {
    display: none;
}

.chat-input-area textarea::placeholder {
    color: var(--text-color-secondary);
    opacity: 0.7;
}


.action-button {
    border: none;
    border-radius: 8px;
    padding: 15px 30px;
    font-size: 1.1em;
    cursor: pointer;
    transition: background-color 0.2s ease-in-out, transform 0.1s ease-in-out;
    color: var(--button-text);
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.action-button.primary {
    background-color: var(--button-primary);
}

.action-button.primary:hover {
    background-color: #0056b3;
}

.action-button.secondary {
    background-color: var(--button-secondary);
}

.action-button.secondary:hover {
     background-color: #4A4A4C;
}

.action-button.small {
    padding: 8px 12px;
    font-size: 0.9em;
    border-radius: 20px; /* Match input roundedness */
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .container {
        padding: 15px;
        min-height: calc(100vh - 80px);
    }

    header {
        padding: 15px;
    }

    .clock {
        font-size: 0.9rem;
        padding: 6px 12px;
    }

    .chatbot-app-container {
        padding: 15px;
    }

    .chatbot-app-container h1 {
        font-size: 2em;
    }

    .chatbot-app-container p {
        font-size: 1em;
        margin-bottom: 15px;
    }

    .chat-box {
        gap: 10px; /* Reduce space between messages */
        padding-right: 5px; /* Adjust padding */
        padding-bottom: 15px;
    }

    .message {
        max-width: 85%; /* Allow messages to be slightly wider */
    }

    .message-bubble {
        padding: 10px 15px; /* Reduce bubble padding */
        font-size: 0.9em;
        border-radius: 15px; /* Adjust bubble roundedness */
    }

     .user-message .message-bubble {
         border-bottom-right-radius: 4px; /* Adjust pointy corner */
     }

     .ai-message .message-bubble {
         border-bottom-left-radius: 4px; /* Adjust pointy corner */
     }


    .chat-input-area {
        gap: 8px; /* Reduce gap */
        padding-top: 10px;
        margin-top: 10px;
    }

    .chat-input-area textarea {
        padding: 10px;
        font-size: 0.9em;
        border-radius: 15px; /* Adjust input roundedness */
    }

    .action-button.small {
        padding: 6px 10px; /* Reduce button padding */
        font-size: 0.8em;
        border-radius: 15px; /* Adjust button roundedness */
    }
}
