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

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

/* 管理后台容器 */
.admin-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* 顶部导航栏 */
.admin-header {
    background: #fff;
    border-bottom: 1px solid #e0e0e0;
    padding: 0 16px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
}

.header-left h1 {
    font-size: 20px;
    font-weight: 600;
    color: #333;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.logout-btn {
    padding: 8px 16px;
    background: #ff4757;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.3s;
}

.logout-btn:hover {
    background: #ff3742;
}

/* 主内容区 */
.admin-content {
    display: flex;
    margin-top: 56px;
    min-height: calc(100vh - 56px);
}

/* 侧边栏 */
.admin-sidebar {
    width: 220px;
    background: #fff;
    border-right: 1px solid #e0e0e0;
    position: fixed;
    top: 56px;
    left: 0;
    bottom: 0;
    overflow-y: auto;
}

.sidebar-nav ul {
    list-style: none;
    padding: 16px 0;
}

.sidebar-nav li {
    margin: 4px 0;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    padding: 12px 24px;
    color: #666;
    text-decoration: none;
    transition: all 0.3s;
    border-left: 3px solid transparent;
}

.sidebar-nav a:hover {
    background: #f8f9fa;
    color: #333;
}

.sidebar-nav li.active a {
    background: #e3f2fd;
    color: #1976d2;
    border-left-color: #1976d2;
}

.sidebar-nav .icon {
    margin-right: 12px;
    font-size: 16px;
}

/* 主内容区 */
.admin-main {
    flex: 1;
    margin-left: 220px;
    padding: 16px;
    background: #f5f5f5;
}

/* 页面头部 */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    background: #fff;
    padding: 12px 16px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.page-header h2 {
    font-size: 24px;
    font-weight: 600;
    color: #333;
}

.page-actions {
    display: flex;
    gap: 8px;
}

/* 按钮样式 */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.3s;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-primary {
    background: #1976d2;
    color: white;
}

.btn-primary:hover {
    background: #1565c0;
}

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

.btn-secondary:hover {
    background: #5a6268;
}

.btn-success {
    background: #28a745;
    color: white;
}

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

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

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

.btn-info {
    background: #17a2b8;
    color: white;
}

.btn-info:hover {
    background: #138496;
}

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

.stat-card {
    background: #fff;
    padding: 16px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    text-align: center;
    transition: transform 0.3s;
}

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

.stat-number {
    font-size: 32px;
    font-weight: 700;
    color: #1976d2;
    margin-bottom: 8px;
}

.stat-label {
    font-size: 14px;
    color: #666;
    font-weight: 500;
}

/* 快速操作 */
.quick-actions-section {
    background: #fff;
    padding: 24px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 24px;
}

.quick-actions-section h3 {
    margin-bottom: 16px;
    font-size: 18px;
    color: #333;
}

.action-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

.action-btn {
    padding: 16px 20px;
    background: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
    text-align: left;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    color: #333;
}

.action-btn:hover {
    background: #e3f2fd;
    border-color: #1976d2;
    color: #1976d2;
}

.action-btn .icon {
    font-size: 18px;
}

/* 搜索区域 */
.search-section {
    background: #fff;
    padding: 12px 16px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 12px;
}

.search-form {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.search-form input,
.search-form select {
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    min-width: 150px;
}

.search-form input:focus,
.search-form select:focus {
    outline: none;
    border-color: #1976d2;
}

/* 表格容器 */
.table-container {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    overflow: hidden;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th {
    background: #f8f9fa;
    padding: 12px 10px;
    text-align: left;
    font-weight: 600;
    color: #333;
    border-bottom: 1px solid #e0e0e0;
    font-size: 13px;
}

.data-table td {
    padding: 10px 10px;
    border-bottom: 1px solid #f0f0f0;
    font-size: 13px;
    color: #666;
}

.data-table tr:hover {
    background: #f8f9fa;
}

.data-table img {
    width: 40px;
    height: 40px;
    border-radius: 6px;
    object-fit: cover;
}

/* 状态标签 */
.status-badge {
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.status-active {
    background: #d4edda;
    color: #155724;
}

.status-inactive {
    background: #f8d7da;
    color: #721c24;
}

.status-rider {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

.status-normal {
    background: #e2e3e5;
    color: #6c757d;
}

.status-banned {
    background: #f8d7da;
    color: #721c24;
}

/* 操作按钮 */
.action-buttons-small {
    display: flex;
    gap: 8px;
}

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

/* 模态框 */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
}

.modal-content {
    background-color: #fff;
    margin: 3% auto;
    padding: 0;
    border-radius: 8px;
    width: 92%;
    max-width: 1000px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
    max-height: 90vh;
    overflow-y: auto;
}

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

.modal-header h3 {
    margin: 0;
    font-size: 18px;
    color: #333;
}

.close {
    color: #aaa;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
}

.close:hover {
    color: #333;
}

.modal-body {
    padding: 16px;
}

.modal-footer {
    padding: 12px 16px;
    border-top: 1px solid #e0e0e0;
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

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

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: #333;
    font-size: 14px;
}

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

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

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

/* 标签页内容 */
.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* 最近数据区域 */
.recent-section {
    background: #fff;
    padding: 24px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.recent-section h3 {
    margin-bottom: 16px;
    font-size: 18px;
    color: #333;
}

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

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

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

.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.login-header h1 {
    color: #333;
    margin-bottom: 10px;
    font-size: 24px;
}

.login-header p {
    color: #666;
    font-size: 14px;
}

.login-form {
    margin-bottom: 20px;
}

.login-btn {
    width: 100%;
    padding: 12px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 16px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.login-btn:hover {
    background: #5a6fd8;
}

.login-footer {
    text-align: center;
    color: #666;
    font-size: 14px;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .admin-sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s;
    }
    
    .admin-main {
        margin-left: 0;
    }
    
    .page-header {
        flex-direction: column;
        gap: 12px;
        align-items: flex-start;
    }
    
    .search-form {
        flex-direction: column;
        align-items: stretch;
    }
    
    .search-form input,
    .search-form select {
        min-width: auto;
    }
    
    .stats-cards {
        grid-template-columns: 1fr;
    }
    
    .action-buttons {
        grid-template-columns: 1fr;
    }
}

/* 分类管理样式 */
.categories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 16px;
    margin-bottom: 16px;
}

.category-card {
    background: #fff;
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    border: 1px solid #e0e0e0;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 16px;
}

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

.category-icon {
    font-size: 48px;
    width: 64px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8f9fa;
    border-radius: 12px;
    flex-shrink: 0;
}

.category-info {
    flex: 1;
}

.category-info h3 {
    font-size: 18px;
    font-weight: 600;
    color: #333;
    margin-bottom: 4px;
}

.category-info p {
    color: #666;
    font-size: 14px;
    margin-bottom: 8px;
}

.category-stats {
    font-size: 12px;
    color: #999;
    background: #f8f9fa;
    padding: 4px 8px;
    border-radius: 4px;
    display: inline-block;
}

.category-actions {
    flex-shrink: 0;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
    border-radius: 6px;
}

/* 分类产品列表样式 */
#category-products-section {
    margin-top: 24px;
}

#category-products-section .page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

#category-products-section .page-header h3 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
}

#category-products-section .page-actions {
    display: flex;
    gap: 12px;
    align-items: center;
}

