/* Main Styles */
:root {
    --primary-color: #2e7d32;
    --primary-light: #60ad5e;
    --primary-dark: #005005;
    --secondary-color: #f5f5f5;
    --text-color: #333;
    --text-light: #666;
    --white: #fff;
    --shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    --border-radius: 8px;
    --typing-indicator-color: #e0e0e0;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background-color: #f9f9f9;
    color: var(--text-color);
    line-height: 1.6;
}

/* Chat Container */
.chat-container {
    max-width: 800px;
    margin: 2rem auto;
    background: var(--white);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: 80vh;
}

/* Chat Header */
.chat-header {
    background-color: var(--primary-color);
    color: white;
    padding: 1rem;
    text-align: center;
}

.chat-header h1 {
    font-size: 1.5rem;
    margin: 0;
}

/* Chat Messages */
.chat-messages {
    flex: 1;
    padding: 1.5rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.message {
    max-width: 80%;
    padding: 0.8rem 1.2rem;
    border-radius: 1rem;
    line-height: 1.5;
    position: relative;
    word-wrap: break-word;
}

.message a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
    word-break: break-all;
}

.message a:hover {
    text-decoration: underline;
}

.message.user {
    align-self: flex-end;
    background-color: var(--primary-light);
    color: white;
    border-bottom-right-radius: 0.3rem;
}

.message.assistant {
    align-self: flex-start;
    background-color: var(--secondary-color);
    color: var(--text-color);
    border-bottom-left-radius: 0.3rem;
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    align-items: center;
    padding: 10px 15px;
    background-color: var(--secondary-color);
    border-radius: 18px;
    width: fit-content;
    margin: 5px 0;
    align-self: flex-start;
}

.typing-dot {
    width: 8px;
    height: 8px;
    background-color: var(--typing-indicator-color);
    border-radius: 50%;
    margin: 0 2px;
    animation: typing 1.4s 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: translateY(0); }
    30% { transform: translateY(-5px); }
}

/* Chat Input */
.chat-input {
    display: flex;
    padding: 1rem;
    background-color: #f5f5f5;
    border-top: 1px solid #e0e0e0;
    position: relative;
}

.chat-input input[type="text"] {
    flex: 1;
    padding: 0.8rem 1rem;
    border: 1px solid #ddd;
    border-radius: 2rem;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.3s;
}

.chat-input input[type="text"]:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(46, 125, 50, 0.2);
}

.chat-input button {
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 2rem;
    padding: 0 1.5rem;
    margin-left: 0.5rem;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 80px;
}

.chat-input button:disabled {
    background-color: #cccccc;
    cursor: not-allowed;
    opacity: 0.7;
    position: relative;
    padding-left: 2.5rem;
}

.chat-input .button-spinner {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: button-spin 1s ease-in-out infinite;
    display: inline-block;
    margin-right: 0.5rem;
}

@keyframes button-spin {
    to { transform: translateY(-50%) rotate(360deg); }
}

.chat-input button:hover {
    background-color: var(--primary-dark);
}

/* Redirect Page */
.redirect-container {
    max-width: 600px;
    margin: 5rem auto;
    padding: 2rem;
    text-align: center;
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
}

.redirect-container h2 {
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.redirect-container p {
    margin-bottom: 2rem;
    color: var(--text-light);
}

.redirect-container a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
}

.redirect-container a:hover {
    text-decoration: underline;
}

/* Spinner Animation */
.spinner {
    width: 40px;
    height: 40px;
    margin: 2rem auto;
    border: 4px solid rgba(46, 125, 50, 0.2);
    border-radius: 50%;
    border-top-color: var(--primary-color);
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Responsive Design */
@media (max-width: 768px) {
    .chat-container {
        margin: 0;
        height: 90vh;
        border-radius: 0;
    }
    
    .message {
        max-width: 90%;
    }
    
    .chat-input {
        padding: 0.8rem;
    }
    
    .chat-input input[type="text"] {
        padding: 0.6rem 1rem;
    }
}
