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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: #f5f5f5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.chat-container {
    width: 100%;
    max-width: 800px;
    height: 90vh;
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    margin-bottom: 20px;
}

.chat-header {
    background: #667eea;
    color: white;
    padding: 24px;
    text-align: center;
}

.chat-header h1 {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 8px;
}

.chat-header p {
    font-size: 14px;
    opacity: 0.9;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #f8f9fa;
}

.message {
    margin-bottom: 20px;
    display: flex;
    align-items: flex-start;
}

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

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

.message-content {
    max-width: 70%;
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.5;
}

.message.user .message-content {
    background: #667eea;
    color: white;
    border-bottom-right-radius: 4px;
}

.message.assistant .message-content {
    background: white;
    color: #333;
    border: 1px solid #e1e5e9;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.message-content p {
    margin: 0;
}

.chat-input-container {
    padding: 20px;
    background: white;
    border-top: 1px solid #e1e5e9;
}

.input-wrapper {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    background: #f8f9fa;
    border: 1px solid #e1e5e9;
    border-radius: 24px;
    padding: 8px 16px;
    transition: border-color 0.2s ease;
}

.input-wrapper:focus-within {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.turnstile-container {
    margin: 5px 0;
    display: flex;
    justify-content: center;
    transform: scale(0.7);
    transform-origin: center;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.turnstile-container.hidden {
    opacity: 0;
    transform: scale(0.7) translateY(-10px);
    pointer-events: none;
}

.turnstile-container .cf-turnstile {
    display: inline-block;
}

#messageInput {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 14px;
    line-height: 1.5;
    resize: none;
    outline: none;
    font-family: inherit;
    padding: 8px 0;
    min-height: 20px;
    max-height: 120px;
}

#messageInput::placeholder {
    color: #999;
}

.send-button {
    background: #667eea;
    color: white;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.2s ease;
    flex-shrink: 0;
}

.send-button:hover {
    background: #5a6fd8;
}

.send-button:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.loading-indicator {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
    background: white;
    padding: 12px 20px;
    border-radius: 20px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1000;
}

.loading-indicator.hidden {
    display: none;
}

.typing-indicator {
    display: flex;
    gap: 4px;
    align-items: center;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #667eea;
    animation: typing 1.4s infinite ease-in-out;
}

.typing-indicator span:nth-child(1) {
    animation-delay: -0.32s;
}

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

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



/* Responsive design */
@media (max-width: 768px) {
    .chat-container {
        height: 100vh;
        margin: 0;
        border-radius: 0;
    }
    
    .message-content {
        max-width: 85%;
    }
    
    .chat-header {
        padding: 16px;
    }
    
    .chat-header h1 {
        font-size: 20px;
    }
}

/* Scrollbar styling */
.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Footer link styling */
.footer-link {
    text-align: center;
    margin-top: 20px;
    padding: 10px;
    position: relative;
    z-index: 1;
}

.footer-link a {
    color: #667eea;
    text-decoration: none;
    font-size: 12px;
    opacity: 0.8;
    transition: opacity 0.2s ease;
}

.footer-link a:hover {
    opacity: 1;
    text-decoration: underline;
}

/* Link styling within assistant messages */
.message.assistant .message-content a {
    color: #667eea;
    text-decoration: underline;
    transition: color 0.2s ease;
}

.message.assistant .message-content a:hover {
    color: #5a6fd8;
    text-decoration: none;
}

/* File upload styling */
.attach-button {
    background: none;
    border: none;
    color: #666;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 8px;
}

.attach-button:hover {
    background: #f0f0f0;
    color: #333;
}

.attach-button:active {
    transform: scale(0.95);
}

.file-preview {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 12px;
    margin-top: 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.file-preview.hidden {
    display: none;
}

.file-info {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
}

.file-info span {
    font-size: 14px;
    color: #495057;
    word-break: break-all;
}

.remove-file {
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: bold;
    transition: background-color 0.2s ease;
    flex-shrink: 0;
}

.remove-file:hover {
    background: #c82333;
}

/* File upload progress */
.upload-progress {
    width: 100%;
    height: 4px;
    background: #e9ecef;
    border-radius: 2px;
    overflow: hidden;
    margin-top: 8px;
}

.upload-progress-bar {
    height: 100%;
    background: #28a745;
    transition: width 0.3s ease;
    width: 0%;
}

/* File attachment in messages */
.message-attachment {
    margin-top: 8px;
    padding: 8px;
    background: #f8f9fa;
    border-radius: 6px;
    border: 1px solid #e9ecef;
}

.message-attachment a {
    color: #007bff;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 6px;
}

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

.message-attachment svg {
    width: 16px;
    height: 16px;
}

/* Error container styling */
.error-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
    color: #721c24;
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    border-radius: 8px;
    padding: 40px;
    margin: 20px;
}

.error-container h1 {
    font-size: 24px;
    margin-bottom: 16px;
    color: #721c24;
}

.error-container p {
    font-size: 16px;
    color: #721c24;
    opacity: 0.8;
}

/* Responsive design for footer */
@media (max-width: 768px) {
    .footer-link {
        margin-top: 15px;
        padding: 8px;
    }
    
    .footer-link a {
        font-size: 11px;
    }
} 