/* 自定义样式 */

/* 全局样式 */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: #f8f9fa;
}

/* 容器样式 */
.container-fluid {
    max-width: 1200px;
    margin: 0 auto;
}

/* 表单样式 */
.form-control:focus {
    border-color: #007bff;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

/* 按钮样式 */
.btn {
    border-radius: 4px;
    font-weight: 500;
}

.btn-block {
    margin-bottom: 10px;
}

/* 用户信息显示区域 */
#user_info {
    border: 1px solid #dee2e6;
    border-radius: 6px;
    background-color: #f8f9fa;
}

#user_info h5 {
    color: #495057;
    margin-bottom: 15px;
}

#user_info p {
    margin-bottom: 8px;
    color: #6c757d;
}

/* 表格样式 */
.table {
    background-color: white;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.table th {
    background-color: #f8f9fa;
    border-top: none;
    font-weight: 600;
    color: #495057;
}

.table td {
    vertical-align: middle;
}

/* 状态徽章样式 */
.badge {
    font-size: 0.875em;
    padding: 0.375em 0.75em;
}

.badge-warning {
    background-color: #ffc107;
    color: #212529;
}

.badge-success {
    background-color: #28a745;
}

.badge-danger {
    background-color: #dc3545;
}

/* ========== 响应式设计 ========== */

/* 大屏幕桌面端 (1200px+) */
@media (min-width: 1200px) {
    .container-fluid {
        max-width: 1140px;
    }
}

/* 桌面端 (992px - 1199px) */
@media (min-width: 992px) and (max-width: 1199px) {
    .container-fluid {
        max-width: 960px;
    }
}

/* 平板端 (768px - 991px) */
@media (min-width: 768px) and (max-width: 991px) {
    .container-fluid {
        max-width: 720px;
        padding-left: 20px;
        padding-right: 20px;
    }

    /* 表单优化 */
    .form-group {
        margin-bottom: 1.2rem;
    }

    /* 按钮优化 */
    .btn {
        padding: 0.5rem 1rem;
        font-size: 0.95rem;
    }

    /* 表格优化 */
    .table td,
    .table th {
        padding: 8px;
        font-size: 0.9rem;
    }

    /* Flash消息调整 */
    .flash-container {
        right: 15px;
        left: 15px;
        max-width: none;
    }
}

/* 移动端 (576px - 767px) */
@media (min-width: 576px) and (max-width: 767px) {
    .container-fluid {
        padding-left: 15px;
        padding-right: 15px;
    }

    /* 标题优化 */
    h1 {
        font-size: 1.5rem;
        margin-bottom: 1rem;
    }

    h1 small {
        font-size: 0.8rem;
        display: block;
        margin-top: 0.5rem;
    }

    /* 表单优化 */
    .form-group {
        margin-bottom: 1rem;
    }

    .form-control {
        font-size: 16px;
        /* 防止iOS缩放 */
        padding: 0.6rem 0.75rem;
    }

    textarea.form-control {
        min-height: 100px;
    }

    /* 按钮优化 */
    .btn {
        padding: 0.6rem 1rem;
        font-size: 1rem;
        min-height: 44px;
        /* 触摸友好 */
    }

    .btn-block {
        margin-bottom: 0.75rem;
    }

    /* 表格响应式 */
    .table-responsive {
        border: none;
        margin-bottom: 1rem;
    }

    .table td,
    .table th {
        padding: 6px 4px;
        font-size: 0.85rem;
        white-space: nowrap;
    }

    /* 卡片优化 */
    .card {
        margin-bottom: 1rem;
    }

    .card-body {
        padding: 1rem;
    }

    /* Flash消息调整 */
    .flash-container {
        top: 10px;
        right: 10px;
        left: 10px;
        max-width: none;
    }
}

/* 小屏幕移动端 (最大575px) */
@media (max-width: 575px) {
    .container-fluid {
        padding-left: 10px;
        padding-right: 10px;
    }

    /* 标题优化 */
    h1 {
        font-size: 1.3rem;
        margin-bottom: 0.8rem;
        line-height: 1.3;
    }

    h1 small {
        font-size: 0.75rem;
        display: block;
        margin-top: 0.3rem;
    }

    /* 表单优化 */
    .form-group {
        margin-bottom: 0.8rem;
    }

    .form-control {
        font-size: 16px;
        /* 防止iOS缩放 */
        padding: 0.7rem 0.75rem;
        border-radius: 6px;
    }

    textarea.form-control {
        min-height: 80px;
        resize: vertical;
    }

    label {
        font-size: 0.9rem;
        font-weight: 600;
        margin-bottom: 0.3rem;
    }

    /* 按钮优化 */
    .btn {
        padding: 0.7rem 1rem;
        font-size: 1rem;
        min-height: 48px;
        /* 更大的触摸区域 */
        border-radius: 6px;
        font-weight: 500;
    }

    .btn-block {
        margin-bottom: 0.6rem;
    }

    .btn-sm {
        padding: 0.4rem 0.6rem;
        font-size: 0.85rem;
        min-height: 36px;
    }

    /* 表格移动端优化 */
    .table-responsive {
        border: none;
        margin-bottom: 1rem;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .table {
        margin-bottom: 0;
        min-width: 600px;
        /* 确保表格有最小宽度 */
    }

    .table td,
    .table th {
        padding: 8px 6px;
        font-size: 0.8rem;
        white-space: nowrap;
        min-width: 80px;
    }

    .table th {
        font-size: 0.75rem;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.5px;
    }

    /* 卡片优化 */
    .card {
        margin-bottom: 1rem;
        border-radius: 8px;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    }

    .card-header {
        padding: 0.8rem 1rem;
        background-color: #f8f9fa;
        border-bottom: 1px solid #dee2e6;
    }

    .card-header h5,
    .card-header h6 {
        margin-bottom: 0;
        font-size: 0.95rem;
    }

    .card-body {
        padding: 1rem;
    }

    /* 用户信息区域优化 */
    #user_info,
    #cancel_user_info {
        padding: 0.8rem;
        margin-top: 0.8rem;
        border-radius: 6px;
    }

    #user_info p,
    #cancel_user_info p {
        margin-bottom: 0.5rem;
        font-size: 0.9rem;
    }

    /* Alert优化 */
    .alert {
        padding: 0.8rem;
        margin-bottom: 1rem;
        border-radius: 6px;
        font-size: 0.9rem;
    }

    .alert small {
        font-size: 0.8rem;
    }

    /* Badge优化 */
    .badge {
        font-size: 0.75rem;
        padding: 0.3rem 0.6rem;
        border-radius: 4px;
    }

    /* Flash消息移动端优化 */
    .flash-container {
        top: 5px;
        right: 5px;
        left: 5px;
        max-width: none;
    }

    .flash-container .alert {
        margin-bottom: 0;
        font-size: 0.85rem;
        padding: 0.6rem 0.8rem;
    }

    /* 操作按钮区域优化 */
    .filter-button {
        margin-bottom: 1rem;
        text-align: center;
    }

    .filter-button .btn {
        margin: 0.2rem;
        min-width: 100px;
    }
}

