/**
 * 盛浩标准曲轴管理系统 v6.0 - 全局样式
 * 主题色：渐变紫 #667eea → #764ba2
 */

/* ============================================================
   CSS 变量
   ============================================================ */
:root {
    --primary: #667eea;
    --primary-dark: #764ba2;
    --success: #67c23a;
    --warning: #e6a23c;
    --danger: #f56c6c;
    --info: #909399;
    --bg: #f5f7fa;
    --border: #ebeef5;
    --text-primary: #303133;
    --text-regular: #606266;
    --text-secondary: #909399;
    --sidebar-width: 240px;
    --header-height: 60px;
    --card-radius: 12px;
    --shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    --shadow-hover: 0 4px 20px rgba(0, 0, 0, 0.12);
}

/* ============================================================
   基础重置
   ============================================================ */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Microsoft YaHei', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 14px;
    color: var(--text-primary);
    background: var(--bg);
    line-height: 1.6;
}

a {
    color: var(--primary);
    text-decoration: none;
}
a:hover {
    color: var(--primary-dark);
}

/* ============================================================
   布局
   ============================================================ */
.app-wrapper {
    display: flex;
    min-height: 100vh;
}

.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    transition: margin-left 0.3s;
}

.sidebar-collapsed .main-content {
    margin-left: 64px;
}

/* ============================================================
   侧边栏
   ============================================================ */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: linear-gradient(180deg, #1a1a2e 0%, #16213e 100%);
    color: #fff;
    overflow-y: auto;
    z-index: 1000;
    transition: width 0.3s;
}

.sidebar-collapsed .sidebar {
    width: 64px;
}

