/* common.css */

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans", sans-serif;
    color: #333;
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    height: 100vh;
    margin: 0;
}

/* Navigation Bar */
.nav-bar {
    background: #007bff; /* chat.html color */
    color: white;
    padding: 8px 16px;
    display: flex;
    align-items: center;
    gap: 20px;
}

.nav-title {
    font-size: 18px;
    font-weight: 600;
    margin: 0;
}

.nav-switch {
    display: flex;
    align-items: center;
    gap: 8px;
    color: rgba(255,255,255,0.9);
    font-size: 14px;
}

.nav-switch-btn {
    background: rgba(255,255,255,0.2);
    border: 1px solid rgba(255,255,255,0.3);
    color: white;
    padding: 6px 12px;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
}

.nav-switch-btn:hover {
    background: rgba(255,255,255,0.3);
    border-color: rgba(255,255,255,0.5);
    transform: translateY(-1px);
}

/* Config Panel - General Styles */
.config-panel {
    background: white;
    border-bottom: 1px solid #e5e5e5;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    flex-shrink: 0;
}

.config-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    cursor: pointer;
    user-select: none;
}

.config-title {
    font-weight: 600;
    color: #333;
}

.toggle-icon {
    transition: transform 0.2s ease;
}

.toggle-icon.collapsed {
    transform: rotate(-90deg);
}

.config-content {
    padding: 0 16px 16px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    border-top: 1px solid #f0f0f0;
}

.config-content.collapsed {
    display: none;
}

/* Form Elements */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 15px; /* Added from imageeditor.html */
}

.form-group.full-width {
    grid-column: 1 / -1;
}

.form-label {
    font-size: 14px;
    font-weight: 500;
    color: #666;
    display: block; /* from imageeditor.html */
    margin-bottom: 8px; /* from imageeditor.html */
    font-weight: 600; /* from imageeditor.html, stronger than chat.html */
    color: #2c3e50; /* from imageeditor.html, darker */
    font-size: 1rem; /* from imageeditor.html, slightly larger */
}

.form-input {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.2s ease;
    width: 100%; /* from imageeditor.html */
    border: 2px solid #e9ecef; /* from imageeditor.html */
    border-radius: 10px; /* from imageeditor.html */
    font-family: inherit;
}

.form-input:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
    border-color: #667eea; /* from imageeditor.html */
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1); /* from imageeditor.html */
}

/* Model Dropdown Styles */
.model-input-container {
    position: relative;
    width: 100%;
}

.model-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #ddd;
    border-top: none;
    border-radius: 0 0 6px 6px;
    max-height: 200px;
    overflow-y: auto;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: none;
}

.model-dropdown.show {
    display: block;
}

.model-option {
    padding: 8px 12px;
    cursor: pointer;
    transition: background-color 0.2s ease;
    font-size: 14px;
    border-bottom: 1px solid #f0f0f0;
}

.model-option:last-child {
    border-bottom: none;
}

.model-option:hover {
    background-color: #f8f9fa;
}

/* Buttons */
.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 500;
}

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

.btn-primary:hover {
    background: #0056b3;
}

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

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

.btn-danger {
    background: #dc3545;
    color: white;
}

.btn-danger:hover {
    background: #c82333;
}

@media (prefers-color-scheme: dark) {
    body {
        background: #1a1a1a;
        color: #e0e0e0;
    }
    
    .config-panel,
    .chat-input {
        background: #2d2d2d;
        border-color: #404040;
    }
    
    .config-content {
        border-color: #404040;
    }
    
    .form-input,
    .input-text {
        background: #3d3d3d;
        border-color: #555;
        color: #e0e0e0;
    }
    
    .form-input:focus,
    .input-text:focus {
        border-color: #007bff;
    }
    
    .message-content {
        background: #3d3d3d;
        color: #e0e0e0;
    }
    
    .message.user .message-content {
        background: #007bff;
    }
    
    .model-dropdown {
        background: #3d3d3d;
        border-color: #555;
    }
    
    .model-option:hover {
        background: #4d4d4d;
    }
    
    .action-btn {
        background: rgba(255,255,255,0.1);
        color: #e0e0e0;
    }
    
    .action-btn:hover {
        background: rgba(255,255,255,0.2);
    }
}

/* Toast 提示样式 */
.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #333;
    color: white;
    padding: 12px 16px;
    border-radius: 6px;
    font-size: 14px;
    opacity: 0;
    transform: translateX(100%);
    transition: all 0.3s ease;
    z-index: 9999;
    max-width: 300px;
    word-break: break-word;
}

.toast.show {
    opacity: 1;
    transform: translateX(0);
}

.toast.success {
    background: #28a745;
}

.toast.error {
    background: #dc3545;
}

.toast.warning {
    background: #ffc107;
    color: #333;
}

/* 配置按钮组样式 */
.action-buttons {
    display: flex;
    gap: 12px;
    grid-column: 1 / -1;
    justify-content: flex-start;
    margin-top: 8px;
}

.error-hint {
    font-size: 12px;
    color: #dc3545;
    margin-top: 4px;
}

.error-hint a {
    color: #007bff;
    text-decoration: none;
}

.error-hint a:hover {
    text-decoration: underline;
}