/* ============================================================
   Carbon Hub 全局样式
   ============================================================ */

/* ===== 全局重置 ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
    background: #f0f2f5;
    height: 100vh;
    overflow: hidden;
    font-size: 14px;
    color: #262626;
}

/* ===== 顶部导航 ===== */
.navbar {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    color: white;
    padding: 0 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 56px;
    flex-shrink: 0;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}
.navbar .brand {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 18px;
    font-weight: 600;
    letter-spacing: 1px;
}
.navbar .brand .logo-icon { font-size: 24px; }
.navbar .brand .logo-text {
    background: linear-gradient(135deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.navbar .nav-right {
    display: flex;
    align-items: center;
    gap: 20px;
    font-size: 13px;
}
.navbar .status-badge {
    background: rgba(255,255,255,0.12);
    padding: 4px 14px;
    border-radius: 20px;
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.navbar .status-badge .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #52c41a;
    display: inline-block;
    animation: pulse-dot 2s infinite;
}
@keyframes pulse-dot {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

/* ===== 主体布局 ===== */
.app-container {
    display: flex;
    height: calc(100vh - 56px);
    overflow: hidden;
}

/* ===== 左侧菜单 ===== */
.sidebar {
    flex: 0 0 200px;
    background: #1a1a2e;
    color: #a0a0b0;
    display: flex;
    flex-direction: column;
    padding: 12px 0;
    overflow-y: auto;
}
.sidebar::-webkit-scrollbar { width: 3px; }
.sidebar::-webkit-scrollbar-thumb { background: #3a3a5a; border-radius: 3px; }
.sidebar .menu-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 8px 20px 4px 20px;
    color: #5a5a7a;
}
.sidebar .menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 20px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 14px;
    color: #8a8aa0;
    border-left: 3px solid transparent;
    text-decoration: none;
}
.sidebar .menu-item:hover {
    background: rgba(255,255,255,0.05);
    color: #ffffff;
}
.sidebar .menu-item.active {
    background: rgba(102, 126, 234, 0.15);
    color: #ffffff;
    border-left-color: #667eea;
}
.sidebar .menu-item .icon { font-size: 18px; width: 24px; text-align: center; flex-shrink:0; }
.sidebar .menu-item .label { flex:1; }
.sidebar .menu-item .arrow {
    font-size: 24px;
    line-height: 1;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #5a5a7a;
    transition: transform 0.2s;
    margin-left: 4px;
    flex-shrink: 0;
}
.sidebar .menu-item .arrow.open { transform: rotate(180deg); }
.sidebar .menu-item .badge {
    margin-left: auto;
    background: rgba(255,255,255,0.08);
    padding: 1px 10px;
    border-radius: 12px;
    font-size: 11px;
    color: #6a6a8a;
}
.sidebar .submenu {
    padding-left: 12px;
    display: none;
}
.sidebar .submenu.open { display: block; }
.sidebar .menu-item.sub {
    padding: 6px 20px 6px 32px;
    font-size: 13px;
    border-left: 2px solid transparent;
}
.sidebar .menu-item.sub:hover { border-left-color: #667eea; }
.sidebar .menu-item.sub .icon { font-size: 14px; width: 20px; }
.sidebar .menu-divider {
    height: 1px;
    background: rgba(255,255,255,0.05);
    margin: 8px 16px;
}

/* ===== 侧边栏折叠 ===== */
.sidebar.collapsed {
    flex: 0 0 56px;
}
.sidebar.collapsed .menu-label,
.sidebar.collapsed .menu-item .label,
.sidebar.collapsed .menu-item .arrow,
.sidebar.collapsed .menu-item .badge {
    display: none;
}
.sidebar.collapsed .menu-item {
    justify-content: center;
    padding: 12px;
}
.sidebar.collapsed .submenu {
    display: none !important;
}
.sidebar.collapsed .sidebar-footer .collapse-text {
    display: none;
}

.sidebar-footer {
    margin-top: auto;
    padding: 10px 16px;
    border-top: 1px solid rgba(255,255,255,0.08);
}
.sidebar-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 6px 8px;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 6px;
    color: #6a6a8a;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s;
}
.sidebar-toggle:hover {
    background: rgba(255,255,255,0.08);
    color: #a0a0b0;
}
.sidebar-toggle .collapse-icon {
    flex-shrink: 0;
    transition: transform 0.2s;
}
.sidebar.collapsed .sidebar-toggle .collapse-icon {
    transform: rotate(180deg);
}
.sidebar.collapsed .sidebar-toggle .collapse-text {
    display: none;
}

/* ===== 右侧内容区 ===== */
.content-area {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
    background: #f0f2f5;
}
.content-area::-webkit-scrollbar { width: 4px; }
.content-area::-webkit-scrollbar-thumb { background: #d9d9d9; border-radius: 4px; }

/* ===== 页面头部 ===== */
.page-header {
    margin-bottom: 16px;
}
.page-header h2 {
    font-size: 20px;
    font-weight: 600;
    color: #1a1a2e;
}
.page-header .subtitle {
    font-size: 13px;
    color: #8c8c8c;
    margin-top: 2px;
}

/* ===== 通用卡片 ===== */
.card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    padding: 16px 20px;
}
.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 12px;
    border-bottom: 1px solid #f0f0f0;
    margin-bottom: 12px;
}
.card-header h3 {
    font-size: 15px;
    font-weight: 600;
    color: #262626;
}

/* ===== 统计卡片 ===== */
.stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}
.stat-card {
    background: white;
    padding: 14px 18px;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.stat-card .stat-label {
    font-size: 12px;
    color: #8c8c8c;
}
.stat-card .stat-value {
    font-size: 26px;
    font-weight: 600;
    margin-top: 2px;
}
.stat-card .stat-value.blue { color: #1890ff; }
.stat-card .stat-value.green { color: #52c41a; }
.stat-card .stat-value.orange { color: #faad14; }
.stat-card .stat-value.red { color: #ff4d4f; }
.stat-card .stat-value.purple { color: #722ed1; }

/* ===== 表格 ===== */
.table-wrap {
    overflow-x: auto;
}
table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}
table th {
    background: #fafafa;
    text-align: left;
    padding: 10px 14px;
    font-weight: 600;
    border-bottom: 2px solid #e8e8e8;
    position: sticky;
    top: 0;
    z-index: 2;
    font-size: 13px;
    color: #595959;
    white-space: nowrap;
}
table td {
    padding: 10px 14px;
    border-bottom: 1px solid #f0f0f0;
    font-size: 14px;
    color: #262626;
    vertical-align: middle;
}
table tr:hover td {
    background: #f8f9fc;
}

/* ===== 表格内容居中 ===== */
.table-wrap table th,
.table-wrap table td {
    text-align: center;
}
.table-wrap table td {
    white-space: nowrap;
}

/* ===== 备注列左对齐 ===== */
.table-wrap table td.remark-col,
.table-wrap table td.remark-col input,
.table-wrap table td.remark-col textarea {
    text-align: left !important;
    white-space: normal !important;
}

/* ===== 状态徽章 ===== */
.status-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 12px;
}
.status-badge.实测 { background: #e6f7e6; color: #52c41a; }
.status-badge.估算 { background: #fff7e6; color: #faad14; }
.status-badge.缺数 { background: #fff1f0; color: #ff4d4f; }
.status-badge.draft { background: #e6f7ff; color: #1890ff; }
.status-badge.submitted { background: #fff7e6; color: #faad14; }
.status-badge.verified { background: #e6f7e6; color: #52c41a; }

/* ===== 按钮 - 统一尺寸 ===== */
.btn {
    cursor: pointer;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    padding: 6px 18px;
    transition: all 0.2s;
    display: inline-block;
    line-height: 1.5;
    text-align: center;
}
.btn-primary { background: #667eea; color: white; }
.btn-primary:hover { background: #5a6fd6; }
.btn-secondary { background: #f5f5f5; color: #262626; }
.btn-secondary:hover { background: #e8e8e8; }
.btn-success { background: #52c41a; color: white; }
.btn-success:hover { background: #45a817; }
.btn-danger { background: #ff4d4f; color: white; }
.btn-danger:hover { background: #e04345; }
.btn-warning { background: #faad14; color: white; }
.btn-warning:hover { background: #e09e12; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* 小号按钮（表格内） */
.btn-sm {
    padding: 4px 14px;
    font-size: 13px;
    border-radius: 4px;
}
/* 超小号按钮（特殊场景） */
.btn-xs {
    padding: 4px 12px;
    font-size: 12px;
    border-radius: 4px;
}

.table-wrap table td .btn-xs {
    margin-right: 8px;
}
.table-wrap table td .btn-xs:last-child {
    margin-right: 0;
}

/* ===== 表单 ===== */
.form-group { margin-bottom: 14px; }
.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 4px;
    color: #595959;
}
.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #d9d9d9;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.2s;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102,126,234,0.15);
}
.form-group textarea { resize: vertical; }
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px 20px;
}

/* ===== 模态框 ===== */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}
.modal-overlay.active { display: flex; }
.modal {
    background: white;
    border-radius: 14px;
    padding: 28px 32px;
    max-width: 700px;
    width: 92%;
    box-shadow: 0 12px 48px rgba(0,0,0,0.25);
    max-height: 95vh;
    min-height: 400px;
    overflow-y: auto;
}
.modal .modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 18px;
    border-bottom: 1px solid #f0f0f0;
    padding-bottom: 14px;
}
.modal .modal-header h3 { font-size: 18px; font-weight: 600; }
.modal .modal-header .close-btn {
    background: none;
    border: none;
    font-size: 22px;
    cursor: pointer;
    color: #8c8c8c;
    padding: 0 6px;
}
.modal .modal-header .close-btn:hover { color: #262626; }
.modal .form-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 18px;
}


/* ===== Toast ===== */
.toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.8);
    color: white;
    padding: 10px 28px;
    border-radius: 8px;
    font-size: 14px;
    z-index: 2000;
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
}
.toast.show { opacity: 1; }

/* ===== 持久通知 ===== */
.notify-bar {
    position: fixed;
    top: 64px;
    right: 20px;
    z-index: 1500;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: 380px;
}
.notify-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 16px;
    border-radius: 8px;
    background: white;
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
    font-size: 14px;
    line-height: 1.5;
    animation: notify-slide-in 0.3s ease;
}
.notify-item .notify-msg { flex: 1; word-break: break-all; }
.notify-item .notify-close {
    background: none;
    border: none;
    font-size: 16px;
    cursor: pointer;
    color: #8c8c8c;
    padding: 0 2px;
    flex-shrink: 0;
}
.notify-item .notify-close:hover { color: #262626; }
.notify-item.notify-info { border-left: 4px solid #1890ff; }
.notify-item.notify-success { border-left: 4px solid #52c41a; }
.notify-item.notify-error { border-left: 4px solid #ff4d4f; }
@keyframes notify-slide-in {
    from { opacity: 0; transform: translateX(40px); }
    to { opacity: 1; transform: translateX(0); }
}

/* ===== 空状态 ===== */
.empty {
    text-align: center;
    color: #8c8c8c;
    padding: 30px 0;
}

/* ===== 分页 ===== */
.pagination {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 0;
    flex-wrap: wrap;
}
.pagination button {
    padding: 4px 12px;
    border: 1px solid #d9d9d9;
    border-radius: 4px;
    background: white;
    cursor: pointer;
    font-size: 13px;
}
.pagination button:hover { background: #f0f0f0; }
.pagination button.active {
    background: #667eea;
    color: white;
    border-color: #667eea;
}
.pagination button:disabled { opacity: 0.5; cursor: not-allowed; }
.pagination .page-info {
    font-size: 13px;
    color: #8c8c8c;
    margin-left: 8px;
}

/* ===== 响应式 ===== */
@media (max-width: 820px) {
    .sidebar { flex: 0 0 56px; }
    .sidebar .menu-item .label { display: none; }
    .sidebar .menu-item .arrow { display: none; }
    .sidebar .menu-item { justify-content: center; padding: 12px; }
    .sidebar .menu-label { display: none; }
    .sidebar .submenu { padding-left: 0; }
    .sidebar .menu-item.sub { padding: 6px 0; justify-content: center; }
    .form-row { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
    .navbar .brand { font-size: 15px; }
    .sidebar { flex: 0 0 48px; }
    .stats-row { grid-template-columns: 1fr 1fr; }
}