/* ============================================
   后台管理系统样式
   ============================================ */

.admin-container {
    display: flex;
    min-height: 100vh;
    background: #f3f4f6;
}

/* --- 侧边栏 --- */
.admin-sidebar {
    width: 260px;
    background: linear-gradient(180deg, #0f172a 0%, #1e293b 100%);
    color: #fff;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 100;
    transition: all 0.3s ease;
}

.sidebar-header {
    padding: 24px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}

.admin-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
}
.admin-logo img {
    height: 40px;
    width: auto;
    border-radius: 8px;
}
.admin-logo .logo-text h2 {
    font-size: 1.1rem;
    font-weight: 700;
    margin: 0;
    color: #fff;
}
.admin-logo .logo-text .logo-sub-text {
    font-size: 0.62rem;
    color: rgba(255,255,255,0.7);
    margin: 3px 0 0;
    letter-spacing: 0.3px;
    line-height: 1.2;
}
.admin-logo .logo-text p {
    font-size: 0.75rem;
    color: rgba(255,255,255,0.5);
    margin: 2px 0 0;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: rgba(255,255,255,0.04);
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,0.06);
}
.user-avatar {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}
.user-details h3 {
    font-size: 0.9rem;
    font-weight: 600;
    margin: 0;
    color: #fff;
}
.user-details p {
    font-size: 0.75rem;
    color: rgba(255,255,255,0.5);
    margin: 2px 0 0;
}

.sidebar-menu {
    flex: 1;
    padding: 16px 12px;
    overflow-y: auto;
}
.sidebar-menu ul {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.sidebar-menu a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 10px;
    color: rgba(255,255,255,0.65);
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s ease;
    position: relative;
}
.sidebar-menu a:hover {
    background: rgba(255,255,255,0.06);
    color: #fff;
}
.sidebar-menu a.active {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: #fff;
    box-shadow: 0 4px 12px rgba(26,86,219,0.3);
}
.sidebar-menu a .badge {
    margin-left: auto;
    background: var(--accent);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 10px;
}

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid rgba(255,255,255,0.06);
}
.logout-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-radius: 10px;
    color: rgba(255,255,255,0.7);
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s ease;
}
.logout-btn:hover {
    background: rgba(239,68,68,0.1);
    color: #ef4444;
}
.version {
    text-align: center;
    font-size: 0.7rem;
    color: rgba(255,255,255,0.3);
    margin-top: 8px;
}

/* --- 主内容区 --- */
.admin-main {
    flex: 1;
    margin-left: 260px;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.admin-header {
    height: 68px;
    background: #fff;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    position: sticky;
    top: 0;
    z-index: 50;
}
.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}
.sidebar-toggle {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #64748b;
    font-size: 1.1rem;
    background: #f3f4f6;
    transition: all 0.2s ease;
}
.sidebar-toggle:hover {
    background: #e5e7eb;
    color: #334155;
}
.header-left h1 {
    font-size: 1.25rem;
    font-weight: 700;
    color: #1f2937;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}
.header-actions {
    display: flex;
    gap: 8px;
}
.header-btn {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #64748b;
    font-size: 1rem;
    background: #f3f4f6;
    position: relative;
    transition: all 0.2s ease;
}
.header-btn:hover {
    background: #e5e7eb;
    color: #334155;
}
.header-btn .badge {
    position: absolute;
    top: -2px;
    right: -2px;
    background: #ef4444;
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: 8px;
    border: 2px solid #fff;
}
.current-time {
    display: flex;
    align-items: center;
    gap: 6px;
    color: #64748b;
    font-size: 0.85rem;
    font-weight: 500;
    padding: 8px 14px;
    background: #f3f4f6;
    border-radius: 8px;
}

/* --- 内容区 --- */
.admin-content {
    display: none;
    padding: 28px;
    flex: 1;
}
.admin-content.active {
    display: block;
}

/* 统计卡片 */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 28px;
}
.stat-card {
    background: #fff;
    border-radius: 14px;
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    border: 1px solid #e5e7eb;
    transition: all 0.3s ease;
}
.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.08);
}
.stat-icon {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.2rem;
    flex-shrink: 0;
}
.stat-content h3 {
    font-size: 0.85rem;
    color: #6b7280;
    font-weight: 500;
    margin: 0 0 6px;
}
.stat-number {
    font-size: 1.6rem;
    font-weight: 800;
    color: #1f2937;
    margin: 0 0 4px;
    line-height: 1;
}
.stat-change {
    font-size: 0.8rem;
    font-weight: 600;
    margin: 0;
}
.stat-change.positive { color: #10b981; }
.stat-change.negative { color: #ef4444; }

/* 图表网格 */
.charts-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
    margin-bottom: 28px;
}
.chart-card {
    background: #fff;
    border-radius: 14px;
    padding: 24px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    border: 1px solid #e5e7eb;
}
.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}
.chart-header h3 {
    font-size: 1rem;
    font-weight: 700;
    color: #1f2937;
    margin: 0;
}
.chart-period {
    padding: 6px 12px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    font-size: 0.8rem;
    color: #6b7280;
    background: #fff;
    outline: none;
    cursor: pointer;
}

