/* 全局样式 */
:root {
    --primary-color: #3498db;
    --secondary-color: #2ecc71;
    --accent-color: #e74c3c;
    --light-color: #f8f9fa;
    --dark-color: #343a40;
    --gray-color: #6c757d;
    --border-radius: 0.5rem;
    --box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    --transition: all 0.3s ease;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background-color: #f5f7fa;
}

main {
    flex: 1;
}

/* 导航栏样式 */
header {
    box-shadow: var(--box-shadow);
}

header .container {
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
}

/* 卡片样式 */
.card {
    border: none;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    transition: var(--transition);
    margin-bottom: 1.5rem;
}

.card:hover {
    transform: translateY(-5px);
}

.card-header {
    background-color: var(--light-color);
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    font-weight: 600;
}

/* 按钮样式 */
.btn {
    border-radius: var(--border-radius);
    padding: 0.5rem 1rem;
    font-weight: 500;
    transition: var(--transition);
}

.btn-primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-primary:hover {
    background-color: #2980b9;
    border-color: #2980b9;
}

.btn-success {
    background-color: var(--secondary-color);
    border-color: var(--secondary-color);
}

.btn-success:hover {
    background-color: #27ae60;
    border-color: #27ae60;
}

.btn-danger {
    background-color: var(--accent-color);
    border-color: var(--accent-color);
}

.btn-danger:hover {
    background-color: #c0392b;
    border-color: #c0392b;
}

/* 表单样式 */
.form-control, .form-select {
    border-radius: var(--border-radius);
    padding: 0.5rem 0.75rem;
    border: 1px solid #ced4da;
    transition: var(--transition);
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.25rem rgba(52, 152, 219, 0.25);
}

.form-label {
    font-weight: 500;
    margin-bottom: 0.5rem;
}

/* 表格样式 */
.table {
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--box-shadow);
}

.table thead th {
    background-color: var(--light-color);
    border-bottom: 2px solid rgba(0, 0, 0, 0.1);
    font-weight: 600;
}

.table-hover tbody tr:hover {
    background-color: rgba(52, 152, 219, 0.1);
}

/* 价格表样式 */
.price-table {
    font-size: 0.9rem;
}

.price-table th, .price-table td {
    vertical-align: middle;
}

.price-table .retail-price, .price-table .wholesale-price {
    font-weight: 600;
}

.price-table .tax-included {
    color: var(--secondary-color);
}

.price-table .tax-excluded {
    color: var(--accent-color);
}

/* 筛选面板样式 */
.filter-panel {
    background-color: #fff;
    border-radius: var(--border-radius);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--box-shadow);
}

.filter-panel .form-group {
    margin-bottom: 1rem;
}

/* 调价面板样式 */
.adjustment-panel {
    background-color: #fff;
    border-radius: var(--border-radius);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--box-shadow);
    border-left: 5px solid var(--primary-color);
}

/* 登录页面样式 */
.login-container {
    max-width: 400px;
    margin: 2rem auto;
}

.login-card {
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    padding: 2rem;
}

.login-logo {
    text-align: center;
    margin-bottom: 2rem;
}

.login-logo h1 {
    font-weight: 700;
    color: var(--primary-color);
}

/* 密码输入框样式 */
.password-container {
    position: relative;
}

.password-toggle {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    color: var(--gray-color);
}

