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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    background: #f5f7fa;
    color: #333;
}

.hidden {
    display: none !important;
}

/* ==================== 登录页面 ==================== */

.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 1rem;
}

.login-box {
    background: white;
    border-radius: 16px;
    padding: 2rem;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-header h1 {
    font-size: 1.8rem;
    color: #333;
    margin-bottom: 0.5rem;
}

.login-header p {
    color: #666;
}

.login-tabs {
    display: flex;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid #e2e8f0;
}

.login-tab {
    flex: 1;
    padding: 0.75rem;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 1rem;
    color: #666;
    transition: all 0.3s;
}

.login-tab.active {
    color: #667eea;
    border-bottom: 2px solid #667eea;
    margin-bottom: -2px;
}

.login-form {
    display: none;
}

.login-form.active {
    display: block;
}

.login-hint {
    margin-top: 1.5rem;
    padding: 1rem;
    background: #f8fafc;
    border-radius: 8px;
    text-align: center;
}

.login-hint p {
    color: #666;
    font-size: 0.9rem;
}

/* ==================== 导航栏 ==================== */

.navbar {
    position: fixed;
    top: 0;
    width: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    z-index: 1000;
}

.nav-brand {
    font-size: 1.5rem;
    font-weight: bold;
    color: white;
}

.nav-links {
    display: flex;
    list-style: none;
    gap: 1rem;
}

.nav-btn {
    text-decoration: none;
    color: rgba(255,255,255,0.8);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    transition: all 0.3s;
    cursor: pointer;
}

.nav-btn:hover, .nav-btn.active {
    background: rgba(255,255,255,0.2);
    color: white;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 1rem;
    color: white;
}

.user-info span {
    opacity: 0.9;
}

/* ==================== 容器 ==================== */

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 6rem 2rem 2rem;
}

/* ==================== 标签页切换 ==================== */

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

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

/* ==================== Hero ==================== */

.hero {
    text-align: center;
    padding: 3rem;
    background: white;
    border-radius: 16px;
    margin-bottom: 2rem;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.hero h1 {
    font-size: 2.5rem;
    color: #667eea;
    margin-bottom: 0.5rem;
}

.hero p {
    color: #666;
    font-size: 1.1rem;
}

/* ==================== 统计卡片 ==================== */

.stats-overview {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    transition: transform 0.3s;
}

.stat-card:hover {
    transform: translateY(-5px);
}

.stat-icon {
    font-size: 2.5rem;
}

.stat-number {
    font-size: 2rem;
    font-weight: bold;
    color: #333;
}

.stat-label {
    color: #666;
    font-size: 0.9rem;
}

/* ==================== 快速操作 ==================== */

.quick-actions {
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.quick-actions h3 {
    margin-bottom: 1rem;
    color: #333;
}

/* ==================== 按钮 ==================== */

.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.3s;
    text-decoration: none;
    display: inline-block;
}

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

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

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

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

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

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

.btn-success {
    background: #10b981;
    color: white;
}

.btn-success:hover {
    background: #059669;
}

.btn-small {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

.btn-block {
    width: 100%;
}

/* ==================== 区块头部 ==================== */

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.section-header h2 {
    color: #333;
}

/* ==================== 搜索栏 ==================== */

.search-bar {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.search-bar input, .search-bar select {
    padding: 0.75rem 1rem;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s;
}

.search-bar input:focus, .search-bar select:focus {
    outline: none;
    border-color: #667eea;
}

.search-bar input {
    min-width: 200px;
}

/* ==================== 图书网格 ==================== */

.books-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

.book-card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    transition: transform 0.3s, box-shadow 0.3s;
}

.book-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.15);
}

.book-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 1rem;
}

.book-title {
    font-size: 1.1rem;
    font-weight: bold;
    margin-bottom: 0.25rem;
}

.book-author {
    opacity: 0.9;
    font-size: 0.9rem;
}

.book-body {
    padding: 1rem;
}

.book-info {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.book-label {
    color: #666;
}

.book-value {
    color: #333;
    font-weight: 500;
}

.book-status {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
}

.status-available {
    background: #d1fae5;
    color: #059669;
}

.status-borrowed {
    background: #fef3c7;
    color: #d97706;
}

.book-actions {
    display: flex;
    gap: 0.5rem;
    padding: 1rem;
    border-top: 1px solid #e2e8f0;
    flex-wrap: wrap;
}

/* ==================== 借阅列表 ==================== */

.borrowed-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.borrow-item {
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.borrow-info h4 {
    color: #333;
    margin-bottom: 0.25rem;
}

.borrow-info p {
    color: #666;
    font-size: 0.9rem;
}

.borrow-dates {
    text-align: right;
}

.borrow-dates p {
    font-size: 0.9rem;
    color: #666;
}

/* ==================== 统计详情 ==================== */

.stats-details {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.category-stats {
    margin-top: 1rem;
}

.category-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid #e2e8f0;
}

.category-item:last-child {
    border-bottom: none;
}

.category-bar {
    flex: 1;
    height: 8px;
    background: #e2e8f0;
    border-radius: 4px;
    margin: 0 1rem;
    overflow: hidden;
}

.category-bar-fill {
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 4px;
}

/* ==================== 用户列表 ==================== */

.users-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.user-item {
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.user-info-card h4 {
    color: #333;
}

.user-info-card p {
    color: #666;
    font-size: 0.9rem;
}

.user-role {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
}

.role-admin {
    background: #fef3c7;
    color: #d97706;
}

.role-user {
    background: #dbeafe;
    color: #2563eb;
}

/* ==================== 模态框 ==================== */

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

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 16px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-small {
    max-width: 400px;
}

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

.modal-header h3 {
    color: #333;
}

.close-btn {
    font-size: 1.5rem;
    cursor: pointer;
    color: #666;
    transition: color 0.3s;
}

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

/* ==================== 表单 ==================== */

form {
    padding: 1.5rem;
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: #333;
    font-weight: 500;
}

.form-group input, .form-group select, .form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s;
}

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

.form-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    margin-top: 1.5rem;
}

/* ==================== 空状态 ==================== */

.empty-state {
    text-align: center;
    padding: 3rem;
    color: #666;
}

.empty-state-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

/* ==================== 页脚 ==================== */

footer {
    text-align: center;
    padding: 2rem;
    color: #666;
    margin-top: 2rem;
}

/* ==================== 响应式 ==================== */

@media (max-width: 768px) {
    .navbar {
        flex-direction: column;
        gap: 1rem;
        padding: 1rem;
    }

    .nav-links {
        gap: 0.5rem;
        flex-wrap: wrap;
        justify-content: center;
    }

    .nav-btn {
        padding: 0.4rem 0.8rem;
        font-size: 0.9rem;
    }

    .user-info {
        flex-direction: column;
        gap: 0.5rem;
    }

    .container {
        padding: 8rem 1rem 1rem;
    }

    .hero h1 {
        font-size: 1.8rem;
    }

    .section-header {
        flex-direction: column;
        align-items: stretch;
    }

    .search-bar {
        flex-direction: column;
    }

    .search-bar input {
        width: 100%;
    }

    .books-grid {
        grid-template-columns: 1fr;
    }

    .borrow-item {
        flex-direction: column;
        text-align: center;
    }

    .borrow-dates {
        text-align: center;
    }

    .user-item {
        flex-direction: column;
        text-align: center;
        gap: 1rem;
    }
}
