/* 智选好物 - 后台管理样式 */

:root {
    --primary: #ff6b35;
    --primary-dark: #e55a2b;
    --secondary: #ffa726;
    --success: #4caf50;
    --danger: #f44336;
    --warning: #ffeb3b;
    --info: #2196f3;
    --dark: #333333;
    --gray: #666666;
    --light-gray: #f5f5f5;
    --border: #e0e0e0;
    --white: #ffffff;
    --sidebar-width: 240px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'PingFang SC', 'Microsoft YaHei', sans-serif;
    background: #f0f2f5;
    color: var(--dark);
    line-height: 1.6;
}

a {
    text-decoration: none;
    color: inherit;
}

/* 登录页 */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #ff6b35 0%, #ff8c5a 100%);
}

.login-container {
    background: white;
    padding: 40px;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    width: 100%;
    max-width: 400px;
}

.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.login-logo {
    font-size: 60px;
    margin-bottom: 10px;
}

.login-header h1 {
    font-size: 24px;
    color: var(--primary);
}

.login-header p {
    color: var(--gray);
    font-size: 14px;
    margin-top: 5px;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-size: 14px;
    color: var(--gray);
}

.form-group input,
.form-group select,
.form-group textarea {
    padding: 12px 15px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--primary);
}

.form-group textarea {
    min-height: 100px;
    resize: vertical;
}

.btn {
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s;
    border: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-secondary {
    background: var(--light-gray);
    color: var(--dark);
}

.btn-secondary:hover {
    background: var(--border);
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-block {
    width: 100%;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 13px;
}

.login-footer {
    margin-top: 30px;
    text-align: center;
    font-size: 13px;
    color: var(--gray);
}

.login-footer a {
    color: var(--primary);
    margin-left: 10px;
}

.alert {
    padding: 12px 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 14px;
}

.alert-error {
    background: #ffe6e6;
    color: var(--danger);
    border: 1px solid var(--danger);
}

.alert-success {
    background: #e6fff0;
    color: var(--success);
    border: 1px solid var(--success);
}

/* 后台布局 */
.admin-layout {
    display: flex;
    min-height: 100vh;
}

/* 侧边栏 */
.sidebar {
    width: var(--sidebar-width);
    background: #1e1e2d;
    color: white;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
}

.sidebar-header {
    padding: 25px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 20px;
    font-weight: bold;
}

.sidebar-menu {
    padding: 20px 0;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 25px;
    color: rgba(255,255,255,0.7);
    transition: all 0.3s;
    cursor: pointer;
}

.menu-item:hover,
.menu-item.active {
    background: rgba(255,107,53,0.2);
    color: var(--primary);
}

.menu-item-icon {
    font-size: 18px;
}

/* 主内容区 */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
}

.topbar {
    background: white;
    padding: 15px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    position: sticky;
    top: 0;
    z-index: 100;
}

.topbar-title {
    font-size: 18px;
    font-weight: 500;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-name {
    color: var(--gray);
}

.logout-btn {
    color: var(--danger);
    font-size: 14px;
}

.logout-btn:hover {
    text-decoration: underline;
}

.content-area {
    padding: 30px;
}

/* 统计卡片 */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: white;
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.stat-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.stat-card-title {
    font-size: 14px;
    color: var(--gray);
}

.stat-card-icon {
    font-size: 30px;
    opacity: 0.7;
}

.stat-card-value {
    font-size: 28px;
    font-weight: bold;
    color: var(--dark);
}

.stat-card-change {
    font-size: 13px;
    margin-top: 10px;
}

.stat-card-change.positive {
    color: var(--success);
}

.stat-card-change.negative {
    color: var(--danger);
}

/* 数据表格 */
.data-card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    overflow: hidden;
}

.card-header {
    padding: 20px 25px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-title {
    font-size: 16px;
    font-weight: 500;
}

.card-actions {
    display: flex;
    gap: 10px;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    padding: 15px 20px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.data-table th {
    background: var(--light-gray);
    font-weight: 500;
    font-size: 13px;
    color: var(--gray);
}

.data-table td {
    font-size: 14px;
}

.data-table tr:hover {
    background: rgba(255,107,53,0.05);
}

.table-image {
    width: 60px;
    height: 60px;
    border-radius: 8px;
    object-fit: cover;
    background: var(--light-gray);
}

.status-badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
}

.status-active {
    background: #e6fff0;
    color: var(--success);
}

.status-inactive {
    background: #ffe6e6;
    color: var(--danger);
}

.action-btns {
    display: flex;
    gap: 10px;
}

.action-btn {
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.3s;
    border: none;
}

.action-edit {
    background: rgba(33, 150, 243, 0.1);
    color: var(--info);
}

.action-delete {
    background: rgba(244, 67, 54, 0.1);
    color: var(--danger);
}

.action-btn:hover {
    opacity: 0.8;
}

/* 分页 */
.pagination {
    padding: 20px;
    display: flex;
    justify-content: center;
    gap: 10px;
}

.page-btn {
    padding: 8px 15px;
    border: 1px solid var(--border);
    background: white;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s;
}

.page-btn:hover,
.page-btn.active {
    border-color: var(--primary);
    color: var(--primary);
    background: rgba(255,107,53,0.1);
}

/* 模态框 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 12px;
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    padding: 20px 25px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-title {
    font-size: 18px;
    font-weight: 500;
}

.modal-close {
    font-size: 24px;
    cursor: pointer;
    color: var(--gray);
}

.modal-body {
    padding: 25px;
}

.modal-footer {
    padding: 20px 25px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* 图片上传预览 */
.image-upload {
    border: 2px dashed var(--border);
    border-radius: 12px;
    padding: 30px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
}

.image-upload:hover {
    border-color: var(--primary);
    background: rgba(255, 107, 53, 0.02);
}

.image-upload-icon {
    font-size: 48px;
    color: var(--gray);
    margin-bottom: 10px;
}

.image-upload-text {
    color: var(--gray);
    font-size: 14px;
}

.image-upload-text small {
    display: block;
    margin-top: 5px;
    font-size: 12px;
}

.image-preview {
    max-width: 250px;
    max-height: 250px;
    margin-top: 15px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

/* 图片链接输入 */
.image-url-input-wrapper input {
    transition: all 0.3s;
}

.image-url-input-wrapper input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.1);
}

/* 多图上传 */
.multi-image-item {
    position: relative;
    width: 100px;
    height: 100px;
    border-radius: 8px;
    overflow: hidden;
    border: 2px solid var(--border);
    transition: all 0.3s;
}

.multi-image-item:hover {
    border-color: var(--primary);
}

.multi-image-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.multi-image-item .remove-image {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 22px;
    height: 22px;
    background: rgba(244, 67, 54, 0.9);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 14px;
    line-height: 22px;
    text-align: center;
    opacity: 0;
    transition: opacity 0.2s;
}

.multi-image-item:hover .remove-image {
    opacity: 1;
}

.multi-image-item .remove-image:hover {
    background: var(--danger);
}

/* 复选框 */
.checkbox-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
}

.checkbox-wrapper input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
}

/* 搜索框 */
.search-input {
    padding: 10px 15px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    width: 300px;
}

/* 空状态 */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--gray);
}

.empty-icon {
    font-size: 60px;
    margin-bottom: 20px;
    opacity: 0.5;
}

/* 响应式 */
@media (max-width: 1200px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .sidebar {
        display: none;
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .data-table {
        display: block;
        overflow-x: auto;
    }
}
