/* 
 * 1688Manager 企业级管理后台样式
 * Professional Admin Dashboard Styles
 */

/* ==================== 变量定义 ==================== */
:root {
    /* 主色调 */
    --primary-color: #4f46e5;
    --primary-light: #818cf8;
    --primary-dark: #3730a3;
    
    /* 辅助色 */
    --secondary-color: #64748b;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --info-color: #0ea5e9;
    
    /* 中性色 */
    --bg-dark: #1e293b;
    --bg-dark-secondary: #334155;
    --bg-light: #f8fafc;
    --bg-white: #ffffff;
    --text-dark: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --border-color: #e2e8f0;
    --border-light: #f1f5f9;
    
    /* 侧边栏 */
    --sidebar-width: 260px;
    --sidebar-collapsed-width: 80px;
    --sidebar-bg: #1e293b;
    --sidebar-hover: #334155;
    --sidebar-active: #4f46e5;
    
    /* 顶部导航 */
    --header-height: 64px;
    
    /* 阴影 */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1);
    
    /* 圆角 */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    
    /* 过渡 */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.25s ease;
    --transition-slow: 0.35s ease;
}

/* ==================== 基础样式 ==================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Noto Sans SC', 'Microsoft YaHei', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 14px;
    color: var(--text-dark);
    background-color: var(--bg-light);
    min-height: 100vh;
    overflow-x: hidden;
}

/* ==================== 侧边栏 ==================== */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--sidebar-bg);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    transition: width var(--transition-normal), transform var(--transition-normal);
    overflow: hidden;
}

.sidebar.collapsed {
    width: var(--sidebar-collapsed-width);
}

.sidebar-header {
    height: var(--header-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.brand-link {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #fff;
    text-decoration: none;
    font-size: 18px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
}

.brand-link i {
    font-size: 24px;
    color: var(--primary-light);
    min-width: 24px;
}

.brand-text {
    opacity: 1;
    transition: opacity var(--transition-normal);
}

.sidebar.collapsed .brand-text {
    opacity: 0;
    width: 0;
}

.sidebar-toggle {
    background: none;
    border: none;
    color: rgba(255,255,255,0.7);
    cursor: pointer;
    padding: 8px;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

.sidebar-toggle:hover {
    background: var(--sidebar-hover);
    color: #fff;
}

/* 用户信息 */
.sidebar-user {
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-user .user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    flex-shrink: 0;
}

.sidebar-user .user-info {
    overflow: hidden;
    white-space: nowrap;
}

.sidebar-user .user-name {
    color: #fff;
    font-weight: 500;
    font-size: 14px;
}

.sidebar-user .user-role {
    color: var(--text-muted);
    font-size: 12px;
}

.sidebar.collapsed .sidebar-user {
    justify-content: center;
    padding: 20px 10px;
}

.sidebar.collapsed .user-info {
    display: none;
}

/* 导航菜单 */
.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 10px 0;
}

.sidebar-nav::-webkit-scrollbar {
    width: 4px;
}

.sidebar-nav::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar-nav::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.2);
    border-radius: 2px;
}

.nav-menu {
    list-style: none;
    padding: 0;
    margin: 0;
}

.nav-item {
    position: relative;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    color: rgba(255,255,255,0.7);
    text-decoration: none;
    transition: all var(--transition-fast);
    white-space: nowrap;
    border-left: 3px solid transparent;
}

.nav-link:hover {
    background: var(--sidebar-hover);
    color: #fff;
}

.nav-link.active {
    background: rgba(79, 70, 229, 0.2);
    color: #fff;
    border-left-color: var(--primary-light);
}

.nav-link i {
    font-size: 18px;
    min-width: 20px;
    text-align: center;
}

.nav-link span {
    flex: 1;
}

.submenu-arrow {
    font-size: 12px;
    transition: transform var(--transition-fast);
}

.nav-item.opened > .nav-link .submenu-arrow {
    transform: rotate(90deg);
}

.submenu {
    list-style: none;
    padding: 0;
    margin: 0;
    max-height: 0;
    overflow: hidden;
    background: rgba(0,0,0,0.2);
    transition: max-height var(--transition-normal);
}

.nav-item.opened > .submenu {
    max-height: 500px;
}

.submenu li a {
    display: block;
    padding: 10px 20px 10px 52px;
    color: rgba(255,255,255,0.6);
    text-decoration: none;
    font-size: 13px;
    transition: all var(--transition-fast);
}

.submenu li a:hover {
    color: #fff;
    background: var(--sidebar-hover);
}

.sidebar.collapsed .nav-link {
    padding: 12px;
    justify-content: center;
}

.sidebar.collapsed .nav-link span,
.sidebar.collapsed .submenu-arrow {
    display: none;
}

.sidebar.collapsed .submenu {
    position: absolute;
    left: 100%;
    top: 0;
    width: 180px;
    background: var(--sidebar-bg);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    max-height: none;
}

.sidebar.collapsed .nav-item:hover > .submenu {
    display: block;
}

