/**
 * 库存盘点差异管理系统 - 响应式样式
 * 支持 PC、平板、手机全端适配
 */

/* ==================== 变量定义 ==================== */
:root {
    --primary-color: #4F46E5;
    --primary-dark: #4338CA;
    --primary-light: #818CF8;
    --success-color: #10B981;
    --success-light: #D1FAE5;
    --warning-color: #F59E0B;
    --warning-light: #FEF3C7;
    --danger-color: #EF4444;
    --danger-light: #FEE2E2;
    --info-color: #3B82F6;
    --info-light: #DBEAFE;
    --purple-color: #8B5CF6;
    --gray-50: #F9FAFB;
    --gray-100: #F3F4F6;
    --gray-200: #E5E7EB;
    --gray-300: #D1D5DB;
    --gray-400: #9CA3AF;
    --gray-500: #6B7280;
    --gray-600: #4B5563;
    --gray-700: #374151;
    --gray-800: #1F2937;
    --gray-900: #111827;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --radius-sm: 0.25rem;
    --radius: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    --transition: all 0.2s ease-in-out;
    --font-family: 'Inter', 'Noto Sans TC', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* ==================== 基础样式 ==================== */
* {
    box-sizing: border-box;
}

html {
    font-size: 16px;
}

body {
    font-family: var(--font-family);
    background-color: var(--gray-100) !important;
    color: var(--gray-800);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
}

/* ==================== 状态徽章颜色 ==================== */
.badge.bg-purple {
    background-color: var(--purple-color) !important;
    color: white !important;
}

.badge {
    font-weight: 500;
    padding: 0.3rem 0.6rem;
    font-size: 0.75rem;
    border-radius: var(--radius-sm);
}

/* ==================== 布局 - 桌面端 ==================== */
.wrapper {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 260px;
    background: linear-gradient(180deg, var(--gray-900) 0%, var(--gray-800) 100%);
    color: white;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    z-index: 100;
    transition: transform 0.3s ease, width 0.3s ease;
}

.sidebar.collapsed {
    width: 0;
    overflow: hidden;
}

.sidebar.collapsed .sidebar-brand,
.sidebar.collapsed .sidebar-nav {
    opacity: 0;
}

.sidebar.collapsed .sidebar-footer {
    position: fixed;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 70px;
    background: transparent;
    border: none;
}

.sidebar.collapsed .sidebar-collapse-btn {
    width: 40px;
    height: 40px;
    margin: 0 auto;
    border-radius: 50%;
    background: white;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.sidebar.collapsed .sidebar-collapse-btn i {
    font-size: 1.25rem;
}

.main-content.expanded {
    margin-left: 0;
}

/* 桌面端侧边栏收起 */
@media (min-width: 1025px) {
    .sidebar.collapsed {
        width: 0 !important;
        min-width: 0 !important;
        border: none;
    }
    
    .sidebar.collapsed .sidebar-brand,
    .sidebar.collapsed .sidebar-nav {
        display: none;
    }
    
    .sidebar.collapsed .sidebar-footer {
        position: fixed;
        left: 0;
        top: 50%;
        transform: translateY(-50%);
        width: 70px;
        background: transparent;
        border: none;
        padding: 0;
        display: flex !important;
        justify-content: center;
    }
    
    .sidebar.collapsed .sidebar-collapse-btn {
        width: 40px;
        height: 40px;
        border-radius: 50%;
        background: white;
        box-shadow: 0 2px 8px rgba(0,0,0,0.15);
        display: flex !important;
    }
    
    .sidebar.collapsed .sidebar-collapse-btn i {
        font-size: 1.25rem;
    }
    
    .sidebar.collapsed .sidebar-collapse-btn span {
        display: none !important;
    }
    
    /* 隐藏原有的切换按钮，使用sidebar底部的按钮 */
    .toggle-sidebar-btn {
        display: none !important;
    }
}

@media (max-width: 1024px) {
    .sidebar {
        z-index: 1060;
    }
}

.sidebar-brand {
    padding: 1.25rem 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-brand h1 {
    font-size: 1.1rem;
    font-weight: 700;
    margin: 0;
    color: white;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sidebar-nav {
    padding: 0.75rem 0;
}

.nav-item {
    margin: 0.125rem 0.5rem;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 0.625rem 0.875rem;
    color: var(--gray-400);
    text-decoration: none;
    border-radius: var(--radius);
    transition: var(--transition);
    font-size: 0.875rem;
}

.nav-link:hover, .nav-link.active {
    background-color: rgba(255, 255, 255, 0.1);
    color: white;
}

.nav-link.active {
    background-color: var(--primary-color);
}

.nav-link i {
    margin-right: 0.625rem;
    font-size: 1.125rem;
    width: 1.5rem;
    text-align: center;
}

.nav-section-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    margin: 4px 0;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--gray-500);
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s;
    user-select: none;
}
.nav-section-title:hover {
    background: rgba(255,255,255,0.1);
    color: var(--gray-300);
}
.nav-section-title .section-arrow {
    font-size: 10px;
    transition: transform 0.2s;
}
.nav-section-title.collapsed .section-arrow {
    transform: rotate(-90deg);
}
.nav-section {
    margin-bottom: 4px;
}
.nav-section-items {
    overflow: hidden;
    transition: max-height 0.3s ease;
}
.nav-section-items.collapsed {
    max-height: 0 !important;
}
.sidebar.collapsed .nav-section-title span,
.sidebar.collapsed .section-arrow {
    display: none;
}
.sidebar.collapsed .nav-section-title {
    justify-content: center;
    padding: 8px;
}

.main-content {
    flex: 1;
    margin-left: 260px;
    min-height: 100vh;
}

.top-bar {
    background: white;
    padding: 0.875rem 1.25rem;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 50;
}

.top-bar h4 {
    margin: 0;
    font-weight: 600;
    font-size: 1.125rem;
}

.content-wrapper {
    padding: 1.25rem;
}

/* ==================== 卡片 ==================== */
.card {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    border: none;
    overflow: hidden;
}

.card-header {
    padding: 1rem 1.25rem;
    background: white;
    border-bottom: 1px solid var(--gray-100);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.card-header h5 {
    margin: 0;
    font-weight: 600;
    color: var(--gray-800);
    font-size: 1rem;
}

.card-body {
    padding: 1.25rem;
}

.card-footer {
    padding: 0.875rem 1.25rem;
    background: var(--gray-50);
    border-top: 1px solid var(--gray-100);
}

/* ==================== 统计卡片 ==================== */
.stat-card {
    background: white;
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 0.875rem;
    transition: var(--transition);
}

.category-stat-card {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border: 1px solid #e2e8f0;
    height: 100%;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.stat-info h3 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.2;
}

.stat-info p {
    margin: 0;
    font-size: 0.8125rem;
    color: var(--gray-500);
}

/* ==================== 表格 ==================== */
.table {
    margin-bottom: 0;
    font-size: 0.875rem;
}

.table thead th {
    background: var(--gray-50);
    font-weight: 600;
    white-space: nowrap;
    padding: 0.75rem 0.625rem;
    border-bottom: 2px solid var(--gray-200);
}

.table tbody td {
    padding: 0.625rem;
    vertical-align: middle;
}

.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* ==================== 表单 ==================== */
.form-label {
    font-weight: 500;
    margin-bottom: 0.375rem;
    font-size: 0.875rem;
}

.form-control {
    font-size: 0.9375rem;
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius);
}

textarea.form-control {
    resize: vertical;
}

/* ==================== 按钮 ==================== */
.btn {
    font-weight: 500;
    border-radius: var(--radius);
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    transition: var(--transition);
}

.btn-lg {
    padding: 0.625rem 1.25rem;
    font-size: 1rem;
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.8125rem;
}

/* ==================== 上传区域 ==================== */
.upload-zone {
    border: 2px dashed var(--gray-300);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    background: var(--gray-50);
}

.upload-zone:hover {
    border-color: var(--primary-color);
    background: white;
}

.upload-zone i {
    font-size: 2rem;
    color: var(--gray-400);
    margin-bottom: 0.5rem;
}

.upload-zone p {
    margin: 0;
    font-size: 0.9375rem;
    color: var(--gray-600);
}

.upload-zone .hint {
    font-size: 0.75rem;
    color: var(--gray-400);
}

/* ==================== 筛选条样式 ==================== */
.filter-bar {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-radius: var(--radius-lg);
    padding: 1rem;
}

.filter-row {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: flex-end;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.filter-group.flex-grow-1 {
    flex: 1;
    min-width: 200px;
}

.filter-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 0;
}

.filter-select {
    padding: 0.5rem 2rem 0.5rem 0.75rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    background: white;
    font-size: 0.875rem;
    cursor: pointer;
    min-width: 120px;
    transition: var(--transition);
}

.filter-select:focus {
    border-color: var(--primary-color);
    outline: none;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.filter-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.filter-chip {
    display: inline-flex;
    align-items: center;
    padding: 0.375rem 0.75rem;
    border: 1px solid var(--gray-300);
    border-radius: 2rem;
    font-size: 0.8125rem;
    cursor: pointer;
    transition: var(--transition);
    background: white;
    color: var(--gray-600);
    user-select: none;
}

.filter-chip input {
    display: none;
}

.filter-chip:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.filter-chip.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

.filter-chip.chip-success.active {
    background: var(--success-color);
    border-color: var(--success-color);
}

.filter-chip.chip-danger.active {
    background: var(--danger-color);
    border-color: var(--danger-color);
}

.filter-chip.chip-warning.active {
    background: var(--warning-color);
    border-color: var(--warning-color);
}

.filter-chip.chip-info.active {
    background: var(--info-color);
    border-color: var(--info-color);
}

.filter-chip.chip-secondary.active {
    background: var(--gray-500);
    border-color: var(--gray-500);
}

.search-box {
    position: relative;
    display: flex;
    align-items: center;
}

.search-box i {
    position: absolute;
    left: 0.75rem;
    color: var(--gray-400);
    font-size: 0.875rem;
}

.search-input {
    width: 100%;
    padding: 0.5rem 0.75rem 0.5rem 2.25rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    font-size: 0.875rem;
    transition: var(--transition);
}

.search-input:focus {
    border-color: var(--primary-color);
    outline: none;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.filter-actions {
    display: flex;
    gap: 0.5rem;
}

.bg-preview {
    height: 100px;
    background: #f0f2f5;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px dashed #ccc;
    transition: all 0.3s;
}

.bg-preview span {
    background: rgba(255,255,255,0.8);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
}

@media (max-width: 768px) {
    .filter-row {
        flex-direction: column;
    }
    .filter-group {
        width: 100%;
    }
    .filter-select,
    .search-input {
        width: 100%;
    }
}

/* ==================== 状态徽章 ==================== */
.badge {
    font-weight: 500;
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    border-radius: var(--radius-sm);
}

/* ==================== 侧边栏收起按钮 ==================== */
.toggle-sidebar-btn {
    position: fixed;
    left: 260px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 101;
    width: 20px;
    height: 48px;
    background: var(--gray-800);
    color: white;
    border: none;
    border-radius: 0 8px 8px 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: left 0.3s ease, background 0.2s;
}

.toggle-sidebar-btn:hover {
    background: var(--primary-color);
}

/* ==================== 移动端顶部工具栏 ==================== */
.mobile-header {
    display: none;
    background: white;
    padding: 0.625rem 0.875rem;
    border-bottom: 1px solid var(--gray-200);
    position: sticky;
    top: 0;
    z-index: 1040;
    align-items: center;
    gap: 0.5rem;
}

.mobile-header span {
    font-weight: 600;
    color: var(--primary-color);
    font-size: 0.9375rem;
}

/* ==================== 遮罩层 ==================== */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1045;
}

/* ==================== 公告区域 ==================== */
.announcement-bar {
    background: white;
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    box-shadow: var(--shadow);
}

.announcement-bar h5 {
    margin: 0;
    font-weight: 600;
    color: var(--gray-800);
}

.announcement-item {
    padding: 0.875rem;
    border-radius: var(--radius);
    background: var(--gray-50);
    cursor: pointer;
    transition: var(--transition);
}

.announcement-item:hover {
    background: var(--gray-100);
}

.announcement-title {
    font-weight: 600;
    color: var(--gray-800);
    margin-bottom: 0.375rem;
}

.announcement-meta {
    font-size: 0.75rem;
    color: var(--gray-500);
}

#announcementCarousel {
    position: relative;
}

.carousel-control-prev,
.carousel-control-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: auto;
    padding: 0.5rem;
    text-decoration: none;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.carousel-control-prev {
    left: -0.5rem;
}

.carousel-control-next {
    right: -0.5rem;
}

.carousel-control-prev:hover,
.carousel-control-next:hover {
    opacity: 1;
    background: transparent;
}

/* ==================== 功能按钮组 ==================== */
.action-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    justify-content: center;
}

.action-buttons .btn {
    min-width: 140px;
    box-shadow: var(--shadow-sm);
    transition: all 0.2s ease;
}

.action-buttons .btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.action-buttons .btn:active {
    transform: translateY(0);
}

.action-buttons .btn-success {
    background: linear-gradient(135deg, #10B981 0%, #059669 100%);
    border: none;
}

.action-buttons .btn-success:hover {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
}

.action-buttons .btn-primary {
    background: linear-gradient(135deg, #4F46E5 0%, #4338CA 100%);
    border: none;
}

.action-buttons .btn-primary:hover {
    background: linear-gradient(135deg, #4338CA 0%, #3730A3 100%);
}

.action-buttons .btn-outline-secondary:hover {
    background: var(--gray-100);
}

.action-buttons .btn-outline-info {
    border-color: var(--info-color);
    color: var(--info-color);
}

.action-buttons .btn-outline-info:hover {
    background: var(--info-color);
    border-color: var(--info-color);
}

/* ==================== 平板适配 (768px - 1024px) ==================== */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.show {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .toggle-sidebar-btn {
        left: 0;
        top: 50%;
    }
    
    .toggle-sidebar-btn.collapsed {
        left: 0;
    }
    
    .mobile-header {
        display: flex;
    }
    
    .sidebar-overlay.show {
        display: block;
    }
    
    /* 移动端隐藏折叠按钮 */
    .sidebar-footer {
        display: none !important;
    }
    .sidebar-collapse-btn {
        display: none !important;
    }
    
    .content-wrapper {
        padding: 1rem;
    }
    
    .stat-card {
        padding: 1rem;
    }
    
    .stat-icon {
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }
    
    .stat-info h3 {
        font-size: 1.25rem;
    }
}

/* ==================== 手机适配 (576px - 768px) ==================== */
@media (max-width: 768px) {
    html {
        font-size: 15px;
    }
    
    body {
        font-size: 14px;
        line-height: 1.5;
    }
    
    .top-bar {
        padding: 0.625rem 0.875rem;
        flex-wrap: wrap;
    }
    
    .top-bar h4 {
        font-size: 1rem;
    }
    
    .content-wrapper {
        padding: 0.75rem;
    }
    
    .card-header {
        padding: 0.75rem 1rem;
    }
    
    .card-header h5 {
        font-size: 0.9375rem;
    }
    
    .card-body {
        padding: 1rem;
    }
    
    /* 统计卡片网格 */
    .row.g-3 > [class*="col-"] {
        margin-bottom: 0.5rem;
    }
    
    .stat-card {
        padding: 0.75rem;
        gap: 0.625rem;
    }
    
    .stat-icon {
        width: 36px;
        height: 36px;
        font-size: 0.9375rem;
    }
    
    .stat-info h3 {
        font-size: 1.125rem;
    }
    
    .stat-info p {
        font-size: 0.75rem;
    }
    
    /* 表格优化 */
    .table {
        font-size: 0.8125rem;
    }
    
    .table thead th,
    .table tbody td {
        padding: 0.5rem 0.375rem;
    }
    
    .table td small {
        font-size: 0.6875rem;
    }
    
    /* 按钮优化 */
    .btn {
        padding: 0.4375rem 0.75rem;
        font-size: 0.8125rem;
    }
    
    .btn-lg {
        padding: 0.5rem 1rem;
        font-size: 0.875rem;
    }
    
    .btn-sm {
        padding: 0.3125rem 0.5rem;
        font-size: 0.75rem;
    }
    
    /* 表单优化 */
    .form-label {
        font-size: 0.8125rem;
    }
    
    .form-control {
        font-size: 0.875rem;
        padding: 0.4375rem 0.625rem;
    }
    
    /* 上传区域 */
    .upload-zone {
        padding: 1rem;
    }
    
    .upload-zone i {
        font-size: 1.5rem;
    }
    
    .upload-zone p {
        font-size: 0.875rem;
    }
    
    /* 徽章优化 */
    .badge {
        font-size: 0.6875rem;
        padding: 0.1875rem 0.375rem;
    }
    
    /* 分类统计表格 */
    .table.table-sm {
        font-size: 0.75rem;
    }
    
    .table.table-sm thead th,
    .table.table-sm tbody td {
        padding: 0.375rem 0.25rem;
    }
    
    /* 分页 */
    .pagination-container {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    /* 模态框 */
    .modal-header,
    .modal-body,
    .modal-footer {
        padding: 0.75rem 1rem;
    }
    
    /* 公告区域 */
    .announcement-bar {
        padding: 0.625rem;
    }
    
    .announcement-title {
        font-size: 0.875rem;
    }
    
    /* 页面头部 */
    .page-header {
        padding: 1rem;
        flex-direction: column;
        align-items: flex-start;
    }
    
    .page-header > div,
    .page-header > .d-flex {
        width: 100%;
    }
    
    .page-header .d-flex.gap-2 {
        margin-top: 0.75rem;
        flex-wrap: wrap;
    }
    
    /* 功能按钮组 */
    .d-flex.flex-wrap.gap-3.justify-content-center {
        flex-direction: column;
    }
    
    .d-flex.flex-wrap.gap-3.justify-content-center .btn-lg {
        width: 100%;
        margin-bottom: 0.5rem;
    }
}

/* ==================== 小屏手机适配 (< 576px) ==================== */
@media (max-width: 576px) {
    html {
        font-size: 14px;
    }
    
    body {
        font-size: 13px;
    }
    
    .sidebar {
        width: 240px;
    }
    
    .sidebar-brand h1 {
        font-size: 1rem;
    }
    
    .nav-link {
        padding: 0.5rem 0.75rem;
        font-size: 0.8125rem;
    }
    
    .nav-link i {
        font-size: 1rem;
        margin-right: 0.5rem;
    }
    
    .content-wrapper {
        padding: 0.625rem;
    }
    
    .card-body {
        padding: 0.75rem;
    }
    
    /* 统计卡片 */
    .stat-card {
        padding: 0.625rem;
    }
    
    .stat-icon {
        width: 32px;
        height: 32px;
        font-size: 0.875rem;
    }
    
    .stat-info h3 {
        font-size: 1rem;
    }
    
    /* 表格 */
    .table {
        font-size: 0.75rem;
    }
    
    .table thead th,
    .table tbody td {
        padding: 0.375rem 0.25rem;
    }
    
    /* 按钮 */
    .btn {
        padding: 0.375rem 0.625rem;
        font-size: 0.75rem;
    }
    
    .btn-lg {
        padding: 0.4375rem 0.75rem;
        font-size: 0.8125rem;
    }
    
    /* 输入框 */
    .form-control {
        font-size: 0.8125rem;
        padding: 0.375rem 0.5rem;
    }
    
    /* 分类统计表格横向滚动 */
    .table-responsive {
        font-size: 0.75rem;
    }
    
    .table.table-bordered {
        min-width: 600px;
    }
    
    /* 筛选表单 */
    .card-body.py-2.d-flex.flex-wrap {
        flex-direction: column;
    }
    
    .card-body.py-2.d-flex.flex-wrap > * {
        width: 100%;
        margin-bottom: 0.5rem;
    }
    
    /* 设置页面 */
    .content-wrapper .card {
        margin-bottom: 0.75rem;
    }
    
    /* 表单文本框 */
    textarea.form-control {
        font-size: 0.8125rem;
    }
    
    /* 表格显示字段提示框 */
    .alert.alert-secondary.py-2 {
        font-size: 0.6875rem;
    }
    
    .alert.alert-secondary.py-2 code {
        font-size: 0.625rem;
        word-break: break-all;
    }
}

/* ==================== 超小屏手机 (< 400px) ==================== */
@media (max-width: 400px) {
    html {
        font-size: 13px;
    }
    
    .sidebar {
        width: 85%;
    }
    
    .top-bar {
        padding: 0.5rem 0.75rem;
    }
    
    .content-wrapper {
        padding: 0.5rem;
    }
    
    .card {
        border-radius: var(--radius);
    }
    
    .card-header {
        padding: 0.625rem 0.75rem;
    }
    
    .card-body {
        padding: 0.625rem;
    }
    
    /* 按钮全宽 */
    .btn {
        width: 100%;
        margin-bottom: 0.375rem;
    }
    
    .d-flex.gap-2 {
        flex-direction: column;
    }
    
    .d-flex.gap-2 .btn {
        width: 100%;
    }
}

/* ==================== 横屏手机适配 ==================== */
@media (max-height: 500px) and (orientation: landscape) {
    .sidebar {
        height: 100vh;
        overflow-y: auto;
    }
    
    .mobile-header {
        position: relative;
    }
}

/* ==================== 触摸优化 ==================== */
@media (hover: none) and (pointer: coarse) {
    /* 移除hover效果在触摸设备上 */
    .stat-card:hover {
        transform: none;
    }
    
    /* 增加触摸目标大小 */
    .nav-link {
        padding: 0.75rem 1rem;
    }
    
    .btn {
        min-height: 44px;
    }
    
    .form-control {
        min-height: 44px;
    }
    
    /* 触摸反馈 */
    .btn:active {
        opacity: 0.9;
    }
}

/* ==================== 深色模式支持 (可选) ==================== */
@media (prefers-color-scheme: dark) {
    /* 如需要可启用深色模式 */
}

/* ==================== 打印样式 ==================== */
@media print {
    .sidebar,
    .toggle-sidebar-btn,
    .mobile-header,
    .btn,
    .upload-zone {
        display: none !important;
    }
    
    .main-content {
        margin-left: 0;
    }
    
    body {
        background: white;
    }
    
    .card {
        box-shadow: none;
        border: 1px solid var(--gray-200);
    }
}

/* ==================== 辅助类 ==================== */
.text-truncate-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

@media (max-width: 768px) {
    .hide-mobile {
        display: none !important;
    }
}

@media (min-width: 769px) {
    .hide-desktop {
        display: none !important;
    }
}
