/* =====================================================
   爱尔思研发打卡系统 — 自定义样式
   ===================================================== */

/* ── CSS 变量 ── */
:root {
    --brand-dark:   #0d47a1;
    --brand-mid:    #1565c0;
    --brand-light:  #0288d1;
    --sidebar-w:    220px;
    --navbar-h:     56px;
    --sidebar-bg:   #0f2a5e;
    --sidebar-text: rgba(255,255,255,0.82);
    --sidebar-hover-bg: rgba(255,255,255,0.10);
    --sidebar-active-bg: rgba(255,255,255,0.18);
}

/* ── 全局背景 ── */
body {
    padding-top: var(--navbar-h);
    background-color: #f0f4f8;
    min-height: 100vh;
}

/* ── 粒子画布（内容页不使用，仅登录页独立引入） ── */
#app-particles { display: none; }

/* ── 顶部导航栏 ── */
.navbar {
    background: linear-gradient(90deg, var(--brand-dark), var(--brand-mid)) !important;
    box-shadow: 0 2px 12px rgba(0,0,0,0.25);
    z-index: 1030;
}

.navbar-brand {
    font-size: 1.05rem;
    letter-spacing: 0.03em;
}

/* ── 桌面端固定侧边栏 ── */
.sidebar {
    position: fixed;
    top: var(--navbar-h);
    bottom: 0;
    left: 0;
    width: var(--sidebar-w);
    z-index: 100;
    padding: 0;
    overflow-x: hidden;
    overflow-y: auto;
    background: var(--sidebar-bg);
    box-shadow: 2px 0 12px rgba(0,0,0,0.18);
    border-right: none;
}

.sidebar-sticky {
    position: sticky;
    top: 0;
    height: calc(100vh - var(--navbar-h));
    overflow-x: hidden;
    overflow-y: auto;
}

/* ── 侧边栏导航链接 ── */
.sidebar .nav-link,
.sidebar-nav .nav-link {
    color: var(--sidebar-text);
    padding: 0.55rem 1.1rem;
    border-radius: 0.4rem;
    margin: 0.1rem 0.5rem;
    font-size: 0.875rem;
    transition: background-color 0.15s, color 0.15s;
}

.sidebar .nav-link:hover,
.sidebar-nav .nav-link:hover {
    background-color: var(--sidebar-hover-bg);
    color: #fff;
}

.sidebar .nav-link.active,
.sidebar-nav .nav-link.active {
    background-color: var(--sidebar-active-bg);
    color: #fff;
    font-weight: 600;
    box-shadow: inset 3px 0 0 rgba(255,255,255,0.6);
}

/* ── 移动端 Offcanvas 侧边栏 ── */
#sidebarOffcanvas {
    background: var(--sidebar-bg);
}
#sidebarOffcanvas .offcanvas-header {
    background: rgba(0,0,0,0.2);
    color: #fff;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}
#sidebarOffcanvas .offcanvas-title { color: #fff; }
#sidebarOffcanvas .btn-close { filter: invert(1); }

/* ── 页面主体包装 ── */
.page-wrapper {
    position: relative;
    z-index: 1;
}

/* ── 主内容区 ── */
.main-content {
    padding-top: 1.5rem;
    padding-bottom: 1rem;
    min-height: calc(100vh - var(--navbar-h) - 52px);
}

/* 桌面端内容区偏移，为侧边栏留空间 */
@media (min-width: 768px) {
    .col-md-9.ms-sm-auto.main-content,
    .col-lg-10.main-content {
        margin-left: var(--sidebar-w) !important;
        max-width: calc(100% - var(--sidebar-w));
        flex: 0 0 calc(100% - var(--sidebar-w));
    }
    .sidebar.col-md-3,
    .sidebar.col-lg-2 {
        width: var(--sidebar-w) !important;
        max-width: var(--sidebar-w) !important;
        flex: 0 0 var(--sidebar-w) !important;
    }
}

@media (max-width: 767.98px) {
    .sidebar { display: none !important; }
    .main-content {
        padding-left: 1rem;
        padding-right: 1rem;
        margin-left: 0 !important;
        max-width: 100% !important;
        flex: 0 0 100% !important;
    }
}

/* ── 卡片：毛玻璃风格 ── */
.card {
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255,255,255,0.5);
    border-radius: 0.75rem;
    box-shadow: 0 4px 20px rgba(0,0,0,0.10);
}

.card-header {
    background: rgba(255,255,255,0.6);
    border-bottom: 1px solid rgba(0,0,0,0.07);
    border-radius: 0.75rem 0.75rem 0 0 !important;
}

/* ── 表格 ── */
.table {
    background: transparent;
}
.table-light {
    --bs-table-bg: rgba(248,249,250,0.8);
}
.table-hover > tbody > tr:hover > * {
    background-color: rgba(13,110,253,0.06);
}

