/* ============================================
   新苏盟采购管理系统 - 全局样式
   色系：与官网一致，以 #0A2463 深海军蓝为主色
   ============================================ */

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
    color: #1E293B; line-height: 1.6; background: #F1F5F9;
}
a { text-decoration: none; color: inherit; }
ul { list-style: none; }

/* ========== 登录页 ========== */
.login-page {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, #0A2463 0%, #1E3A8A 50%, #1D4ED8 100%);
    position: relative; overflow: hidden;
}
.login-bg-pattern {
    position: absolute; inset: 0;
    background-image:
        linear-gradient(rgba(255,255,255,0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,0.03) 1px, transparent 1px);
    background-size: 40px 40px;
}
.login-container { position: relative; z-index: 1; width: 100%; max-width: 440px; padding: 20px; }
.login-card {
    background: #fff; border-radius: 20px; padding: 48px 40px;
    box-shadow: 0 24px 64px rgba(0,0,0,0.25);
}
.login-header { text-align: center; margin-bottom: 36px; }
.login-logo {
    width: 72px; height: 72px; margin: 0 auto 20px; border-radius: 20px;
    background: linear-gradient(135deg, #0A2463, #2563EB);
    display: flex; align-items: center; justify-content: center;
    font-size: 32px; color: #fff; box-shadow: 0 8px 24px rgba(37,99,235,0.35);
}
.login-header h1 { color: #0A2463; font-size: 22px; margin-bottom: 6px; }
.login-header p { color: #94A3B8; font-size: 14px; }
.login-error {
    background: #FEE2E2; color: #DC2626; padding: 12px 16px; border-radius: 10px;
    margin-bottom: 20px; font-size: 14px; display: flex; align-items: center; gap: 8px;
}
.login-form .form-group { margin-bottom: 20px; }
.login-form label {
    display: block; font-size: 14px; font-weight: 600; color: #475569; margin-bottom: 8px;
}
.login-form input {
    width: 100%; padding: 12px 16px; border: 2px solid #E2E8F0; border-radius: 10px;
    font-size: 15px; transition: border-color 0.2s; outline: none;
}
.login-form input:focus { border-color: #3B82F6; }
.login-btn {
    width: 100%; padding: 14px; border: none; border-radius: 10px;
    background: linear-gradient(135deg, #0A2463, #2563EB); color: #fff;
    font-size: 16px; font-weight: 600; cursor: pointer; transition: opacity 0.2s;
    display: flex; align-items: center; justify-content: center; gap: 8px;
}
.login-btn:hover { opacity: 0.92; }
.login-footer {
    margin-top: 28px; text-align: center; font-size: 13px; color: #94A3B8;
    display: flex; flex-direction: column; gap: 8px;
}
.login-footer a { color: #2563EB; font-weight: 500; }

/* ========== 仪表盘布局 ========== */
.app-navbar {
    background: linear-gradient(135deg, #0A2463, #1E3A8A);
    color: #fff; padding: 0 28px; height: 64px;
    display: flex; align-items: center; justify-content: space-between;
    position: sticky; top: 0; z-index: 100; box-shadow: 0 2px 12px rgba(10,36,99,0.2);
}
.app-navbar .nav-brand { display: flex; align-items: center; gap: 12px; }
.app-navbar .nav-brand i {
    width: 40px; height: 40px; border-radius: 10px; background: rgba(255,255,255,0.15);
    display: flex; align-items: center; justify-content: center; font-size: 20px;
}
.app-navbar .nav-brand span { font-size: 17px; font-weight: 700; }
.app-navbar .nav-user { display: flex; align-items: center; gap: 16px; }
.app-navbar .nav-user .user-info { text-align: right; font-size: 13px; }
.app-navbar .nav-user .user-info strong { font-size: 14px; }
.app-navbar .nav-user .user-info .role-tag {
    display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 11px; margin-left: 6px;
}
.app-navbar .nav-user .role-tag.admin { background: #F59E0B; color: #fff; }
.app-navbar .nav-user .role-tag.operator { background: #3B82F6; color: #fff; }
.app-navbar .nav-user .role-tag.viewer { background: #059669; color: #fff; }
.app-navbar .nav-user .user-avatar {
    width: 38px; height: 38px; border-radius: 50%; background: rgba(255,255,255,0.2);
    display: flex; align-items: center; justify-content: center; font-size: 16px;
}
.nav-logout {
    padding: 8px 16px; border-radius: 8px; background: rgba(255,255,255,0.1);
    color: #fff; font-size: 13px; transition: background 0.2s;
}
.nav-logout:hover { background: rgba(255,255,255,0.2); }

/* 标签导航 */
.app-tabs {
    background: #fff; padding: 0 28px; display: flex; gap: 4px;
    border-bottom: 1px solid #E2E8F0; position: sticky; top: 64px; z-index: 99;
}
.app-tab {
    padding: 14px 24px; font-size: 14px; font-weight: 600; color: #64748B;
    cursor: pointer; border-bottom: 3px solid transparent; transition: all 0.2s;
    display: flex; align-items: center; gap: 8px;
}
.app-tab:hover { color: #2563EB; }
.app-tab.active { color: #0A2463; border-bottom-color: #0A2463; }
.app-tab i { font-size: 16px; }

/* 主内容区 */
.app-main { padding: 24px 28px; max-width: 1600px; margin: 0 auto; }

/* ========== 统计卡片 ========== */
.stats-bar { display: flex; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.stat-card {
    background: #fff; border-radius: 12px; padding: 20px 24px; flex: 1; min-width: 200px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04); display: flex; align-items: center; gap: 16px;
}
.stat-card .stat-icon {
    width: 52px; height: 52px; border-radius: 14px; display: flex;
    align-items: center; justify-content: center; font-size: 22px; color: #fff; flex-shrink: 0;
}
.stat-card .stat-icon.blue { background: linear-gradient(135deg, #0A2463, #2563EB); }
.stat-card .stat-icon.green { background: linear-gradient(135deg, #059669, #10B981); }
.stat-card .stat-icon.orange { background: linear-gradient(135deg, #D97706, #F59E0B); }
.stat-card .stat-info .stat-label { font-size: 13px; color: #94A3B8; }
.stat-card .stat-info .stat-value { font-size: 24px; font-weight: 700; color: #1E293B; }

/* ========== 工具栏 ========== */
.toolbar {
    background: #fff; border-radius: 12px 12px 0 0; padding: 16px 20px;
    display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
    border: 1px solid #E2E8F0; border-bottom: none;
}
.toolbar .search-box {
    position: relative; flex: 1; min-width: 200px;
}
.toolbar .search-box i {
    position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
    color: #94A3B8; font-size: 14px;
}
.toolbar .search-box input {
    width: 100%; padding: 10px 12px 10px 38px; border: 1px solid #E2E8F0;
    border-radius: 8px; font-size: 14px; outline: none; transition: border-color 0.2s;
}
.toolbar .search-box input:focus { border-color: #3B82F6; }
.btn {
    padding: 10px 16px; border: none; border-radius: 8px; font-size: 14px; font-weight: 600;
    cursor: pointer; transition: all 0.2s; display: inline-flex; align-items: center; gap: 6px;
}
.btn-primary { background: #2563EB; color: #fff; }
.btn-primary:hover { background: #1D4ED8; }
.btn-success { background: #059669; color: #fff; }
.btn-success:hover { background: #047857; }
.btn-danger { background: #DC2626; color: #fff; }
.btn-danger:hover { background: #B91C1C; }
.btn-outline { background: #fff; color: #475569; border: 1px solid #E2E8F0; }
.btn-outline:hover { border-color: #3B82F6; color: #2563EB; }
.btn-sm { padding: 6px 10px; font-size: 12px; }

/* 筛选区 */
.filter-bar {
    background: #fff; padding: 16px 20px; border-left: 1px solid #E2E8F0; border-right: 1px solid #E2E8F0;
    display: none; flex-wrap: wrap; gap: 12px;
}
.filter-bar.show { display: flex; }
.filter-group { display: flex; flex-direction: column; gap: 4px; }
.filter-group label { font-size: 12px; color: #64748B; font-weight: 600; }
.filter-group input, .filter-group select {
    padding: 8px 10px; border: 1px solid #E2E8F0; border-radius: 6px; font-size: 13px; outline: none;
}
.filter-group input:focus, .filter-group select:focus { border-color: #3B82F6; }

/* 列选择 */
.col-select {
    background: #fff; padding: 12px 20px; border-left: 1px solid #E2E8F0; border-right: 1px solid #E2E8F0;
    display: none; flex-wrap: wrap; gap: 8px; align-items: center;
}
.col-select.show { display: flex; }
.col-select .col-label { font-size: 13px; color: #64748B; font-weight: 600; margin-right: 4px; }
.col-chip {
    padding: 5px 12px; border-radius: 20px; font-size: 12px; font-weight: 600;
    background: #F1F5F9; color: #64748B; cursor: pointer; transition: all 0.2s; user-select: none;
}
.col-chip.active { background: #DBEAFE; color: #1D4ED8; }
.col-chip:hover { opacity: 0.85; }

/* ========== 数据表格 ========== */
.table-wrap {
    background: #fff; border: 1px solid #E2E8F0; border-radius: 0 0 12px 12px; overflow-x: auto;
}
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table thead { background: #F8FAFC; }
.data-table th {
    padding: 12px 14px; text-align: left; font-weight: 700; color: #475569;
    border-bottom: 2px solid #E2E8F0; white-space: nowrap; cursor: pointer; position: relative;
}
.data-table th:hover { color: #2563EB; }
.data-table th .sort-icon { margin-left: 4px; opacity: 0.4; font-size: 11px; }
.data-table th.sorted .sort-icon { opacity: 1; color: #2563EB; }
.data-table td {
    padding: 10px 14px; border-bottom: 1px solid #F1F5F9; color: #334155;
}
.data-table tbody tr:hover { background: #F8FAFC; }
.data-table .text-right { text-align: right; }
.data-table .text-center { text-align: center; }
.data-table .price { font-weight: 600; color: #0A2463; }
.data-table .empty-row td { text-align: center; padding: 40px; color: #94A3B8; }
.data-table .row-checkbox { width: 40px; text-align: center; }
.data-table .actions { white-space: nowrap; }
.data-table .actions button { padding: 4px 8px; margin-right: 4px; border-radius: 6px; font-size: 12px; }

/* 分页 */
.pagination {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 20px; background: #fff; border-radius: 0 0 12px 12px; flex-wrap: wrap; gap: 12px;
}
.pagination .page-info { font-size: 13px; color: #64748B; }
.pagination .page-btns { display: flex; gap: 4px; }
.pagination .page-btn {
    padding: 6px 12px; border: 1px solid #E2E8F0; border-radius: 6px; background: #fff;
    cursor: pointer; font-size: 13px; color: #475569; transition: all 0.2s;
}
.pagination .page-btn:hover:not(:disabled) { border-color: #3B82F6; color: #2563EB; }
.pagination .page-btn.active { background: #0A2463; color: #fff; border-color: #0A2463; }
.pagination .page-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ========== 弹窗 ========== */
.modal-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 1000;
    display: none; align-items: center; justify-content: center; padding: 20px;
}
.modal-overlay.show { display: flex; }
.modal {
    background: #fff; border-radius: 16px; width: 100%; max-width: 640px;
    max-height: 90vh; overflow-y: auto; box-shadow: 0 24px 64px rgba(0,0,0,0.25);
}
.modal-header {
    padding: 20px 24px; border-bottom: 1px solid #E2E8F0; display: flex;
    align-items: center; justify-content: space-between; position: sticky; top: 0; background: #fff; z-index: 1;
}
.modal-header h3 { color: #0A2463; font-size: 18px; }
.modal-header .close-btn {
    width: 32px; height: 32px; border: none; background: #F1F5F9; border-radius: 8px;
    cursor: pointer; font-size: 16px; color: #64748B; transition: all 0.2s;
}
.modal-header .close-btn:hover { background: #FEE2E2; color: #DC2626; }
.modal-body { padding: 24px; }
.modal-footer {
    padding: 16px 24px; border-top: 1px solid #E2E8F0; display: flex;
    justify-content: flex-end; gap: 10px; position: sticky; bottom: 0; background: #fff;
}

/* 表单网格 */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-grid .full { grid-column: 1 / -1; }
.form-field { display: flex; flex-direction: column; gap: 6px; }
.form-field label { font-size: 13px; font-weight: 600; color: #475569; }
.form-field label .required { color: #DC2626; }
.form-field input, .form-field textarea, .form-field select {
    padding: 10px 12px; border: 1px solid #E2E8F0; border-radius: 8px; font-size: 14px; outline: none;
    font-family: inherit; transition: border-color 0.2s;
}
.form-field input:focus, .form-field textarea:focus, .form-field select:focus { border-color: #3B82F6; }
.form-field textarea { resize: vertical; min-height: 60px; }
.form-field .hint { font-size: 12px; color: #94A3B8; }
.form-field .price-display {
    padding: 10px 12px; background: #F0F7FF; border-radius: 8px; font-size: 16px;
    font-weight: 700; color: #0A2463; text-align: center;
}

/* ========== 导入区域 ========== */
.import-zone {
    border: 2px dashed #CBD5E1; border-radius: 16px; padding: 48px 24px; text-align: center;
    transition: all 0.3s; cursor: pointer; background: #F8FAFC;
}
.import-zone:hover, .import-zone.dragover { border-color: #3B82F6; background: #EFF6FF; }
.import-zone .import-icon { font-size: 48px; color: #3B82F6; margin-bottom: 16px; }
.import-zone h3 { color: #0A2463; font-size: 18px; margin-bottom: 8px; }
.import-zone p { color: #94A3B8; font-size: 14px; margin-bottom: 20px; }
.import-zone .file-name { color: #059669; font-weight: 600; margin-top: 8px; }
.import-info {
    margin-top: 24px; padding: 20px; background: #fff; border-radius: 12px;
    border: 1px solid #E2E8F0; display: none;
}
.import-info.show { display: block; }
.import-info h4 { color: #0A2463; margin-bottom: 12px; font-size: 15px; }
.import-info ul { padding-left: 20px; color: #64748B; font-size: 13px; line-height: 2; }
.import-result { margin-top: 16px; padding: 16px; border-radius: 8px; display: none; }
.import-result.show { display: block; }
.import-result.success { background: #DCFCE7; color: #16A34A; }
.import-result.error { background: #FEE2E2; color: #DC2626; }
.template-download {
    margin-top: 16px; text-align: center; font-size: 13px; color: #64748B;
}
.template-download a { color: #2563EB; font-weight: 600; }

/* ========== 用户管理 ========== */
.user-table th, .user-table td { text-align: center; }
.user-table .user-role-tag {
    padding: 3px 10px; border-radius: 6px; font-size: 12px; font-weight: 600;
}
.user-table .user-role-tag.admin { background: #FEF3C7; color: #B45309; }
.user-table .user-role-tag.operator { background: #DBEAFE; color: #1D4ED8; }
.user-table .user-role-tag.viewer { background: #D1FAE5; color: #047857; }
.user-table .status-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; }
.user-table .status-dot.active { background: #10B981; }
.user-table .status-dot.disabled { background: #EF4444; }

/* ========== 提示消息 ========== */
.toast {
    position: fixed; top: 80px; right: 24px; z-index: 2000;
    padding: 14px 20px; border-radius: 10px; font-size: 14px; font-weight: 600;
    box-shadow: 0 8px 24px rgba(0,0,0,0.15); display: flex; align-items: center; gap: 8px;
    transform: translateX(120%); transition: transform 0.3s ease;
}
.toast.show { transform: translateX(0); }
.toast.success { background: #DCFCE7; color: #16A34A; border: 1px solid #16A34A; }
.toast.error { background: #FEE2E2; color: #DC2626; border: 1px solid #DC2626; }
.toast.info { background: #DBEAFE; color: #1D4ED8; border: 1px solid #1D4ED8; }

/* ========== 响应式 ========== */
@media (max-width: 768px) {
    .app-navbar { padding: 0 16px; }
    .app-navbar .nav-brand span { font-size: 14px; }
    .app-navbar .nav-user .user-info { display: none; }
    .app-tabs { padding: 0 8px; overflow-x: auto; }
    .app-tab { padding: 12px 14px; font-size: 13px; white-space: nowrap; }
    .app-main { padding: 16px; }
    .form-grid { grid-template-columns: 1fr; }
    .stats-bar { flex-direction: column; }
    .stat-card { min-width: auto; }
    .toolbar { border-radius: 12px 12px 0 0; }
    .data-table { font-size: 12px; }
    .data-table th, .data-table td { padding: 8px 10px; }
    .modal { max-height: 100vh; border-radius: 0; }
}
