/* ============================================
   养老机构综合管理系统 - 全局样式
   依赖 Bootstrap 5，此为自定义补充样式
   ============================================ */

/* ---------- 全局基础 ---------- */
body {
    background-color: #f8f9fc;
    font-family: 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
    overflow-x: hidden;
}

/* ---------- 导航栏 ---------- */
.navbar-brand {
    font-weight: 600;
    font-size: 1.4rem;
}
.navbar-dark .navbar-nav .nav-link {
    color: rgba(255,255,255,.8);
}
.navbar-dark .navbar-nav .nav-link:hover {
    color: #fff;
}
.dropdown-menu {
    font-size: 0.9rem;
}

/* ---------- 卡片与内容区 ---------- */
.card {
    border: none;
    box-shadow: 0 0.125rem 0.25rem rgba(0,0,0,.075);
    transition: all 0.2s ease-in-out;
}
.card:hover {
    box-shadow: 0 0.5rem 1rem rgba(0,0,0,.15);
}
.card-header {
    background-color: #fff;
    border-bottom: 1px solid rgba(0,0,0,.125);
    font-weight: 600;
}

/* ---------- 表格（Tabulator）样式优化 ---------- */
.tabulator {
    font-size: 0.875rem;
    border-radius: 0.5rem;
    overflow: hidden;
}
.tabulator .tabulator-header .tabulator-col {
    background-color: #f2f4f8;
    font-weight: 600;
}
.tabulator .tabulator-tableHolder .tabulator-table {
    color: #1e293b;
}
.tabulator-row {
    border-bottom: 1px solid #e2e8f0;
}
.tabulator-row.tabulator-selected {
    background-color: #eef2ff;
}

/* ---------- 表单元素 ---------- */
.form-control, .form-select {
    border-radius: 0.375rem;
    border-color: #cbd5e1;
}
.form-control:focus, .form-select:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 0.2rem rgba(59,130,246,.25);
}
.btn {
    border-radius: 0.375rem;
    padding: 0.375rem 0.75rem;
    font-weight: 500;
}
.btn-primary {
    background-color: #3b82f6;
    border-color: #3b82f6;
}
.btn-primary:hover {
    background-color: #2563eb;
    border-color: #2563eb;
}
.btn-success {
    background-color: #10b981;
    border-color: #10b981;
}
.btn-warning {
    background-color: #f59e0b;
    border-color: #f59e0b;
    color: #fff;
}
.btn-danger {
    background-color: #ef4444;
    border-color: #ef4444;
}

/* ---------- 侧边栏与内容区布局（SPA 模式） ---------- */
#app {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}
.container-fluid {
    flex: 1;
    padding: 1.5rem;
}

/* ---------- 图表容器 ---------- */
.chart-container {
    background: #fff;
    border-radius: 0.5rem;
    padding: 1rem;
    margin-bottom: 1rem;
    box-shadow: 0 1px 3px rgba(0,0,0,.05);
}

/* ---------- 移动端适配 ---------- */
@media (max-width: 768px) {
    .container-fluid {
        padding: 0.75rem;
    }
    .navbar-brand {
        font-size: 1.2rem;
    }
    .btn {
        padding: 0.25rem 0.5rem;
        font-size: 0.85rem;
    }
    .tabulator {
        font-size: 0.75rem;
    }
}

/* ---------- 辅助类 ---------- */
.text-muted {
    color: #6c757d !important;
}
.cursor-pointer {
    cursor: pointer;
}
.w-100 {
    width: 100%;
}
.overflow-auto {
    overflow: auto;
}

/* ---------- 签名画板样式 ---------- */
#signaturePad {
    background-color: #fff;
    border: 1px solid #cbd5e1;
    border-radius: 0.375rem;
    width: 100%;
    height: 150px;
    touch-action: none; /* 提升移动端体验 */
}
.signature-pad-actions {
    margin-top: 0.5rem;
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
}

/* ---------- 模态框 ---------- */
.modal-content {
    border: none;
    border-radius: 0.5rem;
}
.modal-header {
    background-color: #f8f9fc;
    border-bottom: 1px solid #e2e8f0;
    border-radius: 0.5rem 0.5rem 0 0;
}
.modal-footer {
    background-color: #f8f9fc;
    border-top: 1px solid #e2e8f0;
    border-radius: 0 0 0.5rem 0.5rem;
}

/* ---------- 加载动画 ---------- */
.spinner-border-sm {
    width: 1rem;
    height: 1rem;
    border-width: 0.15em;
}

/* ---------- 列表组 ---------- */
.list-group-item {
    border-left: none;
    border-right: none;
    padding: 0.75rem 1rem;
}
.list-group-item:first-child {
    border-top: none;
}
.list-group-item:last-child {
    border-bottom: none;
}

/* ---------- 标签与徽章 ---------- */
.badge {
    font-weight: 500;
    padding: 0.35em 0.65em;
}
/* 新布局样式 */
.app-container {
    display: flex;
    min-height: 100vh;
    background-color: #f4f6f9;
}

/* 侧边栏 */
.sidebar {
    width: 260px;
    background: #2c3e50;
    color: #ecf0f1;
    transition: width 0.3s ease;
    position: relative;
    z-index: 1000;
    display: flex;
    flex-direction: column;
}

.sidebar.collapsed {
    width: 60px;
}

.sidebar-header {
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #3d566e;
}

.sidebar.collapsed .sidebar-header h4 {
    display: none;
}

.sidebar-nav {
    list-style: none;
    padding: 0;
    margin: 0;
    flex: 1;
}

.sidebar-nav .nav-item {
    position: relative;
}

.sidebar-nav .nav-link {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    color: #ecf0f1;
    text-decoration: none;
    transition: background 0.2s;
}

.sidebar-nav .nav-link:hover {
    background: #1a252f;
}

.sidebar-nav .nav-link i {
    width: 24px;
    margin-right: 10px;
    font-size: 1.2rem;
}

.sidebar.collapsed .nav-link span {
    display: none;
}

.sidebar.collapsed .dropdown-toggle::after {
    display: none;
}

/* 下拉菜单在侧边栏收缩时悬浮显示 */
.sidebar.collapsed .dropdown-menu {
    position: fixed;
    left: 60px;
    top: auto;
    transform: translateY(0);
    display: none;
}

.sidebar.collapsed .nav-item:hover .dropdown-menu {
    display: block;
}

/* 右侧主区域 */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-x: auto;
}

/* 顶部栏 */
.top-bar {
    background: #fff;
    padding: 0.75rem 1.5rem;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    border-bottom: 1px solid #e2e8f0;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.top-bar-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.message-icon {
    position: relative;
    cursor: pointer;
    font-size: 1.2rem;
}

.message-icon .badge {
    position: absolute;
    top: -8px;
    right: -8px;
    font-size: 0.7rem;
    padding: 0.2rem 0.4rem;
}

.user-name {
    font-weight: 500;
}

/* 内容区 */
.content-area {
    padding: 1.5rem;
    flex: 1;
}

/* 消息模态框样式 */
.message-item {
    padding: 0.75rem;
    border-bottom: 1px solid #eee;
    margin-bottom: 0.5rem;
}
.message-item.unread {
    background-color: #f0f7ff;
}
.message-title {
    font-weight: bold;
}
.message-content {
    margin: 0.25rem 0;
    color: #555;
}
.message-time {
    font-size: 0.8rem;
    color: #999;
}

/* 响应式 */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        height: 100%;
        z-index: 1050;
        transform: translateX(-100%);
    }
    .sidebar.show {
        transform: translateX(0);
    }
    #mobileToggleBtn {
        display: inline-block !important;
    }
}