/* 侧边栏底部 */
.sidebar-footer {
    padding: 10px 0;
    border-top: 1px solid rgba(255,255,255,0.1);
}

.sidebar-footer .nav-link {
    padding: 12px 20px;
    font-size: 13px;
}

.sidebar.collapsed .sidebar-footer .nav-link span {
    display: none;
}

/* ==================== 主内容区 ==================== */
.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    transition: margin-left var(--transition-normal);
}

.main-content.expanded {
    margin-left: var(--sidebar-collapsed-width);
}

/* 顶部导航 */
.top-header {
    position: sticky;
    top: 0;
    height: var(--header-height);
    background: var(--bg-white);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    padding: 0 24px;
    gap: 20px;
    z-index: 100;
    box-shadow: var(--shadow-sm);
}

.header-search {
    flex: 1;
    max-width: 400px;
    position: relative;
}

.header-search i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.header-search input {
    width: 100%;
    padding: 10px 14px 10px 40px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    font-size: 14px;
    background: var(--bg-light);
    transition: all var(--transition-fast);
}

.header-search input:focus {
    outline: none;
    border-color: var(--primary-color);
    background: var(--bg-white);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.header-icon {
    position: relative;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
    text-decoration: none;
}

.header-icon:hover {
    background: var(--bg-light);
    color: var(--text-dark);
}

.header-icon i {
    font-size: 18px;
}

.badge-dot {
    position: absolute;
    top: 8px;
    right: 10px;
    width: 8px;
    height: 8px;
    background: var(--danger-color);
    border-radius: 50%;
    border: 2px solid var(--bg-white);
}

/* 通知下拉 */
.notifications-dropdown {
    width: 360px;
    padding: 0;
    border: none;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
}

.dropdown-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-light);
}

.dropdown-header span {
    font-weight: 600;
    color: var(--text-dark);
}

.dropdown-header a {
    font-size: 13px;
    color: var(--primary-color);
}

.notification-list {
    max-height: 320px;
    overflow-y: auto;
}

.notification-item {
    display: flex;
    gap: 12px;
    padding: 14px 20px;
    text-decoration: none;
    transition: background var(--transition-fast);
}

.notification-item:hover {
    background: var(--bg-light);
}

.notification-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    flex-shrink: 0;
}

.notification-content p {
    margin: 0;
    color: var(--text-dark);
    font-size: 14px;
}

.notification-content span {
    font-size: 12px;
    color: var(--text-muted);
}

.dropdown-footer {
    padding: 12px 20px;
    text-align: center;
    border-top: 1px solid var(--border-light);
}

.dropdown-footer a {
    font-size: 13px;
    color: var(--primary-color);
    text-decoration: none;
}

/* 用户下拉 */
.user-dropdown {
    width: 240px;
    padding: 0;
    border: none;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
}

.user-dropdown-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px;
}

.user-dropdown-header .user-avatar {
    color: var(--primary-color);
}

.user-dropdown-header .user-name {
    font-weight: 600;
    color: var(--text-dark);
}

.user-dropdown-header .user-email {
    font-size: 12px;
    color: var(--text-muted);
}

/* ==================== 页面内容 ==================== */
.page-content {
    padding: 24px;
}

/* 页面标题 */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 16px;
}

.page-title {
    font-size: 24px;
    font-weight: 600;
    color: var(--text-dark);
    margin: 0;
}

.page-breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 4px;
}

.page-breadcrumb a {
    color: var(--text-muted);
    text-decoration: none;
}

.page-breadcrumb a:hover {
    color: var(--primary-color);
}

.page-actions {
    display: flex;
    gap: 12px;
}

/* ==================== 卡片 ==================== */
.card {
    background: var(--bg-white);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    transition: box-shadow var(--transition-fast);
}

.card:hover {
    box-shadow: var(--shadow-md);
}

.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-light);
    background: var(--bg-white);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-dark);
    margin: 0;
}

.card-body {
    padding: 20px;
}

/* ==================== 统计卡片 ==================== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    padding: 24px;
    display: flex;
    align-items: flex-start;
    gap: 16px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    transition: all var(--transition-fast);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
}

.stat-card.primary::before { background: var(--primary-color); }
.stat-card.success::before { background: var(--success-color); }
.stat-card.warning::before { background: var(--warning-color); }
.stat-card.danger::before { background: var(--danger-color); }
.stat-card.info::before { background: var(--info-color); }

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.stat-icon {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    flex-shrink: 0;
}

.stat-card.primary .stat-icon {
    background: rgba(79, 70, 229, 0.1);
    color: var(--primary-color);
}

.stat-card.success .stat-icon {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success-color);
}

.stat-card.warning .stat-icon {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning-color);
}

.stat-card.danger .stat-icon {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger-color);
}

.stat-card.info .stat-icon {
    background: rgba(14, 165, 233, 0.1);
    color: var(--info-color);
}

.stat-content {
    flex: 1;
}

.stat-label {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-dark);
    line-height: 1.2;
}

.stat-change {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    margin-top: 8px;
    padding: 2px 8px;
    border-radius: var(--radius-sm);
}

.stat-change.positive {
    color: var(--success-color);
    background: rgba(16, 185, 129, 0.1);
}

.stat-change.negative {
    color: var(--danger-color);
    background: rgba(239, 68, 68, 0.1);
}

/* ==================== 表格 ==================== */
.table-container {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    overflow: hidden;
}