/* 模拟图表 */
.chart-simulator {
    height: 200px;
    display: flex;
    align-items: flex-end;
    justify-content: space-around;
    padding: 0 10px;
    border-bottom: 2px solid #e5e7eb;
    position: relative;
}
.chart-bars {
    display: flex;
    align-items: flex-end;
    justify-content: space-around;
    width: 100%;
    height: 100%;
    gap: 12px;
}
.bar {
    flex: 1;
    max-width: 60px;
    background: linear-gradient(to top, var(--primary), var(--primary-light));
    border-radius: 6px 6px 0 0;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding-bottom: 8px;
    color: #fff;
    font-size: 0.75rem;
    font-weight: 600;
    transition: all 0.3s ease;
}
.bar:hover {
    filter: brightness(1.1);
    transform: scaleY(1.02);
    transform-origin: bottom;
}

/* 产品列表 */
.product-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.product-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px;
    border-radius: 10px;
    transition: all 0.2s ease;
}
.product-item:hover {
    background: #f9fafb;
}
.product-info {
    display: flex;
    align-items: center;
    gap: 12px;
}
.product-info img {
    width: 48px;
    height: 48px;
    border-radius: 8px;
    object-fit: cover;
    background: #f3f4f6;
}
.product-info h4 {
    font-size: 0.9rem;
    font-weight: 600;
    color: #1f2937;
    margin: 0 0 2px;
}
.product-info p {
    font-size: 0.8rem;
    color: #6b7280;
    margin: 0;
}
.product-price {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--primary);
}

/* 待办事项 */
.todo-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}
.todo-card {
    background: #fff;
    border-radius: 14px;
    padding: 24px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    border: 1px solid #e5e7eb;
}
.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}
.card-header h3 {
    font-size: 1rem;
    font-weight: 700;
    color: #1f2937;
    margin: 0;
}
.view-all {
    font-size: 0.85rem;
    color: var(--primary);
    font-weight: 600;
}
.view-all:hover { text-decoration: underline; }

.btn.small {
    padding: 8px 16px;
    font-size: 0.8rem;
}

