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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
        'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
}

/* Header */
header {
    text-align: center;
    color: white;
    margin-bottom: 40px;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

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

/* Command Section */
.command-section {
    background: white;
    border-radius: 12px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.command-section h2 {
    color: #333;
    margin-bottom: 20px;
    font-size: 1.5rem;
}

.button-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}

.command-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 10px;
    padding: 25px 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    color: white;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 10px;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.command-btn:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.6);
}

.command-btn:active {
    transform: translateY(-2px);
}

.command-btn .icon {
    font-size: 2.5rem;
}

.command-btn .label {
    font-size: 1.2rem;
    font-weight: 600;
}

.command-btn .desc {
    font-size: 0.85rem;
    opacity: 0.9;
}

/* Chat Section */
.chat-section {
    background: white;
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.chat-section h2 {
    color: #333;
    margin-bottom: 20px;
    font-size: 1.5rem;
}

.chat-container {
    display: flex;
    flex-direction: column;
    height: 500px;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #f7f7f7;
    border-radius: 8px;
    margin-bottom: 20px;
}

.message {
    margin-bottom: 15px;
    padding: 15px;
    border-radius: 8px;
    animation: slideIn 0.3s ease;
}

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

.user-message {
    background: #667eea;
    color: white;
    margin-left: 20%;
}

.assistant-message {
    background: white;
    color: #333;
    margin-right: 20%;
    border: 1px solid #e0e0e0;
}

.system-message {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

.error-message {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.tool-summary-message {
    background: #f0f4ff;
    color: #4a5568;
    margin-right: 20%;
    border: 1px solid #d0d8f0;
    font-size: 0.85rem;
}

.tool-summary-header {
    font-weight: 600;
    color: #667eea;
    margin-bottom: 6px;
    font-size: 0.8rem;
}

.tool-summary-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.tool-summary-list li {
    padding: 2px 0;
    font-size: 0.8rem;
}

.message p {
    margin-bottom: 10px;
}

.message ul {
    margin-left: 20px;
}

.message li {
    margin-bottom: 5px;
}

.chat-input-container {
    display: flex;
    gap: 10px;
    align-items: flex-end;
}

#chatInput {
    flex: 1;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
    resize: none;
    transition: border-color 0.3s ease;
}

#chatInput:focus {
    outline: none;
    border-color: #667eea;
}

.send-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 12px 25px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
}

.send-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.send-btn .shortcut {
    font-size: 0.85rem;
    opacity: 0.8;
}

/* Attach image button */
.attach-btn {
    background: #f0f0f0;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    padding: 12px;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.attach-btn:hover {
    background: #e0e0e0;
    border-color: #667eea;
}

/* Image preview strip above input */
.image-preview-container {
    display: none;
    gap: 8px;
    padding: 8px;
    flex-wrap: wrap;
    background: #f9f9f9;
    border: 1px solid #e0e0e0;
    border-bottom: none;
    border-radius: 8px 8px 0 0;
}

.image-preview-item {
    position: relative;
    width: 80px;
    height: 80px;
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid #ddd;
}

.image-preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.image-preview-remove {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 20px;
    height: 20px;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.image-preview-remove:hover {
    background: rgba(220, 53, 69, 0.9);
}

/* Images in chat messages */
.chat-images {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 8px;
}

.chat-images img {
    max-width: 200px;
    max-height: 150px;
    border-radius: 6px;
    border: 1px solid #ddd;
    object-fit: cover;
    cursor: pointer;
}

.chat-images img:hover {
    opacity: 0.85;
}

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

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 12px;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.modal-header {
    padding: 20px;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    color: #333;
    font-size: 1.3rem;
}

.close-btn {
    background: none;
    border: none;
    font-size: 2rem;
    color: #999;
    cursor: pointer;
    line-height: 1;
    transition: color 0.3s ease;
}

.close-btn:hover {
    color: #333;
}

.modal-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

.question-group {
    margin-bottom: 25px;
}

.question-group label {
    display: block;
    color: #333;
    font-weight: 600;
    margin-bottom: 10px;
    font-size: 1rem;
}

.question-group input[type="text"],
.question-group textarea,
.question-group select {
    width: 100%;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.3s ease;
}

.question-group input:focus,
.question-group textarea:focus,
.question-group select:focus {
    outline: none;
    border-color: #667eea;
}

.question-group .options {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.option-btn {
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    background: white;
    cursor: pointer;
    text-align: left;
    transition: all 0.3s ease;
}

.option-btn:hover {
    border-color: #667eea;
    background: #f0f4ff;
}

.option-btn.selected {
    border-color: #667eea;
    background: #667eea;
    color: white;
}

.option-label {
    font-weight: 600;
    display: block;
    margin-bottom: 5px;
}

.option-desc {
    font-size: 0.9rem;
    opacity: 0.8;
}

.modal-footer {
    padding: 20px;
    border-top: 1px solid #e0e0e0;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.btn {
    padding: 12px 25px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: #e0e0e0;
    color: #333;
}

.btn-secondary:hover {
    background: #d0d0d0;
}

/* Loading Spinner */
.loading-spinner {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 20px;
}

.loading-spinner.active {
    display: flex;
}

.spinner {
    width: 60px;
    height: 60px;
    border: 5px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.loading-spinner p {
    color: white;
    font-size: 1.2rem;
    font-weight: 600;
}

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

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

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

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

/* Responsive Design */
@media (max-width: 768px) {
    header h1 {
        font-size: 2rem;
    }

    .button-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .chat-container {
        height: 400px;
    }

    .user-message {
        margin-left: 10%;
    }

    .assistant-message {
        margin-right: 10%;
    }
}
