/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

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

/* 登录页面 */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-container {
    width: 100%;
    max-width: 400px;
    padding: 20px;
}

.login-box {
    background: white;
    border-radius: 10px;
    padding: 40px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.1);
}

.login-box h1 {
    text-align: center;
    color: #667eea;
    margin-bottom: 5px;
}

.login-box h2 {
    text-align: center;
    color: #666;
    font-weight: 300;
    margin-bottom: 30px;
}

/* 表单样式 */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #555;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
    transition: border-color 0.3s;
}

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

.form-group textarea {
    resize: vertical;
    min-height: 80px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    cursor: pointer;
}

.checkbox-label input {
    width: auto;
    margin-right: 8px;
}

/* 按钮样式 */
.btn {
    display: inline-block;
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
    text-align: center;
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover {
    background: #5a67d8;
    transform: translateY(-1px);
}

.btn-block {
    width: 100%;
}

.btn-info {
    background: #48bb78;
    color: white;
}

.btn-info:hover {
    background: #38a169;
}

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

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

.btn-sm {
    padding: 5px 12px;
    font-size: 12px;
}

/* 提示信息 */
.alert {
    padding: 12px 20px;
    border-radius: 5px;
    margin-bottom: 20px;
}

.alert-success {
    background: #c6f6d5;
    color: #22543d;
    border: 1px solid #9ae6b4;
}

.alert-error {
    background: #fed7d7;
    color: #742a2a;
    border: 1px solid #feb2b2;
}

/* 后台布局 */
.admin-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.admin-nav {
    background: white;
    padding: 0 30px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-brand {
    font-size: 20px;
    font-weight: bold;
    color: #667eea;
}

.nav-links {
    display: flex;
    gap: 20px;
    align-items: center;
}

.nav-links a {
    color: #666;
    text-decoration: none;
    padding: 5px 10px;
    border-radius: 5px;
    transition: all 0.3s;
}

.nav-links a:hover {
    background: #f0f0f0;
}

.nav-links a.active {
    background: #667eea;
    color: white;
}

.nav-links a.logout {
    color: #fc8181;
}

.nav-links a.logout:hover {
    background: #fed7d7;
}

.user-info {
    color: #666;
    font-size: 14px;
}

/* 主内容 */
.main-content {
    flex: 1;
    padding: 30px;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

.main-content h1 {
    margin-bottom: 30px;
    color: #2d3748;
}

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

/* 统计卡片 */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    text-align: center;
}

.stat-number {
    font-size: 32px;
    font-weight: bold;
    color: #667eea;
}

.stat-label {
    color: #666;
    margin-top: 5px;
}

/* 表格 */
.table-container {
    overflow-x: auto;
}

.table {
    width: 100%;
    background: white;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.table thead {
    background: #f7fafc;
}

.table th {
    padding: 12px 15px;
    text-align: left;
    font-weight: 600;
    color: #4a5568;
}

.table td {
    padding: 12px 15px;
    border-top: 1px solid #edf2f7;
}

.table tbody tr:hover {
    background: #f7fafc;
}

/* 徽章 */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.badge-success {
    background: #c6f6d5;
    color: #22543d;
}

.badge-danger {
    background: #fed7d7;
    color: #742a2a;
}

/* 搜索框 */
.search-box {
    margin-bottom: 20px;
}

.search-box form {
    display: flex;
    gap: 10px;
}

.search-box input {
    flex: 1;
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: 5px;
}

/* 分页 */
.pagination {
    display: flex;
    gap: 5px;
    list-style: none;
    margin-top: 20px;
    justify-content: center;
}

.pagination li {
    display: inline-block;
}

.pagination li a {
    display: block;
    padding: 8px 12px;
    background: white;
    border: 1px solid #ddd;
    border-radius: 5px;
    text-decoration: none;
    color: #666;
    transition: all 0.3s;
}

.pagination li a:hover {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.pagination li.active a {
    background: #667eea;
    color: white;
    border-color: #667eea;
}
/* 修复弹窗居中 */
.modal {
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow-y: auto;
    padding: 20px;
}

.modal-content {
    background: white;
    border-radius: 10px;
    max-width: 900px;
    width: 95%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    margin: auto;
    padding: 30px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: modalFadeIn 0.3s ease;
}

/* 模态框淡入动画 */
@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: translateY(-30px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* 关闭按钮 */
.modal-content .close {
    position: absolute;
    right: 20px;
    top: 15px;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    color: #aaa;
    z-index: 10;
    transition: color 0.3s;
    line-height: 1;
}

.modal-content .close:hover {
    color: #333;
}

/* 大弹窗 */
.modal-large {
    max-width: 900px;
}

/* 弹窗滚动条美化 */
.modal-content::-webkit-scrollbar {
    width: 6px;
}

.modal-content::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.modal-content::-webkit-scrollbar-thumb {
    background: #c1c7cd;
    border-radius: 10px;
}

.modal-content::-webkit-scrollbar-thumb:hover {
    background: #a0aec0;
}

.form-section {
    margin-bottom: 25px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

.form-section h3 {
    margin-top: 0;
    margin-bottom: 15px;
    color: #2d3748;
    font-size: 16px;
    border-bottom: 2px solid #e2e8f0;
    padding-bottom: 8px;
}

.form-row {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
}

.form-row .form-group {
    flex: 1;
    min-width: 200px;
}

.col-3 {
    flex: 0 0 calc(25% - 15px);
}

.col-4 {
    flex: 0 0 calc(33.33% - 15px);
}

.col-6 {
    flex: 0 0 calc(50% - 15px);
}

.required {
    color: #e53e3e;
}

.product-icon {
    width: 40px;
    height: 40px;
    object-fit: cover;
    border-radius: 5px;
}

.text-muted {
    color: #a0aec0;
}

.badge-warning {
    background: #f6e05e;
    color: #744210;
}

.badge-info {
    background: #bee3f8;
    color: #2b6cb0;
}

.filter-section {
    background: white;
    padding: 15px 20px;
    border-radius: 10px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.filter-form {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.filter-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    width: 100%;
    align-items: center;
}

.filter-group {
    display: flex;
    gap: 10px;
    align-items: center;
}

.filter-group input,
.filter-group select {
    padding: 8px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 5px;
    min-width: 150px;
}

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

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

.form-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #e2e8f0;
}

.table-hover tbody tr:hover {
    background-color: #f7fafc;
}

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

@media (max-width: 768px) {
    .col-3, .col-4, .col-6 {
        flex: 0 0 100%;
    }
    
    .filter-row {
        flex-direction: column;
    }
    
    .filter-group {
        width: 100%;
    }
    
    .filter-group input,
    .filter-group select {
        min-width: 100%;
    }
}