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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f5f5f5;
    height: 100vh;
    overflow: hidden;
}

.container {
    display: flex;
    height: 100vh;
}

/* Gallery Sidebar */
.gallery-sidebar {
    width: 320px;
    background: white;
    border-right: 1px solid #e0e0e0;
    display: flex;
    flex-direction: column;
}

.gallery-sidebar h2 {
    padding: 20px;
    background: #2c3e50;
    color: white;
    font-size: 1.3em;
}

.search-box {
    padding: 15px;
    border-bottom: 1px solid #e0e0e0;
}

.search-box input {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
}

.artwork-list {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
}

.artwork-item {
    padding: 15px;
    margin-bottom: 10px;
    background: #f9f9f9;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    border: 2px solid transparent;
}

.artwork-item:hover {
    background: #e8f4f8;
    transform: translateX(5px);
}

.artwork-item.selected {
    background: #d4edda;
    border-color: #28a745;
}

.artwork-item h4 {
    font-size: 1em;
    color: #2c3e50;
    margin-bottom: 5px;
}

.artwork-item p {
    font-size: 0.85em;
    color: #666;
}

/* Chat Container */
.chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: white;
}

.chat-header {
    padding: 20px;
    background: #34495e;
    color: white;
    border-bottom: 2px solid #2c3e50;
}

.current-artwork {
    font-size: 1.1em;
    font-weight: 500;
}

.no-selection {
    color: #bdc3c7;
    font-style: italic;
}

/* Artwork Display */
.artwork-display {
    padding: 20px;
    background: #f8f9fa;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    gap: 20px;
    align-items: center;
}

.artwork-display.hidden {
    display: none;
}

.artwork-display img {
    max-width: 200px;
    max-height: 150px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.artwork-info h3 {
    color: #2c3e50;
    margin-bottom: 5px;
}

.artwork-info p {
    color: #666;
    font-size: 0.9em;
    margin: 3px 0;
}

/* Chat Messages */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #fafafa;
}

.welcome-message {
    text-align: center;
    padding: 40px 20px;
    color: #7f8c8d;
}

.welcome-message h3 {
    color: #34495e;
    margin-bottom: 15px;
}

.message {
    margin-bottom: 15px;
    display: flex;
    gap: 10px;
}

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

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

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

.message.assistant .message-content {
    background: white;
    color: #2c3e50;
    border: 1px solid #e0e0e0;
    border-bottom-left-radius: 4px;
}

.message.system .message-content {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
    max-width: 100%;
    text-align: center;
}

.message.error .message-content {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
    max-width: 100%;
}

.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    width: fit-content;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    background: #95a5a6;
    border-radius: 50%;
    animation: typing 1.4s infinite;
}

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

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

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.5;
    }
    30% {
        transform: translateY(-10px);
        opacity: 1;
    }
}

/* Input Area */
.input-area {
    padding: 20px;
    background: white;
    border-top: 1px solid #e0e0e0;
    display: flex;
    gap: 10px;
}

.input-area input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid #ddd;
    border-radius: 24px;
    font-size: 14px;
    outline: none;
}

.input-area input:focus {
    border-color: #007bff;
}

.input-area input:disabled {
    background: #f5f5f5;
    cursor: not-allowed;
}

.input-area button {
    padding: 12px 24px;
    background: #007bff;
    color: white;
    border: none;
    border-radius: 24px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: background 0.2s;
}

.input-area button:hover:not(:disabled) {
    background: #0056b3;
}

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

/* Settings Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 12px;
    max-width: 500px;
    width: 90%;
}

.modal-content h3 {
    margin-bottom: 15px;
    color: #2c3e50;
}

.modal-content p {
    margin-bottom: 15px;
    color: #666;
}

.modal-content input {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 5px;
    margin-bottom: 15px;
    font-size: 14px;
}

.modal-buttons {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.modal-buttons button {
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
}

#saveApiKey {
    background: #28a745;
    color: white;
}

#saveApiKey:hover {
    background: #218838;
}

#cancelSettings {
    background: #6c757d;
    color: white;
}

#cancelSettings:hover {
    background: #5a6268;
}

.help-text {
    font-size: 0.85em;
    color: #666;
    margin-top: 15px;
}

.help-text a {
    color: #007bff;
}

/* Settings Button */
.settings-button {
    position: fixed;
    bottom: 100px;
    right: 30px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: #007bff;
    color: white;
    border: none;
    font-size: 20px;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    transition: all 0.2s;
    z-index: 100;
}

.settings-button:hover {
    background: #0056b3;
    transform: scale(1.1);
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

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

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

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        flex-direction: column;
    }
    
    .gallery-sidebar {
        width: 100%;
        height: 200px;
    }
    
    .artwork-list {
        display: flex;
        gap: 10px;
        overflow-x: auto;
        overflow-y: hidden;
    }
    
    .artwork-item {
        min-width: 200px;
    }
    
    .artwork-display {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .message-content {
        max-width: 85%;
    }
}
