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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 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;
}

header {
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    color: white;
    padding: 30px;
    text-align: center;
}

header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
}

header p {
    font-size: 1.1em;
    opacity: 0.9;
}

.chat-container {
    height: 500px;
    overflow-y: auto;
    padding: 20px;
    background: #f5f7fa;
}

.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: 12px;
    max-width: 85%;
    line-height: 1.6;
}

.message.user .message-content {
    background: #007bff;
    color: white;
    margin-left: auto;
    text-align: right;
}

.message.assistant .message-content {
    background: white;
    border: 1px solid #e1e8ed;
    margin-right: auto;
}

.message.assistant .message-content strong {
    color: #2c3e50;
    display: block;
    margin-bottom: 8px;
}

.message.assistant ul {
    margin: 10px 0;
    padding-left: 20px;
}

.message.assistant li {
    margin: 5px 0;
}

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

#questionInput {
    width: 100%;
    padding: 15px;
    border: 2px solid #e1e8ed;
    border-radius: 8px;
    font-size: 16px;
    font-family: inherit;
    resize: vertical;
    margin-bottom: 15px;
    transition: border-color 0.3s;
}

#questionInput:focus {
    outline: none;
    border-color: #007bff;
}

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

button {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.primary-button {
    background: #007bff;
    color: white;
    flex: 1;
}

.primary-button:hover {
    background: #0056b3;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,123,255,0.3);
}

.primary-button:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

.secondary-button {
    background: #6c757d;
    color: white;
}

.secondary-button:hover {
    background: #545b62;
}

.image-preview {
    position: relative;
    display: inline-block;
    margin-bottom: 15px;
    max-width: 200px;
}

.image-preview img {
    max-width: 200px;
    max-height: 150px;
    border-radius: 8px;
    border: 2px solid #007bff;
}

.remove-image-btn {
    position: absolute;
    top: -8px;
    right: -8px;
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    font-size: 12px;
    cursor: pointer;
    padding: 0;
}

.remove-image-btn:hover {
    background: #c82333;
}

.message.user .user-image {
    max-width: 200px;
    max-height: 150px;
    border-radius: 8px;
    margin-bottom: 10px;
    display: block;
}

.compatibility-checker {
    padding: 20px;
    background: #e8f4f8;
    border-top: 1px solid #b8d4e3;
}

.compatibility-checker h3 {
    color: #2c3e50;
    margin-bottom: 15px;
    font-size: 1.1em;
}

.compatibility-form {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.compatibility-form input {
    flex: 1;
    min-width: 200px;
    padding: 12px 15px;
    border: 2px solid #b8d4e3;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
}

.compatibility-form input:focus {
    outline: none;
    border-color: #007bff;
}

.compatibility-button {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    white-space: nowrap;
}

.compatibility-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(40,167,69,0.3);
}

.compatibility-button:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

.examples {
    padding: 20px;
    background: #f8f9fa;
    border-top: 1px solid #e1e8ed;
}

.examples h3 {
    color: #2c3e50;
    margin-bottom: 15px;
    font-size: 1.1em;
}

.example-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.example-btn {
    background: white;
    color: #007bff;
    border: 2px solid #007bff;
    padding: 10px 15px;
    font-size: 14px;
    font-weight: normal;
}

.example-btn:hover {
    background: #007bff;
    color: white;
}

footer {
    padding: 20px;
    background: #fff3cd;
    border-top: 3px solid #ffc107;
    text-align: center;
    color: #856404;
}

.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: 10px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.chat-container::-webkit-scrollbar {
    width: 8px;
}

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

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

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

@media (max-width: 768px) {
    body {
        padding: 0;
    }
    
    .container {
        border-radius: 0;
    }
    
    header h1 {
        font-size: 1.8em;
    }
    
    .chat-container {
        height: 400px;
    }
    
    .message-content {
        max-width: 90%;
    }
    
    .button-group {
        flex-direction: column;
    }
    
    .example-buttons {
        flex-direction: column;
    }
    
    .example-btn {
        width: 100%;
    }
}

.message-content code {
    background: rgba(0, 0, 0, 0.06);
    padding: 2px 5px;
    border-radius: 3px;
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 0.9em;
}

.message-content pre {
    background: #1e1e2e;
    color: #cdd6f4;
    padding: 12px 16px;
    border-radius: 6px;
    overflow-x: auto;
    margin: 8px 0;
}

.message-content pre code {
    background: none;
    padding: 0;
    color: inherit;
}

.message-content ul {
    margin: 8px 0;
    padding-left: 20px;
}

.message-content li {
    margin: 4px 0;
}

.message-content h3, .message-content h4 {
    margin: 12px 0 6px;
    color: #1e3c72;
}

.message-content strong {
    color: #1e3c72;
}
