* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #333;
    line-height: 1.6;
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    overflow: hidden;
}

header {
    background: linear-gradient(135deg, #2c3e50, #34495e);
    color: white;
    padding: 30px 20px;
    text-align: center;
}

header h1 {
    font-size: 2.2rem;
    margin-bottom: 10px;
}

header p {
    opacity: 0.9;
    font-size: 1.1rem;
}

/* 标签页样式 */
.tabs {
    display: flex;
    background: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
}

.tab-button {
    flex: 1;
    padding: 15px;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    transition: all 0.3s ease;
    border-bottom: 3px solid transparent;
}

.tab-button.active {
    background: white;
    border-bottom-color: #3498db;
    color: #3498db;
}

.tab-button:hover:not(.active) {
    background: #e9ecef;
}

.tab-content {
    display: none;
    padding: 20px;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* 扫描区域样式 */
.scanner-section {
    text-align: center;
    margin-bottom: 20px;
}

#reader {
    width: 100%;
    max-width: 400px;
    height: 300px;
    margin: 0 auto 20px;
    border: 2px dashed #ddd;
    border-radius: 10px;
    overflow: hidden;
    background: #f8f9fa;
    position: relative;
}

.scanner-controls {
    margin-bottom: 15px;
}

.scanner-status {
    padding: 10px;
    border-radius: 5px;
    background: #e3f2fd;
    color: #1976d2;
    font-weight: 500;
}

/* 按钮样式 */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    transition: all 0.3s ease;
    margin: 5px;
}

.btn-primary {
    background: #3498db;
    color: white;
}

.btn-primary:hover {
    background: #2980b9;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(52, 152, 219, 0.3);
}

.btn-secondary {
    background: #95a5a6;
    color: white;
}

.btn-secondary:hover {
    background: #7f8c8d;
    transform: translateY(-2px);
}

.btn:disabled {
    background: #bdc3c7;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* 表单样式 */
.form-group {
    margin-bottom: 15px;
    text-align: left;
}

label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #2c3e50;
}

input, textarea {
    width: 100%;
    padding: 12px;
    border: 2px solid #e9ecef;
    border-radius: 6px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

input:focus, textarea:focus {
    outline: none;
    border-color: #3498db;
}

.search-form, .book-form {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 20px;
}

/* 结果区域样式 */
.result-section {
    background: white;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.result-section h3 {
    margin-bottom: 15px;
    color: #2c3e50;
    border-bottom: 2px solid #3498db;
    padding-bottom: 10px;
}

.result-content {
    min-height: 100px;
}

.placeholder {
    color: #7f8c8d;
    font-style: italic;
    text-align: center;
    padding: 40px 20px;
}

/* 图书信息卡片 */
.book-card {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 15px;
    border-left: 4px solid #3498db;
}

.book-card h4 {
    color: #2c3e50;
    margin-bottom: 10px;
}

.book-info {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 10px;
    margin-bottom: 15px;
}

.info-item {
    display: flex;
    justify-content: space-between;
    padding: 5px 0;
    border-bottom: 1px solid #e9ecef;
}

.info-label {
    font-weight: 500;
    color: #7f8c8d;
}

.info-value {
    color: #2c3e50;
}

.borrow-history {
    margin-top: 15px;
}

.borrow-record {
    background: white;
    padding: 10px;
    border-radius: 5px;
    margin-bottom: 8px;
    border-left: 3px solid #e74c3c;
}

.borrow-record.returned {
    border-left-color: #27ae60;
}

/* 统计卡片 */
.stats-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
    padding: 25px;
    border-radius: 10px;
    text-align: center;
    box-shadow: 0 5px 15px rgba(52, 152, 219, 0.3);
}

.stat-card h3 {
    font-size: 1rem;
    margin-bottom: 10px;
    opacity: 0.9;
}

.stat-number {
    font-size: 2.5rem;
    font-weight: bold;
}

/* 加载动画 */
.loading {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    color: white;
}

.loading.hidden {
    display: none;
}

.spinner {
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top: 4px solid white;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin-bottom: 15px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 响应式设计 */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }
    
    .container {
        border-radius: 10px;
    }
    
    header h1 {
        font-size: 1.8rem;
    }
    
    .tabs {
        flex-direction: column;
    }
    
    .tab-button {
        padding: 12px;
    }
    
    #reader {
        height: 250px;
    }
    
    .stats-cards {
        grid-template-columns: 1fr;
    }
    
    .book-info {
        grid-template-columns: 1fr;
    }
}

/* 成功/错误消息 */
.message {
    padding: 12px;
    border-radius: 5px;
    margin: 10px 0;
    text-align: center;
    font-weight: 500;
}

.message.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.message.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* 热门图书列表 */
.popular-books {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 10px;
}

.popular-book-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background: white;
    margin-bottom: 10px;
    border-radius: 5px;
    border-left: 4px solid #e74c3c;
}