/* 打印样式 */
@media print {
    @page {
        size: landscape;
        margin: 1cm;
    }
    .print-only { display: block !important; }
    body { font-family: 'SimSun', '宋体', serif; background-color: #fff; }
    .container { width: 100%; max-width: 100%; padding: 0; margin: 0; }
    .adjustment-details-container { padding: 20px; }
    header, footer, .no-print { display: none !important; }
    .card { box-shadow: none; border: 1px solid #000; margin-bottom: 20px; border-radius: 0; }
    .card-header { background-color: #f2f2f2; border-bottom: 1px solid #000; font-weight: bold; text-align: center; }
    .card-body { padding: 15px; }
    .table { box-shadow: none; width: 100%; border-collapse: collapse; font-size: 12px; }
    .table th, .table td { border: 1px solid #000; padding: 8px; text-align: center; }
    .table thead th { background-color: #f2f2f2; font-weight: bold; }
    .row { display: flex; flex-wrap: wrap; margin-bottom: 10px; width: 100%; }
    .col-md-3 { width: 25%; padding: 0 10px; box-sizing: border-box; float: left; }
    .col-md-12 { width: 100%; padding: 0 10px; box-sizing: border-box; }
    strong { font-weight: bold; }
    .badge { border: 1px solid #000; padding: 2px 5px; border-radius: 2px; display: inline-block; }
    .text-success, .text-danger { color: #000; font-weight: bold; }
    .text-success::before { content: '+'; }
    .text-danger::before { content: '-'; }
    /* 打印样式已整合到上方 */
}

/* 响应式调整 - 针对大屏幕设备（默认） */
/* 响应式调整 - 平板和小屏幕设备 */
@media (max-width: 768px) {
    /* 登录页面响应式调整 */
    .login-container {
        max-width: 100%;
        padding: 1rem;
        margin: 1rem auto;
    }
    
    .login-card {
        padding: 1.5rem;
    }
    
    .login-logo h1 {
        font-size: 1.5rem;
    }
    
    /* 表单元素响应式调整 */
    .form-control {
        padding: 0.75rem;
        font-size: 1rem;
    }
    
    .input-group-text {
        padding: 0.75rem;
    }
    
    /* 管理后台响应式调整 */
    .col-md-3, .col-md-6 {
        flex: 0 0 100%;
        max-width: 100%;
        margin-bottom: 1rem;
    }
    
    /* 导航栏响应式调整 */
    header .container {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }
    
    header .d-flex {
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    
    header h1 {
        font-size: 1.25rem;
    }
    
    /* 按钮响应式调整 */
    .btn {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        padding: 0.4rem 0.8rem;
        font-size: 0.9rem;
    }
    
    /* 管理员产品列表页面调整 */
    .filter-panel .row > div {
        margin-bottom: 15px;
    }
    #productsTable_wrapper {
        font-size: 0.8rem;
    }
    #productsTable thead th:not(:first-child):not(:last-child) {
        min-width: 80px;
    }
    #productsTable tbody td {
        padding: 6px;
    }
    #productsTable .btn-group {
        flex-direction: column;
    }
    #productsTable .btn-group .btn {
        margin-bottom: 3px;
        margin-right: 0 !important;
        width: 100%;
        justify-content: center;
    }
    
    /* 添加产品页面调整 */
    .col-md-4 {
        flex: 0 0 100%;
        max-width: 100%;
        margin-bottom: 1rem;
    }
    .card.bg-light {
        margin-bottom: 1rem;
    }
    
    /* 筛选条件区域优化 */
    .filter-panel .card-body {
        padding: 1rem;
    }
    .filter-panel .row {
        margin-bottom: 0.5rem;
    }
    .filter-panel .col-md-3 {
        margin-bottom: 0.75rem;
    }
    .filter-panel .form-select.select2 {
        padding-right: 2.25rem;
        height: 2.5rem;
    }
    .select2-container {
        width: 100% !important;
    }
    .select2-selection--single {
        height: 2.5rem !important;
        display: flex !important;
        align-items: center !important;
    }
    .select2-selection__rendered {
        padding-left: 0.75rem !important;
        padding-right: 2rem !important;
    }
}

/* 针对手机设备的额外调整 */
@media (max-width: 480px) {
    /* 全局样式 */
    body {
        font-size: 0.875rem;
    }
    
    /* 登录页面调整 */
    .login-card {
        padding: 1.25rem;
        margin: 0.5rem;
    }
    
    .login-logo h1 {
        font-size: 1.25rem;
    }
    
    /* 表单元素调整 */
    .form-label {
        font-size: 0.875rem;
    }
    
    /* 卡片样式调整 */
    .card {
        margin-bottom: 1rem;
    }
    
    /* 按钮样式调整 */
    .btn {
        font-size: 0.875rem;
        padding: 0.5rem;
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    /* 管理后台统计卡片调整 */
    .card-body {
        padding: 0.75rem;
    }
    
    /* 历史记录样式调整 */
    .history-item {
        padding-bottom: 1rem;
        margin-bottom: 1rem;
    }
    
    .history-date {
        font-size: 0.875rem;
    }
    
    /* 导航栏按钮文本隐藏 */
    header .btn span {
        display: none;
    }
    
    header .btn {
        padding: 0.5rem;
        width: 44px;
        height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    /* 调整表格显示 */
    .table-responsive {
        margin-bottom: 1rem;
        -webkit-overflow-scrolling: touch;
        overflow-x: auto;
    }
    
    /* 表格样式优化 */
    table {
        min-width: 768px;
    }
    
    /* 调整快捷操作按钮 */
    .row .col-md-6 .btn {
        padding: 0.75rem 0.5rem;
        text-align: center;
    }
    
    /* 修复密码切换按钮位置 */
    .password-toggle {
        right: 10px;
        top: 50%;
        transform: translateY(-50%);
        z-index: 10;
    }
    
    /* 首页筛选面板调整 */
    .filter-panel {
        padding: 1rem;
    }
    
    .filter-panel .row {
        margin-left: -0.5rem;
        margin-right: -0.5rem;
    }
    
    .filter-panel .col-md-3 {
        padding-left: 0.5rem;
        padding-right: 0.5rem;
    }
    
    /* 首页操作按钮组调整 */
    .card-header .btn-group {
        flex-wrap: wrap;
        gap: 0.25rem;
    }
    
    .card-header .btn-group .btn {
        font-size: 0.75rem;
        padding: 0.35rem;
    }
    
    /* 修复移动端下拉菜单位置 */
    .dropdown-menu {
        right: 0 !important;
        left: auto !important;
    }
    
    /* 适配小屏幕上的标题大小 */
    h1, .h1 {
        font-size: 1.5rem;
    }
    
    h2, .h2 {
        font-size: 1.25rem;
    }
    
    h3, .h3 {
        font-size: 1.125rem;
    }
    
    h4, .h4 {
        font-size: 1rem;
    }
    
    h5, .h5 {
        font-size: 0.875rem;
    }
    
    /* 移动端优化打印模板 */
    #printTemplate {
        max-width: 100%;
    }
    
    /* 移动端优化Select2下拉框 */
    .select2-container {
        width: 100% !important;
    }
    
    /* 确保内容在容器内显示 */
    .container, .container-fluid {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }
}

/* 动画效果 */
.fade-in {
    animation: fadeIn 0.5s ease-in-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* 加载动画 */
.spinner-container {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100px;
}

.spinner-border {
    width: 3rem;
    height: 3rem;
    color: var(--primary-color);
}

/* 自定义Select2样式 */
.select2-container--bootstrap-5 .select2-selection {
    border-radius: var(--border-radius);
    padding: 0.375rem 0.75rem;
    border: 1px solid #ced4da;
    min-height: 38px;
}

.select2-container--bootstrap-5.select2-container--focus .select2-selection {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.25rem rgba(52, 152, 219, 0.25);
}

/* 自定义DataTables样式 */
.dataTables_wrapper .dataTables_length select {
    border-radius: var(--border-radius);
    padding: 0.375rem 2rem 0.375rem 0.75rem;
}

.dataTables_wrapper .dataTables_filter input {
    border-radius: var(--border-radius);
    padding: 0.375rem 0.75rem;
    border: 1px solid #ced4da;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current {
    background: var(--primary-color);
    color: white !important;
    border: 1px solid var(--primary-color);
    border-radius: var(--border-radius);
}

.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
    background: #2980b9;
    color: white !important;
    border: 1px solid #2980b9;
}

/* 价格调整历史记录样式 */
.history-timeline {
    position: relative;
    padding-left: 2rem;
}

.history-timeline::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 2px;
    background-color: var(--primary-color);
}

.history-item {
    position: relative;
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid #eee;
}

.history-item::before {
    content: '';
    position: absolute;
    left: -2rem;
    top: 0.5rem;
    width: 1rem;
    height: 1rem;
    border-radius: 50%;
    background-color: var(--primary-color);
}

.history-date {
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.history-amount {
    font-weight: 600;
}

.history-amount.increase {
    color: var(--accent-color);
}

.history-amount.decrease {
    color: var(--secondary-color);
}