.table-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-light);
    flex-wrap: wrap;
    gap: 12px;
}

.table-search {
    position: relative;
    width: 280px;
}

.table-search i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.table-search input {
    width: 100%;
    padding: 8px 12px 8px 36px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 14px;
}

.table-search input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.table-actions {
    display: flex;
    gap: 8px;
}

.table {
    margin: 0;
    font-size: 14px;
}

.table thead th {
    background: var(--bg-light);
    color: var(--text-secondary);
    font-weight: 600;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
}

.table tbody td {
    padding: 14px 16px;
    vertical-align: middle;
    border-bottom: 1px solid var(--border-light);
}

.table tbody tr:hover {
    background: var(--bg-light);
}

.table tbody tr:last-child td {
    border-bottom: none;
}

/* 表格内按钮 */
.table .btn {
    padding: 4px 10px;
    font-size: 13px;
}

.table .btn-sm {
    padding: 3px 8px;
    font-size: 12px;
}

/* 状态标签 */
.badge-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.badge-status::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
}

.badge-status.pending {
    background: #fef3c7;
    color: #92400e;
}
.badge-status.pending::before { background: #f59e0b; }

.badge-status.paid {
    background: #dbeafe;
    color: #1e40af;
}
.badge-status.paid::before { background: #3b82f6; }

.badge-status.processing {
    background: #e0e7ff;
    color: #3730a3;
}
.badge-status.processing::before { background: #4f46e5; }

.badge-status.completed {
    background: #d1fae5;
    color: #065f46;
}
.badge-status.completed::before { background: #10b981; }

.badge-status.cancelled {
    background: #f3f4f6;
    color: #6b7280;
}
.badge-status.cancelled::before { background: #9ca3af; }

.badge-status.refunded {
    background: #fee2e2;
    color: #991b1b;
}
.badge-status.refunded::before { background: #ef4444; }

/* ==================== 表单 ==================== */
.form-label {
    font-weight: 500;
    color: var(--text-dark);
    margin-bottom: 6px;
    font-size: 14px;
}

.form-control, .form-select {
    padding: 10px 14px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 14px;
    transition: all var(--transition-fast);
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

/* ==================== 按钮 ==================== */
.btn {
    padding: 8px 16px;
    font-weight: 500;
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
}

.btn-primary {
    background: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-primary:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
}

.btn-outline-primary {
    color: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-outline-primary:hover {
    background: var(--primary-color);
    color: #fff;
}

/* ==================== 分页 ==================== */
.pagination-wrapper {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-top: 1px solid var(--border-light);
}

.pagination-info {
    font-size: 13px;
    color: var(--text-muted);
}

.pagination {
    margin: 0;
}

.page-link {
    color: var(--text-secondary);
    border-color: var(--border-color);
    padding: 6px 12px;
    font-size: 13px;
}

.page-link:hover {
    color: var(--primary-color);
    background: var(--bg-light);
    border-color: var(--primary-color);
}

.page-item.active .page-link {
    background: var(--primary-color);
    border-color: var(--primary-color);
}

/* ==================== 筛选区域 ==================== */
.filter-section {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    padding: 20px;
    margin-bottom: 20px;
    border: 1px solid var(--border-color);
}

.filter-row {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: flex-end;
}

.filter-group {
    flex: 1;
    min-width: 200px;
}

.filter-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

/* ==================== 响应式 ==================== */
@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.show {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .main-content.expanded {
        margin-left: 0;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 767.98px) {
    .page-content {
        padding: 16px;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .table-toolbar {
        flex-direction: column;
        align-items: stretch;
    }
    
    .table-search {
        width: 100%;
    }
    
    .table-actions {
        justify-content: flex-start;
    }
    
    .table-container {
        overflow-x: auto;
    }
    
    .table {
        min-width: 600px;
    }
}

/* ==================== 动画 ==================== */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.animate-fade-in {
    animation: fadeIn 0.3s ease-out;
}

/* ==================== 空状态 ==================== */
.empty-state {
    text-align: center;
    padding: 60px 20px;
}

.empty-state i {
    font-size: 64px;
    color: var(--text-muted);
    margin-bottom: 16px;
}

.empty-state h4 {
    color: var(--text-dark);
    margin-bottom: 8px;
}

.empty-state p {
    color: var(--text-muted);
    margin-bottom: 20px;
}

/* ==================== 加载状态 ==================== */
.skeleton {
    background: linear-gradient(90deg, var(--bg-light) 25%, #e2e8f0 50%, var(--bg-light) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius-sm);
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}
