/* 主样式文件 */

/* 基础设置 - 防止整个页面滚动，只有内容区域可以滚动 */
html, body {
    height: 100%;
    overflow: hidden;
}

body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.wrapper {
    display: flex;
    flex-direction: column;
    height: 100vh; /* 使用视口高度 */
    overflow: hidden; /* 防止整个页面滚动 */
}

/* 合并的顶部导航栏 */
.main-header.navbar {
    padding: 0.5rem 1rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    background: #fff;
    border-bottom: 1px solid #dee2e6 !important;
    flex-shrink: 0; /* 防止导航栏被压缩 */
}

.navbar-brand {
    display: flex;
    align-items: center;
    padding: 0;
    margin-right: 2rem;
}

.brand-text {
    font-size: 1.4rem;
    font-weight: 700;
    color: #333;
}

.brand-subtext {
    font-size: 0.8rem;
    color: #6c757d;
}

.brand-icon {
    font-size: 1.8rem;
    margin-right: 10px;
    color: #007bff;
}

/* 主菜单 - 桌面端 */
.navbar-nav .nav-link {
    padding: 0.8rem 1rem;
    font-weight: 500;
    color: #495057;
    transition: all 0.3s;
    white-space: nowrap; /* 防止菜单文字换行 */
    display: flex;
    align-items: center;
}

.navbar-nav .nav-link .nav-text {
    margin-left: 0.25rem;
}

.navbar-nav .nav-link:hover,
.navbar-nav .nav-link.active {
    color: #007bff;
    background-color: rgba(0,123,255,0.1);
}

.navbar-nav .nav-item.dropdown:hover > .nav-link {
    color: #007bff;
}

/* 下拉菜单 */
.dropdown-menu {
    border: none;
    box-shadow: 0 3px 6px rgba(0,0,0,0.16);
    border-radius: 0.25rem;
    margin-top: 0;
}

.dropdown-item {
    padding: 0.5rem 1rem;
    font-weight: 500;
    white-space: nowrap;
}

.dropdown-item:hover {
    background-color: #f8f9fa;
    color: #007bff;
}

/* 通知徽章 */
.navbar-badge {
    font-size: 0.6rem;
    position: absolute;
    top: 8px;
    right: 5px;
    padding: 3px 5px;
}

/* 用户菜单 */
.user-avatar {
    width: 32px;
    height: 32px;
    object-fit: cover;
}

.user-icon {
    font-size: 1.5rem;
    color: #6c757d;
}

.user-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 120px;
}

/* 内容区域 - 可滚动 */
.content-wrapper {
    flex: 1 1 auto;
    overflow-y: auto; /* 只有内容区域可以垂直滚动 */
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    min-height: 0; /* 重要：允许内容区域缩小 */
}

.content-header {
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
    flex-shrink: 0; /* 防止内容头被压缩 */
}

.content-header h1 {
    font-weight: 600;
    color: #333;
}

/* 主内容区域 */
.content {
    flex: 1 1 auto;
    min-height: 0; /* 允许内容区域缩小 */
    overflow-y: auto; /* 内容过多时内部滚动 */
}

/* Footer样式 */
.main-footer {
    background-color: #f8f9fa;
    border-top: 1px solid #dee2e6;
    padding: 1rem 0;
    margin-top: auto; /* 推到底部 */
    flex-shrink: 0; /* 防止footer被压缩 */
}

/* 响应式调整 - 桌面端 */
@media (min-width: 992px) {
    .content-wrapper {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    /* 桌面端菜单水平排列 */
    .navbar-nav {
        flex-direction: row;
    }
    
    /* 桌面端水平菜单文字始终显示 */
    .nav-text {
        display: inline !important;
    }
}

/* 快速操作卡片等原有样式保持不变 */
.quick-actions {
    margin-bottom: 1rem;
}

.quick-action-card {
    border: none;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: transform 0.3s, box-shadow 0.3s;
    height: 100%;
    margin-bottom: 1rem;
}

.quick-action-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.quick-action-card .card-body {
    padding: 1rem;
    text-align: center;
}

.action-icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    color: #007bff;
}

.action-btn {
    margin-top: 0.5rem;
    padding: 0.25rem 0.75rem;
    font-size: 0.875rem;
}

/* 统计卡片 */
.stats-card {
    margin-bottom: 1rem;
}

.stats-card .card-body {
    padding: 1rem;
}

.stats-icon {
    font-size: 2rem;
    opacity: 0.8;
}

.stats-value {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0.5rem 0;
}

