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

body {
    font-family: Arial, Helvetica, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: 90vh;
}

header {
    background: linear-gradient(135deg, #002868 0%, #004ba0 100%);
    color: white;
    padding: 30px;
    text-align: center;
}

header h1 {
    font-size: 2rem;
    margin-bottom: 10px;
}

.subtitle {
    font-size: 1rem;
    opacity: 0.9;
}

.chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

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

.message {
    margin-bottom: 20px;
    animation: fadeIn 0.3s ease-in;
}

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

.message-content {
    padding: 15px 20px;
    border-radius: 8px;
    line-height: 1.6;
    max-width: 85%;
}

.user-message .message-content {
    background: #002868;
    color: white;
    margin-left: auto;
}

.bot-message .message-content {
    background: white;
    color: #333;
    border: 1px solid #e0e0e0;
}

.bot-message .message-content strong {
    color: #002868;
}

.input-container {
    padding: 20px;
    background: white;
    border-top: 1px solid #e0e0e0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.button-group {
    display: flex;
    gap: 10px;
}

#userInput {
    flex: 1;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 1rem;
    resize: none;
    transition: border-color 0.3s;
    width: 100%;
}

#userInput:focus {
    outline: none;
    border-color: #002868;
}

#sendButton {
    flex: 1;
    padding: 12px 30px;
    background: #002868;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.3s;
}

#clearButton {
    padding: 12px 20px;
    background: #e9ecef;
    color: #495057;
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.3s;
}

#clearButton:hover {
    background: #dee2e6;
}

#clearButton:active {
    background: #ced4da;
}

#sendButton:hover {
    background: #004ba0;
}

#sendButton:disabled, #clearButton:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.loading {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #002868;
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 0.3;
    }
    50% {
        opacity: 1;
    }
}

footer {
    padding: 15px;
    text-align: center;
    background: #f8f9fa;
    color: #666;
    font-size: 0.9rem;
    border-top: 1px solid #e0e0e0;
}

footer p {
    margin-bottom: 8px;
}

.back-link {
    color: #BF0A30;
    text-decoration: none;
    font-size: 0.9rem;
    padding: 6px 12px;
    border-radius: 6px;
    transition: background 0.3s;
    display: inline-block;
    font-weight: 500;
}

.back-link:hover {
    background: #e9ecef;
}

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

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

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

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

/* Responsive design */
@media (max-width: 768px) {
    .container {
        height: 95vh;
    }
    
    header h1 {
        font-size: 1.5rem;
    }
    
    .chat-messages {
        padding: 20px;
    }
    
    .message-content {
        max-width: 95%;
    }
}


.bot-message .message-content h3 {
    color: #002868;
    font-size: 1.1rem;
    margin: 15px 0 10px 0;
    font-weight: bold;
}

.bot-message .message-content h3:first-child {
    margin-top: 5px;
}


.bot-message .message-content h4 {
    color: #002868;
    font-size: 1rem;
    margin: 12px 0 8px 0;
    font-weight: bold;
}


.diagram-link {
    color: #002868;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s;
}

.diagram-link:hover {
    color: #004ba0;
    text-decoration: underline;
}