/* Flash消息样式 */
.flash-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1050;
    max-width: 400px;
}

/* 加载状态样式 */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

/* 禁用状态样式 */
.form-control:disabled,
.form-control[readonly] {
    background-color: #e9ecef;
    opacity: 1;
}

/* 系统状态提示样式 */
.alert {
    border-radius: 6px;
    border: none;
}

.alert-success {
    background-color: #d4edda;
    color: #155724;
}

.alert-warning {
    background-color: #fff3cd;
    color: #856404;
}

.alert-danger {
    background-color: #f8d7da;
    color: #721c24;
}

/* DataTables样式调整 */
.dataTables_wrapper .dataTables_length,
.dataTables_wrapper .dataTables_filter,
.dataTables_wrapper .dataTables_info,
.dataTables_wrapper .dataTables_paginate {
    margin-top: 10px;
    margin-bottom: 10px;
}

.dataTables_wrapper .dataTables_paginate .paginate_button {
    padding: 0.375rem 0.75rem;
    margin-left: 2px;
    border-radius: 4px;
}

/* 操作按钮样式 */
.btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
    border-radius: 3px;
}

/* 表格行悬停效果 */
.table-hover tbody tr:hover {
    background-color: rgba(0, 123, 255, 0.075);
}

/* 文本截断 */
.text-truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 居中对齐 */
.text-center {
    text-align: center;
}

/* 右对齐 */
.text-right {
    text-align: right;
}

/* ========== 移动端专用优化 ========== */

/* 触摸友好的交互元素 */
@media (max-width: 767px) {

    /* 确保所有可点击元素有足够的触摸区域 */
    .btn,
    button,
    [role="button"] {
        min-height: 44px;
        min-width: 44px;
    }

    /* 链接间距优化 */
    a:not(.btn) {
        padding: 8px 4px;
        margin: 4px 0;
        display: inline-block;
    }

    /* 表单元素触摸优化 */
    .form-control,
    .form-select {
        min-height: 44px;
        font-size: 16px;
        /* 防止iOS Safari缩放 */
    }

    /* 复选框和单选按钮优化 */
    .form-check-input {
        width: 20px;
        height: 20px;
        margin-top: 0.125em;
    }

    .form-check-label {
        padding-left: 8px;
        min-height: 44px;
        display: flex;
        align-items: center;
    }
}

/* 横屏模式优化 */
@media (max-width: 767px) and (orientation: landscape) {

    /* 减少垂直间距以适应横屏 */
    .container-fluid {
        padding-top: 10px;
        padding-bottom: 10px;
    }

    h1 {
        font-size: 1.2rem;
        margin-bottom: 0.5rem;
    }

    .form-group {
        margin-bottom: 0.6rem;
    }

    .btn-block {
        margin-bottom: 0.4rem;
    }

    .card-body {
        padding: 0.8rem;
    }
}

/* 高分辨率屏幕优化 */
@media (-webkit-min-device-pixel-ratio: 2),
(min-resolution: 192dpi) {

    /* 确保在高分辨率屏幕上的清晰度 */
    .table {
        border-collapse: separate;
        border-spacing: 0;
    }

    .btn {
        border-width: 1px;
    }

    .form-control {
        border-width: 1px;
    }
}

/* 深色模式支持（如果用户系统设置为深色模式） */
@media (prefers-color-scheme: dark) {
    /* 这里可以添加深色模式的样式，目前保持默认 */
}

/* 减少动画效果（如果用户偏好减少动画） */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* 打印样式优化 */
@media print {

    .flash-container,
    .filter-button,
    .btn,
    button {
        display: none !important;
    }

    .container-fluid {
        max-width: none;
        padding: 0;
    }

    .table {
        font-size: 12px;
    }

    .card {
        border: 1px solid #000;
        box-shadow: none;
    }
}