* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #f38020;
    --secondary-color: #ff6b35;
    --bg-color: #f5f5f5;
    --card-bg: #ffffff;
    --text-color: #333333;
    --text-light: #666666;
    --border-color: #e0e0e0;
    --user-message-bg: #f38020;
    --bot-message-bg: #f0f0f0;
    --shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    color: var(--text-color);
}

.container {
    width: 100%;
    max-width: 800px;
    background: var(--card-bg);
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: 90vh;
    max-height: 800px;
}

header {
    background: linear-gradient(135deg, #f38020 0%, #ff6b35 100%);
    color: white;
    padding: 25px 30px;
    text-align: center;
}

header h1 {
    font-size: 28px;
    margin-bottom: 5px;
    font-weight: 700;
}

.subtitle {
    font-size: 14px;
    opacity: 0.95;
    font-weight: 400;
}

.chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    scroll-behavior: smooth;
}

.message {
    margin-bottom: 20px;
    display: flex;
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message-content {
    max-width: 75%;
    padding: 12px 18px;
    border-radius: 18px;
    line-height: 1.5;
    word-wrap: break-word;
}

.user-message {
    justify-content: flex-end;
}

.user-message .message-content {
    background: var(--user-message-bg);
    color: white;
    border-bottom-right-radius: 4px;
}

.bot-message {
    justify-content: flex-start;
}

.bot-message .message-content {
    background: var(--bot-message-bg);
    color: var(--text-color);
    border-bottom-left-radius: 4px;
}

.message-content ul {
    margin: 10px 0;
    padding-left: 20px;
}

.message-content li {
    margin: 5px 0;
}

.message-content strong {
    font-weight: 600;
}

.message-content pre {
    background: rgba(0, 0, 0, 0.05);
    padding: 10px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 10px 0;
    font-size: 13px;
}

.typing-indicator {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 12px 18px;
}

.typing-dot {
    width: 8px;
    height: 8px;
    background: var(--text-light);
    border-radius: 50%;
    animation: typing 1.4s infinite;
}

.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);
        opacity: 0.5;
    }
    30% {
        transform: translateY(-10px);
        opacity: 1;
    }
}

.flashcard-status {
    background: #fff3cd;
    border-top: 2px solid #ffc107;
    padding: 12px 20px;
    font-size: 14px;
    color: #856404;
    font-weight: 500;
}

.status-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.chat-input-container {
    display: flex;
    gap: 10px;
    padding: 20px;
    background: var(--card-bg);
    border-top: 1px solid var(--border-color);
}

#message-input {
    flex: 1;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 12px 16px;
    font-size: 15px;
    font-family: inherit;
    resize: none;
    outline: none;
    transition: border-color 0.3s;
    max-height: 120px;
    min-height: 44px;
}

#message-input:focus {
    border-color: var(--primary-color);
}

#send-button {
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 12px;
    width: 50px;
    height: 50px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    flex-shrink: 0;
}

#send-button:hover {
    background: var(--secondary-color);
    transform: scale(1.05);
}

#send-button:active {
    transform: scale(0.95);
}

#send-button:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

footer {
    background: var(--bg-color);
    padding: 15px;
    text-align: center;
    font-size: 12px;
    color: var(--text-light);
    border-top: 1px solid var(--border-color);
}

/* Scrollbar Styling */
.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: #999;
}

/* Responsive Design */
@media (max-width: 600px) {
    .container {
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
    }

    header h1 {
        font-size: 24px;
    }

    .message-content {
        max-width: 85%;
    }

    .chat-input-container {
        padding: 15px;
    }
}