.todo-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.todo-list li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    border-radius: 8px;
    transition: all 0.2s ease;
}
.todo-list li:hover {
    background: #f9fafb;
}
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 0.9rem;
    color: #374151;
}
.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
    cursor: pointer;
}
.checkbox-label input[type="checkbox"]:checked + span {
    text-decoration: line-through;
    color: #9ca3af;
}
.todo-badge {
    font-size: 0.7rem;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 6px;
}
.todo-badge.urgent { background: #fee2e2; color: #dc2626; }
.todo-badge.high { background: #fef3c7; color: #d97706; }
.todo-badge.normal { background: #dbeafe; color: #2563eb; }
.todo-badge.low { background: #f3f4f6; color: #6b7280; }

/* 订单列表 */
.orders-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.order-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px;
    border-radius: 10px;
    border-left: 3px solid transparent;
    transition: all 0.2s ease;
}
.order-item:hover {
    background: #f9fafb;
}
.order-item.new {
    border-left-color: var(--primary);
    background: linear-gradient(90deg, rgba(26,86,219,0.03), transparent);
}
.order-info h4 {
    font-size: 0.9rem;
    font-weight: 600;
    color: #1f2937;
    margin: 0 0 3px;
}
.order-info p {
    font-size: 0.8rem;
    color: #6b7280;
    margin: 0 0 3px;
}
.order-time {
    font-size: 0.75rem;
    color: #9ca3af;
}
.order-status {
    font-size: 0.75rem;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 6px;
}
.order-status.pending { background: #fef3c7; color: #d97706; }
.order-status.confirmed { background: #dbeafe; color: #2563eb; }
.order-status.shipped { background: #d1fae5; color: #059669; }
.order-status.completed { background: #f3f4f6; color: #6b7280; }

/* 内容头部 */
.content-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}
.content-header h2 {
    font-size: 1.4rem;
    font-weight: 800;
    color: #1f2937;
    margin: 0;
}
.content-header .header-actions {
    display: flex;
    gap: 10px;
}

/* 表格 */
.products-table {
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    border: 1px solid #e5e7eb;
    overflow: hidden;
}
.products-table table {
    width: 100%;
    border-collapse: collapse;
}
.products-table th {
    background: #f9fafb;
    padding: 14px 18px;
    text-align: left;
    font-size: 0.8rem;
    font-weight: 700;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid #e5e7eb;
}
.products-table td {
    padding: 14px 18px;
    border-bottom: 1px solid #f3f4f6;
    font-size: 0.9rem;
    color: #374151;
    vertical-align: middle;
}
.products-table tbody tr:hover {
    background: #f9fafb;
}
.products-table tbody tr:last-child td {
    border-bottom: none;
}

.product-thumb {
    width: 48px;
    height: 48px;
    border-radius: 8px;
    object-fit: cover;
    background: #f3f4f6;
}

.status {
    font-size: 0.75rem;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 6px;
    display: inline-block;
}
.status.active { background: #d1fae5; color: #059669; }
.status.inactive { background: #f3f4f6; color: #6b7280; }
.status.pending { background: #fef3c7; color: #d97706; }

.btn-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #6b7280;
    background: transparent;
    transition: all 0.2s ease;
    margin-right: 4px;
}
.btn-icon:hover {
    background: #f3f4f6;
}
.btn-icon.edit:hover { color: var(--primary); }
.btn-icon.delete:hover { color: #ef4444; background: #fee2e2; }

/* 模态框 */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
}
.modal.active {
    display: flex;
}
.modal-content {
    background: #fff;
    border-radius: 16px;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 24px 48px rgba(0,0,0,0.2);
    animation: modalSlideIn 0.3s ease;
}
@keyframes modalSlideIn {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid #e5e7eb;
}
.modal-header h3 {
    font-size: 1.1rem;
    font-weight: 700;
    color: #1f2937;
    margin: 0;
}
.modal-close {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6b7280;
    font-size: 1.2rem;
    background: #f3f4f6;
    cursor: pointer;
    transition: all 0.2s ease;
}
.modal-close:hover {
    background: #e5e7eb;
    color: #1f2937;
}
.modal-body {
    padding: 24px;
}
.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 16px 24px;
    border-top: 1px solid #e5e7eb;
    background: #f9fafb;
    border-radius: 0 0 16px 16px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}
.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: 6px;
}
.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    font-size: 0.9rem;
    color: #374151;
    background: #fff;
    outline: none;
    transition: all 0.2s ease;
    font-family: inherit;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(26,86,219,0.1);
}

.file-upload {
    position: relative;
}
.file-upload input[type="file"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
    z-index: 2;
}
.upload-area {
    border: 2px dashed #e5e7eb;
    border-radius: 10px;
    padding: 32px;
    text-align: center;
    color: #9ca3af;
    transition: all 0.2s ease;
}
.upload-area:hover {
    border-color: var(--primary);
    background: #f9fafb;
}
.upload-area i {
    font-size: 2rem;
    margin-bottom: 8px;
    color: #d1d5db;
}

/* 筛选工具栏 */
.filter-bar {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}
.filter-bar input,
.filter-bar select {
    padding: 10px 14px;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    font-size: 0.9rem;
    outline: none;
    min-width: 180px;
}
.filter-bar input:focus,
.filter-bar select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(26,86,219,0.1);
}

/* 分页 */
.pagination {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin-top: 24px;
}
.pagination button {
    min-width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 600;
    color: #6b7280;
    background: #fff;
    border: 1px solid #e5e7eb;
    transition: all 0.2s ease;
}
.pagination button:hover {
    background: #f3f4f6;
}
.pagination button.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

/* 设置页面 */
.settings-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}
.settings-card {
    background: #fff;
    border-radius: 14px;
    padding: 28px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    border: 1px solid #e5e7eb;
}
.settings-card h3 {
    font-size: 1.05rem;
    font-weight: 700;
    color: #1f2937;
    margin: 0 0 20px;
    padding-bottom: 14px;
    border-bottom: 1px solid #f3f4f6;
}
.settings-card .form-group {
    margin-bottom: 16px;
}
.settings-card .form-group:last-child {
    margin-bottom: 0;
}

/* 用户头像小 */
.user-thumb {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 700;
}

/* 响应式 */
@media (max-width: 1200px) {
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .charts-grid { grid-template-columns: 1fr; }
    .todo-grid { grid-template-columns: 1fr; }
    .settings-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    .admin-sidebar {
        transform: translateX(-100%);
    }
    .admin-sidebar.open {
        transform: translateX(0);
    }
    .admin-main {
        margin-left: 0;
    }
    .stats-grid { grid-template-columns: 1fr; }
    .form-row { grid-template-columns: 1fr; }
    .content-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    .filter-bar {
        flex-direction: column;
    }
    .filter-bar input,
    .filter-bar select {
        width: 100%;
    }
}

/* ========== 图片上传区域 ========== */
.image-upload-zone {
    border: 2px dashed #d1d5db;
    border-radius: 10px;
    padding: 24px;
    text-align: center;
    background: #f9fafb;
    cursor: pointer;
    transition: all 0.2s ease;
    min-height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.image-upload-zone:hover {
    border-color: #3b82f6;
    background: #eff6ff;
}
.upload-hint p {
    margin: 8px 0 0;
    color: #9ca3af;
    font-size: 0.9rem;
}
