/**
 * 供应链管理系统 - 全局样式
 * 深色主题，复刻设计稿风格
 */

/* CSS变量定义 */
:root {
    --bg-primary: #0f1419;
    --bg-secondary: #1a2332;
    --bg-card: #1e293b;
    --bg-card-hover: #243447;
    --bg-sidebar: #111827;
    --border-color: #2d3748;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --accent-primary: #3b82f6;
    --accent-success: #10b981;
    --accent-warning: #f59e0b;
    --accent-danger: #ef4444;
    --accent-info: #06b6d4;
    --gradient-primary: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    --gradient-success: linear-gradient(135deg, #10b981 0%, #059669 100%);
    --gradient-warning: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    --gradient-danger: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    --shadow-card: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4), 0 4px 6px -2px rgba(0, 0, 0, 0.3);
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --sidebar-width: 220px;
    --header-height: 60px;
}

/* 基础重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    font-family: 'Microsoft YaHei', 'PingFang SC', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 14px;
    color: var(--text-primary);
    background-color: var(--bg-primary);
    line-height: 1.5;
}

a {
    color: var(--accent-primary);
    text-decoration: none;
    transition: color 0.2s;
}

a:hover {
    color: #60a5fa;
}

/* 滚动条样式 */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* 布局 */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* 侧边栏 */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 100;
    transition: transform 0.3s ease;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-logo {
    width: 36px;
    height: 36px;
    background: var(--gradient-primary);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: bold;
    color: white;
}

.sidebar-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.sidebar-subtitle {
    font-size: 12px;
    color: var(--text-muted);
}

.sidebar-menu {
    flex: 1;
    padding: 12px 0;
    overflow-y: auto;
}

.menu-item {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
    border-left: 3px solid transparent;
    gap: 12px;
}

.menu-item:hover {
    background: rgba(59, 130, 246, 0.1);
    color: var(--text-primary);
}

.menu-item.active {
    background: rgba(59, 130, 246, 0.15);
    color: var(--accent-primary);
    border-left-color: var(--accent-primary);
}

.menu-item i {
    width: 20px;
    text-align: center;
    font-size: 16px;
}

.menu-item span {
    font-size: 14px;
}

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border-color);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--gradient-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    color: white;
    font-weight: 600;
}

.user-details {
    flex: 1;
    min-width: 0;
}

.user-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-role {
    font-size: 11px;
    color: var(--text-muted);
}

/* 主内容区 */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* 顶部导航 */
.top-header {
    height: var(--header-height);
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 50;
}

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

.header-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

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

.header-btn {
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.header-btn:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
}

.header-btn.danger {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.3);
    color: var(--accent-danger);
}

.header-btn.danger:hover {
    background: rgba(239, 68, 68, 0.2);
}

/* 页面内容 */
.page-content {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
}

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

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: all 0.3s;
    box-shadow: var(--shadow-card);
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
}

.stat-icon.blue {
    background: rgba(59, 130, 246, 0.15);
    color: var(--accent-primary);
}

.stat-icon.green {
    background: rgba(16, 185, 129, 0.15);
    color: var(--accent-success);
}

.stat-icon.orange {
    background: rgba(245, 158, 11, 0.15);
    color: var(--accent-warning);
}

.stat-icon.red {
    background: rgba(239, 68, 68, 0.15);
    color: var(--accent-danger);
}

.stat-icon.cyan {
    background: rgba(6, 182, 212, 0.15);
    color: var(--accent-info);
}

.stat-info {
    flex: 1;
}

.stat-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

.stat-label {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 4px;
}

.stat-change {
    font-size: 12px;
    font-weight: 500;
    padding: 2px 8px;
    border-radius: 12px;
    margin-top: 6px;
    display: inline-block;
}

.stat-change.up {
    background: rgba(16, 185, 129, 0.15);
    color: var(--accent-success);
}

.stat-change.down {
    background: rgba(239, 68, 68, 0.15);
    color: var(--accent-danger);
}

/* 卡片 */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-card);
    overflow: hidden;
}

.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-title::before {
    content: '';
    width: 4px;
    height: 16px;
    background: var(--gradient-primary);
    border-radius: 2px;
}

.card-body {
    padding: 20px;
}

/* 表格 */
.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.data-table th {
    background: var(--bg-secondary);
    font-weight: 600;
    font-size: 13px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.data-table tbody tr {
    transition: background 0.2s;
}

.data-table tbody tr:hover {
    background: rgba(59, 130, 246, 0.05);
}

.data-table td {
    color: var(--text-primary);
    font-size: 13px;
}

/* 按钮 */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
    white-space: nowrap;
}

.btn-primary {
    background: var(--gradient-primary);
    color: white;
}

