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

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

.container {
    max-width: 900px;
    margin: 0 auto;
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 40px 30px;
    text-align: center;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    font-weight: 700;
}

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

section {
    padding: 30px;
    border-bottom: 1px solid #eaeaea;
}

section:last-of-type {
    border-bottom: none;
}

h2 {
    font-size: 1.5rem;
    margin-bottom: 20px;
    color: #4a5568;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* API 配置区域 */
.config-section {
    background: #f7fafc;
}

.config-form {
    display: grid;
    gap: 20px;
}

.form-group {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.form-group label {
    min-width: 120px;
    font-weight: 600;
    color: #4a5568;
}

.form-group input {
    flex: 1;
    min-width: 200px;
    padding: 12px 15px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s;
}

.form-group input:focus {
    outline: none;
    border-color: #667eea;
}

/* 按钮样式 */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.btn:active {
    transform: translateY(0);
}

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

.btn-secondary {
    background: #4a5568;
    color: white;
}

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

.btn-large {
    padding: 15px 40px;
    font-size: 1.1rem;
}

.btn-icon {
    background: #e53e3e;
    color: white;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

.btn-icon:hover {
    background: #c53030;
    transform: scale(1.1);
}

/* 上传区域 */
.upload-area {
    border: 3px dashed #cbd5e0;
    border-radius: 15px;
    padding: 60px 30px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    background: #f7fafc;
}

.upload-area:hover {
    border-color: #667eea;
    background: #edf2f7;
}

.upload-area.drag-over {
    border-color: #667eea;
    background: #e2e8f0;
    transform: scale(1.02);
}

.upload-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.upload-icon {
    font-size: 4rem;
}

.upload-text {
    font-size: 1.2rem;
    color: #4a5568;
    font-weight: 600;
}

.upload-hint {
    color: #718096;
    font-size: 0.95rem;
}

/* 预览区域 */
.preview-container {
    margin-top: 30px;
    background: #f7fafc;
    border-radius: 15px;
    padding: 20px;
}

.preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.preview-header h3 {
    color: #4a5568;
    font-size: 1.2rem;
}

.preview-image {
    max-width: 100%;
    max-height: 400px;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    display: block;
    margin: 0 auto 20px;
}

.preview-container .btn {
    width: 100%;
    justify-content: center;
}

/* 识别结果区域 */
.result-section {
    background: #f0fff4;
}

.result-content {
    background: white;
    border-radius: 10px;
    padding: 20px;
    border-left: 4px solid #48bb78;
}

.result-item {
    margin-bottom: 15px;
}

.result-label {
    font-weight: 600;
    color: #2d3748;
    margin-bottom: 5px;
}

.result-value {
    color: #4a5568;
    line-height: 1.6;
    background: #f7fafc;
    padding: 12px;
    border-radius: 6px;
}

.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 40px;
    color: #667eea;
    font-size: 1.1rem;
}

.spinner {
    width: 24px;
    height: 24px;
    border: 3px solid #e2e8f0;
    border-top-color: #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.error-message {
    background: #fff5f5;
    color: #c53030;
    padding: 15px;
    border-radius: 8px;
    border-left: 4px solid #f56565;
}

/* 历史记录区域 */
.history-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.history-count {
    color: #718096;
    font-size: 0.95rem;
}

.history-list {
    display: grid;
    gap: 15px;
}

.history-item {
    background: #f7fafc;
    border-radius: 10px;
    padding: 15px;
    display: flex;
    gap: 15px;
    cursor: pointer;
    transition: all 0.3s;
    border: 2px solid transparent;
}

.history-item:hover {
    background: #edf2f7;
    border-color: #667eea;
    transform: translateX(5px);
}

.history-thumbnail {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 8px;
    flex-shrink: 0;
}

.history-info {
    flex: 1;
    min-width: 0;
}

.history-title {
    font-weight: 600;
    color: #2d3748;
    margin-bottom: 5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.history-date {
    color: #718096;
    font-size: 0.85rem;
    margin-bottom: 8px;
}

.history-preview {
    color: #4a5568;
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.history-empty {
    text-align: center;
    padding: 40px;
    color: #a0aec0;
    font-size: 1.1rem;
}

footer {
    background: #f7fafc;
    padding: 20px;
    text-align: center;
    color: #718096;
    font-size: 0.9rem;
}

/* 响应式设计 */
@media (max-width: 600px) {
    body {
        padding: 10px;
    }

    header h1 {
        font-size: 1.8rem;
    }

    .form-group {
        flex-direction: column;
        align-items: flex-start;
    }

    .form-group label {
        margin-bottom: 5px;
    }

    .form-group input,
    .form-group .btn {
        width: 100%;
    }

    .history-controls {
        flex-direction: column;
        gap: 10px;
        align-items: flex-start;
    }

    .history-item {
        flex-direction: column;
    }

    .history-thumbnail {
        width: 100%;
        height: 150px;
    }
}