/* 产品表格中的图片样式 */
.product-image {
    width: 40px;
    height: 40px;
    border-radius: 6px;
    object-fit: cover;
    border: 1px solid #e0e0e0;
}

/* 状态标签样式 */
.status-badge {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
}

.status-badge.active {
    background: #d4edda;
    color: #155724;
}

.status-badge.inactive {
    background: #f8d7da;
    color: #721c24;
}

/* 操作按钮样式 */
.action-buttons-grid {
    display: flex;
    gap: 8px;
}

.btn-icon {
    padding: 6px;
    border: none;
    background: transparent;
    color: #666;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.btn-icon:hover {
    background: #f8f9fa;
    color: #333;
}

.btn-icon.edit:hover {
    color: #007bff;
}

.btn-icon.delete:hover {
    color: #dc3545;
}

/* 产品编辑模态框样式 */
.form-row {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
}

.form-row .form-group {
    flex: 1;
}

.form-text {
    color: #666;
    font-size: 12px;
    margin-top: 4px;
    display: block;
}

/* 多张图片上传样式 */
.multi-image-upload-container {
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 16px;
    background: #fafafa;
}

.images-preview-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 12px;
    margin-top: 16px;
    min-height: 60px;
}

.image-preview-item {
    position: relative;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    background: white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.image-preview-item img {
    width: 100%;
    height: 120px;
    object-fit: cover;
    display: block;
}

.image-preview-item .image-actions {
    position: absolute;
    top: 4px;
    right: 4px;
    display: flex;
    gap: 4px;
}

.image-preview-item .image-actions button {
    width: 24px;
    height: 24px;
    border: none;
    border-radius: 50%;
    background: rgba(0,0,0,0.6);
    color: white;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
}

.image-preview-item .image-actions button:hover {
    background: rgba(0,0,0,0.8);
}

.image-preview-item .image-actions .set-main-btn {
    background: rgba(255,193,7,0.8);
}

.image-preview-item .image-actions .set-main-btn:hover {
    background: rgba(255,193,7,1);
}

.image-preview-item.main-image {
    border: 2px solid #ffc107;
    box-shadow: 0 0 0 2px rgba(255,193,7,0.2);
}

.image-preview-item .main-badge {
    position: absolute;
    bottom: 4px;
    left: 4px;
    background: #ffc107;
    color: #333;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 500;
}
}

.image-preview {
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 8px;
    background: #f8f9fa;
}

.image-preview img {
    display: block;
    margin: 0 auto;
}

/* 产品模态框特殊样式 */
#productModal .modal-content {
    max-width: 1100px;
    width: 94%;
    max-height: 90vh;
    overflow-y: auto;
}

#productModal .form-group {
    margin-bottom: 16px;
}

#productModal label {
    font-weight: 500;
    color: #333;
    margin-bottom: 6px;
    display: block;
}

#productModal input,
#productModal select,
#productModal textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.2s ease;
}

#productModal input:focus,
#productModal select:focus,
#productModal textarea:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
}

#productModal textarea {
    resize: vertical;
    min-height: 80px;
}

/* 移动端分类卡片样式 */
@media (max-width: 768px) {
    .categories-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .category-card {
        flex-direction: column;
        text-align: center;
        padding: 20px;
    }
    
    .category-icon {
        margin-bottom: 12px;
    }
    
    .category-actions {
        margin-top: 12px;
    }
    
    .form-row {
        flex-direction: column;
        gap: 0;
    }
    
    #productModal .modal-content {
        width: 95%;
        margin: 2.5% auto;
    }
}