/* ── 页面标题分隔线 ── */
.border-bottom {
    border-bottom-color: #dee2e6 !important;
}
h1.h2 {
    color: #1a237e;
}

/* ── 按钮微调 ── */
.btn-primary {
    background: linear-gradient(135deg, var(--brand-mid), var(--brand-light));
    border: none;
    box-shadow: 0 2px 8px rgba(13,71,161,0.3);
}
.btn-primary:hover {
    background: linear-gradient(135deg, var(--brand-dark), var(--brand-mid));
    box-shadow: 0 4px 12px rgba(13,71,161,0.4);
}

/* ── 表格横向滚动 ── */
.table-responsive-wrapper,
.table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* ── 通知角标 ── */
#notif-badge {
    font-size: 0.65rem;
    min-width: 1.2em;
    padding: 0.2em 0.4em;
}

/* ── 卡片网格（我的项目） ── */
.project-card {
    transition: box-shadow 0.15s, transform 0.15s;
}
.project-card:hover {
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
    transform: translateY(-2px);
}

/* ── 日历单元格 ── */
.cal-th { font-size: 0.85rem; font-weight: 600; }

.cal-cell {
    cursor: pointer;
    height: 4rem;
    vertical-align: top !important;
    padding: 0.3rem 0.25rem !important;
    position: relative;
    transition: background-color 0.1s;
}
.cal-cell:hover { background-color: rgba(13,110,253,0.08); }
.cal-cell.cal-empty { background-color: rgba(248,249,250,0.5); cursor: default; }
.cal-cell.cal-today .cal-day-num {
    display: inline-flex; align-items: center; justify-content: center;
    width: 1.6rem; height: 1.6rem;
    background-color: #0d6efd; color: #fff;
    border-radius: 50%; font-weight: 700;
}
.cal-cell.cal-has-checkin { background-color: rgba(25,135,84,0.12); }
.cal-cell.cal-selected {
    background-color: rgba(13,110,253,0.15) !important;
    outline: 2px solid #0d6efd; outline-offset: -2px;
}
.cal-day-num { display: block; font-size: 0.85rem; line-height: 1.6rem; }
.cal-badge { display: block; font-size: 0.65rem; margin-top: 0.1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-project-name { font-size: 0.6rem; color: #155724; line-height: 1.2; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 0.05rem; }

@media (max-width: 575.98px) {
    .cal-th { font-size: 0.7rem; padding: 0.2rem 0.1rem !important; }
    .cal-cell { height: 2.8rem; padding: 0.15rem 0.05rem !important; }
    .cal-day-num { font-size: 0.72rem; line-height: 1.4rem; }
    .cal-badge { font-size: 0.55rem; }
    .cal-cell.cal-today .cal-day-num { width: 1.3rem; height: 1.3rem; }
}

/* ── 统计矩阵表格：固定列 ── */
.stats-matrix .sticky-col {
    position: sticky; left: 0;
    background: rgba(255,255,255,0.95); z-index: 1;
    white-space: nowrap; border-right: 1px solid #dee2e6; min-width: 5rem;
}
.stats-matrix .sticky-col2 {
    position: sticky; left: 5rem;
    background: rgba(255,255,255,0.95); z-index: 1;
    white-space: nowrap; border-right: 2px solid #dee2e6; min-width: 8rem;
}
.stats-matrix thead .sticky-col,
.stats-matrix thead .sticky-col2 { background: rgba(248,249,250,0.95); }

/* ── 拖动排序 ── */
.sortable-ghost { opacity: 0.4; }
.sortable-chosen .card { box-shadow: 0 0 0 2px #0d6efd !important; }
.sortable-drag { opacity: 0.9; }
.drag-handle:hover { color: #0d6efd !important; }

/* ── 页面加载遮罩 ── */
#page-loading-overlay { background: rgba(0,0,0,0.3); z-index: 9999; }

/* ── 状态徽章 ── */
.badge-status-pending  { background-color: #ffc107; color: #212529; }
.badge-status-approved { background-color: #198754; color: #fff; }
.badge-status-rejected { background-color: #dc3545; color: #fff; }

/* ── 通用工具 ── */
.cursor-pointer { cursor: pointer; }
.text-truncate-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ── 页脚 ── */
.site-footer {
    position: relative; z-index: 1;
    padding: 0.7rem 1rem;
    text-align: center;
    color: #6c757d;
    font-size: 0.78rem;
    background: #e9eef5;
    border-top: 1px solid #d0d9e8;
}

@media (min-width: 768px) {
    .site-footer { margin-left: var(--sidebar-w); }
}
@media (max-width: 767.98px) {
    .site-footer { margin-left: 0; }
}