.stats-label {
    color: #6c757d;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* 表单样式优化 */
.form-card {
    border: none;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.form-card .card-header {
    background: white;
    border-bottom: 1px solid #eee;
    font-weight: 600;
    padding: 0.75rem 1rem;
}

.form-card .card-body {
    padding: 1rem;
}

/* 按钮样式优化 */
.btn-action {
    padding: 0.375rem 0.75rem;
    font-weight: 500;
    font-size: 0.875rem;
}

.btn-scan {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    font-size: 1rem;
    padding: 0.6rem 1.5rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: all 0.3s;
}

.btn-scan:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

/* 二维码样式 */
.qr-code-container {
    padding: 1rem;
    background: white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    text-align: center;
}

.qr-code-img {
    max-width: 250px;
    height: auto;
    margin: 0 auto;
}

/* 滚动条样式 */
.content-wrapper::-webkit-scrollbar {
    width: 8px;
}

.content-wrapper::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.content-wrapper::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

.content-wrapper::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* 去掉默认透明度 */
#toast-container > div {
    opacity: 1 !important;
    box-shadow: none !important;
}

/* 成功 */
.toast-success {
    background-color: #28a745 !important;
    background-image: none !important;
    color: #fff !important;
}

/* 错误 */
.toast-error {
    background-color: #dc3545 !important;
    background-image: none !important;
    color: #fff !important;
}

/* 信息 */
.toast-info {
    background-color: #17a2b8 !important;
    background-image: none !important;
    color: #fff !important;
}

/* 警告 */
.toast-warning {
    background-color: #ffc107 !important;
    background-image: none !important;
    color: #000 !important;
}

/* table备注行 */
.remark-row td {
    border: none !important;
}

/* 使 Select2 容器与 Bootstrap form-control 样式一致 */
.select2-container--default .select2-selection--single {
    height: calc(1.5em + 0.75rem + 2px);          /* 与 input 高度一致 */
    padding: 0.375rem 0.75rem;                    /* 内边距 */
    font-size: 1rem;                              /* 字体大小 */
    font-weight: 400;
    line-height: 1.5;
    color: #495057;                               /* 文字颜色 */
    background-color: #fff;                        /* 背景色 */
    background-clip: padding-box;
    border: 1px solid #ced4da;                     /* 边框颜色 */
    border-radius: 0.25rem;                        /* 圆角 */
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

/* 选中区域的内部布局 */
.select2-container--default .select2-selection--single .select2-selection__rendered {
    color: #495057;                                /* 文字颜色 */
    line-height: 1.5;                              /* 与 input 行高一致 */
    padding-left: 0;                                /* 移除左侧额外间距 */
    padding-right: 0;
}

/* 下拉箭头 */
.select2-container--default .select2-selection--single .select2-selection__arrow {
    height: calc(1.5em + 0.75rem);                 /* 与容器高度匹配 */
    right: 0.75rem;                                 /* 右间距 */
}

/* 聚焦状态 */
.select2-container--default.select2-container--focus .select2-selection--single {
    border-color: #80bdff;                          /* Bootstrap 聚焦边框色 */
    outline: 0;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25); /* 聚焦阴影 */
}

/* 禁用状态 */
.select2-container--default .select2-selection--single[aria-disabled="true"] {
    background-color: #e9ecef;                      /* 禁用背景色 */
    opacity: 1;
}

/* 下拉菜单样式（与 Bootstrap 下拉菜单风格匹配） */
.select2-container--default .select2-dropdown {
    border: 1px solid #ced4da;                      /* 边框颜色 */
    border-radius: 0.25rem;                         /* 圆角 */
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);  /* 阴影 */
}

/* 下拉菜单中的选项 */
.select2-container--default .select2-results__option {
    padding: 0.375rem 0.75rem;                      /* 与 input 内边距一致 */
    font-size: 1rem;
}

/* 高亮选项（悬停或键盘选择） */
.select2-container--default .select2-results__option--highlighted[aria-selected] {
    background-color: #007bff;                       /* Bootstrap 主色 */
    color: #fff;
}

/* 已选择选项（在菜单中） */
.select2-container--default .select2-results__option[aria-selected="true"] {
    background-color: #e9ecef;                        /* 浅灰背景 */
}

/* 搜索框（当开启搜索时） */
.select2-container--default .select2-search--dropdown .select2-search__field {
    border: 1px solid #ced4da;                         /* 边框 */
    border-radius: 0.25rem;                            /* 圆角 */
    padding: 0.375rem 0.75rem;                         /* 内边距 */
    font-size: 1rem;
}
.select2-container--default .select2-search--dropdown .select2-search__field:focus {
    border-color: #80bdff;
    outline: 0;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

/* 如果有多选模式（本例未使用，但保留备用） */
.select2-container--default .select2-selection--multiple {
    border: 1px solid #ced4da;
    border-radius: 0.25rem;
    min-height: calc(1.5em + 0.75rem + 2px);
    padding: 0.375rem 0.75rem;
}
.select2-container--default .select2-selection--multiple:focus {
    border-color: #80bdff;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

.checkbox-all, .record-checkbox {
    cursor: pointer;
    width: 18px;
    height: 18px;
}