.sidebar-header {
    display: flex;
    align-items: center;
    padding: 20px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-logo {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

.sidebar-title {
    margin-left: 12px;
    font-size: 16px;
    font-weight: 600;
    white-space: nowrap;
}

.sidebar-collapsed .sidebar-title,
.sidebar-collapsed .nav-group-title span,
.sidebar-collapsed .nav-arrow,
.sidebar-collapsed .nav-items {
    display: none;
}

.sidebar-nav {
    padding: 8px 0;
}

.nav-group {
    margin-bottom: 4px;
}

.nav-group-title {
    display: flex;
    align-items: center;
    padding: 10px 16px;
    font-size: 13px;
    color: rgba(255,255,255,0.6);
    cursor: pointer;
    user-select: none;
    transition: color 0.2s;
}
.nav-group-title:hover {
    color: rgba(255,255,255,0.9);
}
.nav-group-title i:first-child {
    width: 32px;
    text-align: center;
    font-size: 14px;
}
.nav-group-title span {
    flex: 1;
    margin-left: 8px;
}
.nav-arrow {
    font-size: 10px;
    transition: transform 0.3s;
}
.nav-group.collapsed .nav-arrow {
    transform: rotate(-90deg);
}
.nav-group.collapsed .nav-items {
    display: none;
}

.nav-items {
    list-style: none;
}

.nav-item a {
    display: flex;
    align-items: center;
    padding: 9px 16px 9px 48px;
    color: rgba(255,255,255,0.75);
    font-size: 13px;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}
.nav-item a:hover {
    background: rgba(255,255,255,0.08);
    color: #fff;
}
.nav-item.active a {
    background: rgba(102, 126, 234, 0.2);
    color: #fff;
    border-left-color: var(--primary);
}
.nav-item a i {
    width: 20px;
    text-align: center;
    margin-right: 10px;
    font-size: 13px;
}

/* ============================================================
   顶部导航
   ============================================================ */
.top-header {
    position: sticky;
    top: 0;
    height: var(--header-height);
    background: #fff;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 24px;
    z-index: 999;
    box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}

.sidebar-toggle {
    background: none;
    border: none;
    font-size: 18px;
    color: var(--text-regular);
    cursor: pointer;
    padding: 8px;
    margin-right: 12px;
    border-radius: 6px;
}
.sidebar-toggle:hover {
    background: var(--bg);
}

.page-title {
    font-size: 18px;
    font-weight: 600;
    flex: 1;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.global-search {
    position: relative;
}
.global-search input {
    width: 240px;
    padding: 8px 36px 8px 12px;
    border: 1px solid var(--border);
    border-radius: 20px;
    font-size: 13px;
    outline: none;
    transition: border-color 0.2s;
}
.global-search input:focus {
    border-color: var(--primary);
}
.global-search i {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.icon-btn {
    background: none;
    border: none;
    font-size: 16px;
    color: var(--text-regular);
    cursor: pointer;
    padding: 8px;
    border-radius: 6px;
    position: relative;
}
.icon-btn:hover { background: var(--bg); }

.badge {
    position: absolute;
    top: 2px;
    right: 2px;
    background: var(--danger);
    color: #fff;
    font-size: 10px;
    padding: 1px 5px;
    border-radius: 10px;
    line-height: 1.3;
}

.user-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 13px;
    color: var(--text-regular);
}
.user-btn:hover { background: var(--bg); }

.user-menu {
    position: relative;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: var(--shadow);
    min-width: 160px;
    z-index: 100;
    padding: 4px 0;
}
.dropdown-menu a {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    color: var(--text-regular);
    font-size: 13px;
}
.dropdown-menu a:hover {
    background: var(--bg);
    color: var(--primary);
}

/* ============================================================
   内容区
   ============================================================ */
.content-area {
    padding: 24px;
}

/* ============================================================
   仪表盘
   ============================================================ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: #fff;
    border-radius: var(--card-radius);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: var(--shadow);
    transition: transform 0.2s, box-shadow 0.2s;
}
.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

.stat-icon {
    width: 52px;
    height: 52px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    color: #fff;
}
.stat-primary .stat-icon { background: linear-gradient(135deg, var(--primary), var(--primary-dark)); }
.stat-warning .stat-icon { background: linear-gradient(135deg, #f6d365, #fda085); }
.stat-info .stat-icon { background: linear-gradient(135deg, #89f7fe, #66a6ff); }
.stat-success .stat-icon { background: linear-gradient(135deg, #a8e063, #56ab2f); }
.stat-purple .stat-icon { background: linear-gradient(135deg, #a18cd1, #fbc2eb); }
.stat-danger .stat-icon { background: linear-gradient(135deg, #ff6b6b, #ee5a24); }
.stat-orange .stat-icon { background: linear-gradient(135deg, #f093fb, #f5576c); }
.stat-teal .stat-icon { background: linear-gradient(135deg, #4facfe, #00f2fe); }

.stat-info {
    display: flex;
    flex-direction: column;
}
.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}
.stat-label {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* 快捷操作 */
.quick-actions {
    background: #fff;
    border-radius: var(--card-radius);
    padding: 20px;
    margin-bottom: 24px;
    box-shadow: var(--shadow);
}
.quick-actions h3 {
    font-size: 16px;
    margin-bottom: 16px;
    color: var(--text-primary);
}
.action-btns {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}
.action-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 18px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    border-radius: 8px;
    font-size: 13px;
    transition: opacity 0.2s, transform 0.2s;
}
.action-btn:hover {
    opacity: 0.9;
    transform: translateY(-1px);
    color: #fff;
}

/* 仪表盘行 */
.dashboard-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-bottom: 24px;
}

.dashboard-card {
    background: #fff;
    border-radius: var(--card-radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    margin-bottom: 24px;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}
.card-header h3 {
    font-size: 15px;
    font-weight: 600;
}
.card-link {
    font-size: 13px;
    color: var(--primary);
}

.card-body {
    padding: 16px 20px;
}

/* ============================================================
   表格
   ============================================================ */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.data-table th {
    background: #f8f9fc;
    padding: 12px 14px;
    text-align: left;
    font-weight: 600;
    color: var(--text-regular);
    border-bottom: 2px solid var(--border);
    white-space: nowrap;
}
.data-table td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    color: var(--text-regular);
}
.data-table tr:hover td {
    background: #f8f9fc;
}
.data-table .text-center {
    text-align: center;
}

/* ============================================================
   状态标签
   ============================================================ */
.status-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}
.status-pending { background: #fdf6ec; color: var(--warning); }
.status-processing { background: #ecf5ff; color: #409eff; }
.status-completed { background: #f0f9eb; color: var(--success); }
.status-cancelled { background: #fef0f0; color: var(--danger); }

.badge-danger {
    background: var(--danger);
    color: #fff;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
}

.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }

/* ============================================================
   按钮
   ============================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 18px;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}
.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
}
.btn-primary:hover { opacity: 0.9; }
.btn-secondary {
    background: #fff;
    color: var(--primary);
    border: 1px solid var(--primary);
}
.btn-secondary:hover { background: #f0f0ff; }
.btn-danger {
    background: var(--danger);
    color: #fff;
}
.btn-danger:hover { opacity: 0.9; }
.btn-sm {
    padding: 5px 12px;
    font-size: 12px;
}

/* ============================================================
   表单
   ============================================================ */
.form-group {
    margin-bottom: 16px;
}
.form-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-regular);
}
.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* ============================================================
   Toast 通知
   ============================================================ */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.toast {
    padding: 12px 20px;
    border-radius: 8px;
    color: #fff;
    font-size: 13px;
    box-shadow: var(--shadow);
    animation: toastIn 0.3s ease;
    max-width: 360px;
}
.toast-success { background: var(--success); }
.toast-error { background: var(--danger); }
.toast-warning { background: var(--warning); }
.toast-info { background: var(--primary); }

@keyframes toastIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* ============================================================
   响应式
   ============================================================ */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar-collapsed .sidebar {
        transform: translateX(0);
        width: var(--sidebar-width);
    }
    .main-content {
        margin-left: 0;
    }
    .dashboard-row {
        grid-template-columns: 1fr;
    }
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .global-search {
        display: none;
    }
}