.btn-primary:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.btn-success {
    background: var(--gradient-success);
    color: white;
}

.btn-danger {
    background: var(--gradient-danger);
    color: white;
}

.btn-warning {
    background: var(--gradient-warning);
    color: white;
}

.btn-secondary {
    background: var(--bg-secondary);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
}

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

.btn-lg {
    padding: 10px 24px;
    font-size: 14px;
}

/* 表单 */
.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 13px;
    transition: all 0.2s;
    font-family: inherit;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-input::placeholder {
    color: var(--text-muted);
}

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

/* 搜索框 */
.search-box {
    position: relative;
}

.search-box input {
    padding-left: 36px;
    width: 260px;
}

.search-box::before {
    content: '\f002';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 13px;
}

/* 分页 */
.pagination {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 20px;
    justify-content: flex-end;
}

.page-item {
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
    font-size: 13px;
}

.page-item:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
}

.page-item.active {
    background: var(--gradient-primary);
    color: white;
    border-color: transparent;
}

.page-item.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* 标签 */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
}

.badge-primary {
    background: rgba(59, 130, 246, 0.15);
    color: var(--accent-primary);
}

.badge-success {
    background: rgba(16, 185, 129, 0.15);
    color: var(--accent-success);
}

.badge-warning {
    background: rgba(245, 158, 11, 0.15);
    color: var(--accent-warning);
}

.badge-danger {
    background: rgba(239, 68, 68, 0.15);
    color: var(--accent-danger);
}

.badge-info {
    background: rgba(6, 182, 212, 0.15);
    color: var(--accent-info);
}

/* 模态框 */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow: hidden;
    transform: scale(0.95);
    transition: transform 0.3s;
}

.modal-overlay.active .modal {
    transform: scale(1);
}

.modal-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-title {
    font-size: 16px;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 20px;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    transition: all 0.2s;
}

.modal-close:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.modal-body {
    padding: 20px;
    overflow-y: auto;
    max-height: calc(90vh - 130px);
}

.modal-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* 登录页 */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0f1419 0%, #1a2332 50%, #111827 100%);
    position: relative;
    overflow: hidden;
}

.login-page::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(59, 130, 246, 0.05) 0%, transparent 70%);
    animation: rotate 30s linear infinite;
}

@keyframes rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.login-box {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 40px;
    width: 100%;
    max-width: 420px;
    position: relative;
    z-index: 1;
    box-shadow: var(--shadow-lg);
}

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

.login-logo {
    width: 60px;
    height: 60px;
    background: var(--gradient-primary);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    font-size: 28px;
    color: white;
}

.login-title {
    font-size: 22px;
    font-weight: 600;
    margin-bottom: 6px;
}

.login-subtitle {
    color: var(--text-secondary);
    font-size: 13px;
}

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

.login-form .form-input {
    padding: 12px 16px;
    font-size: 14px;
}

.login-btn {
    width: 100%;
    padding: 12px;
    font-size: 15px;
    margin-top: 8px;
}

/* 响应式 */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .search-box input {
        width: 180px;
    }
}

/* 动画 */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.fade-in {
    animation: fadeIn 0.4s ease forwards;
}

/* 列表项 */
.list-item {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    transition: background 0.2s;
}

.list-item:last-child {
    border-bottom: none;
}

.list-item:hover {
    background: rgba(59, 130, 246, 0.05);
}

.list-rank {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    margin-right: 12px;
    flex-shrink: 0;
}

.list-rank.top {
    background: var(--gradient-primary);
    color: white;
}

.list-rank.normal {
    background: var(--bg-secondary);
    color: var(--text-muted);
}

.list-content {
    flex: 1;
    min-width: 0;
}

.list-title {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.list-subtitle {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

.list-value {
    font-size: 14px;
    font-weight: 600;
    color: var(--accent-primary);
    flex-shrink: 0;
    margin-left: 12px;
}

/* 进度条 */
.progress-bar {
    height: 6px;
    background: var(--bg-secondary);
    border-radius: 3px;
    overflow: hidden;
    margin-top: 8px;
}

.progress-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.6s ease;
}

.progress-fill.blue {
    background: var(--gradient-primary);
}

.progress-fill.green {
    background: var(--gradient-success);
}

.progress-fill.orange {
    background: var(--gradient-warning);
}

/* 空状态 */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-state i {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state p {
    font-size: 14px;
}

/* 打印样式 */
@media print {
    .sidebar,
    .top-header,
    .no-print {
        display: none !important;
    }
    
    .main-content {
        margin-left: 0 !important;
    }
    
    .page-content {
        padding: 0 !important;
    }
    
    .card {
        border: 1px solid #ddd !important;
        box-shadow: none !important;
    }
}
