/* 自定义样式 */
body {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Microsoft YaHei', sans-serif;
}

.container {
    max-width: 1200px;
    position: relative;
    z-index: 1;
}

/* 头部样式优化 */
.d-flex.justify-content-between.align-items-center.mb-4 {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 1rem;
    padding: 1.5rem;
    margin-bottom: 2rem !important;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

h1.text-center {
    background: linear-gradient(135deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 700;
    font-size: 2.5rem;
    margin: 0;
}

/* 关键指标卡片 */
#dashboardCards .card {
    border: none;
    border-radius: 1rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    background: rgba(255, 255, 255, 0.9);
    transition: all 0.4s ease;
    overflow: hidden;
    position: relative;
}

#dashboardCards .card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--card-color), transparent);
}

#dashboardCards .card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.15);
}

#dashboardCards .card-body {
    padding: 1.5rem;
    position: relative;
    z-index: 2;
}

#dashboardCards .card h4 {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

#dashboardCards .card span {
    font-size: 0.9rem;
    opacity: 0.8;
}

#dashboardCards .card i {
    opacity: 0.8;
    transition: all 0.3s ease;
}

#dashboardCards .card:hover i {
    transform: scale(1.1);
    opacity: 1;
}

/* 选项卡样式优化 */
.nav-tabs {
    border: none;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 1rem;
    padding: 0.5rem;
    margin-bottom: 2rem;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

.nav-tabs .nav-link {
    border: none;
    border-radius: 0.75rem;
    padding: 0.75rem 1.5rem;
    margin: 0 0.25rem;
    font-weight: 600;
    color: #6c757d;
    transition: all 0.3s ease;
    position: relative;
}

.nav-tabs .nav-link.active {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(102, 126, 234, 0.3);
}

.nav-tabs .nav-link:not(.active):hover {
    background: rgba(102, 126, 234, 0.1);
    color: #667eea;
}

/* 卡片样式优化 */
.card {
    border: none;
    border-radius: 1rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    background: rgba(255, 255, 255, 0.95);
    transition: all 0.4s ease;
    overflow: hidden;
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.15);
}

.card-header {
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    padding: 1.25rem 1.5rem;
    border-radius: 1rem 1rem 0 0 !important;
}

.card-header h5 {
    margin: 0;
    font-weight: 600;
    color: #495057;
}

/* 按钮样式优化 */
.btn {
    border-radius: 0.75rem;
    padding: 0.75rem 1.5rem;
    font-weight: 600;
    transition: all 0.3s ease;
    border: none;
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.btn:hover::before {
    left: 100%;
}

.btn:not(:disabled):hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

.btn-primary {
    background: linear-gradient(135deg, #667eea, #764ba2);
}

.btn-success {
    background: linear-gradient(135deg, #28a745, #20c997);
}

.btn-warning {
    background: linear-gradient(135deg, #ffc107, #fd7e14);
}

.btn-danger {
    background: linear-gradient(135deg, #dc3545, #e83e8c);
}

/* 表单样式优化 */
.form-control, .form-select {
    border-radius: 0.75rem;
    border: 1px solid #e9ecef;
    padding: 0.75rem 1rem;
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.8);
}

.form-control:focus, .form-select:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 0.2rem rgba(102, 126, 234, 0.25);
    transform: translateY(-1px);
    background: white;
}

/* 表格样式优化 */
.table {
    margin-bottom: 0;
}

.table th {
    border-top: none;
    font-weight: 600;
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    color: #495057;
    padding: 1rem;
    border-bottom: 2px solid #667eea;
}

.table td {
    padding: 0.75rem 1rem;
    vertical-align: middle;
    border-color: #f8f9fa;
}

.table tbody tr {
    transition: all 0.3s ease;
}

.table tbody tr:hover {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.05), rgba(118, 75, 162, 0.05));
    transform: scale(1.01);
}

/* 模态框样式优化 */
.modal-content {
    border: none;
    border-radius: 1rem;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(20px);
    background: rgba(255, 255, 255, 0.95);
}

.modal-header {
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    border-radius: 1rem 1rem 0 0;
}

/* 通知和提示样式 */
.alert {
    border: none;
    border-radius: 1rem;
    border-left: 4px solid;
    animation: slideIn 0.4s ease-out;
    backdrop-filter: blur(10px);
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* 会员余额和VIP等级样式 */
.member-balance {
    font-weight: 700;
    color: #28a745;
    font-size: 1.1em;
    background: linear-gradient(135deg, #28a745, #20c997);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.vip-level {
    display: inline-block;
    padding: 0.5rem 1rem;
    font-size: 0.8rem;
    font-weight: 700;
    line-height: 1;
    text-align: center;
    white-space: nowrap;
    vertical-align: baseline;
    border-radius: 1rem;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.vip-level:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

.vip-level-1 { background: linear-gradient(135deg, #6c757d, #495057); color: white; }
.vip-level-2 { background: linear-gradient(135deg, #adb5bd, #6c757d); color: white; }
.vip-level-3 { background: linear-gradient(135deg, #ffc107, #fd7e14); color: black; }
.vip-level-4 { background: linear-gradient(135deg, #667eea, #764ba2); color: white; }

.discount-badge {
    display: inline-block;
    padding: 0.5rem 1rem;
    font-size: 0.8rem;
    font-weight: 700;
    line-height: 1;
    text-align: center;
    white-space: nowrap;
    vertical-align: baseline;
    border-radius: 1rem;
    background: linear-gradient(135deg, #28a745, #20c997);
    color: white;
}

/* 搜索框样式 */
#memberSearch, #productSearch, #consumptionSearch {
    border-radius: 2rem;
    padding: 0.5rem 1rem;
    border: 1px solid #e9ecef;
    background: rgba(255, 255, 255, 0.8);
    transition: all 0.3s ease;
}

#memberSearch:focus, #productSearch:focus, #consumptionSearch:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 0.2rem rgba(102, 126, 234, 0.25);
    background: white;
}

/* 移动端响应式设计 - 方案四 */
@media (max-width: 1200px) {
    /* 平板设备适配 */
    .container {
        max-width: 100%;
        padding: 0.75rem;
    }
    
    #dashboardCards .col-md-3 {
        flex: 0 0 50%;
        max-width: 50%;
        margin-bottom: 1rem;
    }
}

@media (max-width: 768px) {
    /* 手机设备适配 */
    body {
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        font-size: 14px;
    }
    
    .container {
        padding: 0.5rem;
    }
    
    /* 头部布局优化 */
    .d-flex.justify-content-between.align-items-center.mb-4 {
        flex-direction: column;
        text-align: center;
        padding: 1rem;
        margin-bottom: 1rem !important;
    }
    
    h1.text-center {
        font-size: 1.5rem;
        margin-bottom: 1rem !important;
        line-height: 1.2;
    }
    
    /* 选项卡优化 */
    .nav-tabs {
        flex-wrap: wrap;
        padding: 0.25rem;
        border-radius: 0.75rem;
    }
    
    .nav-tabs .nav-item {
        flex: 1 0 33.333%;
        margin-bottom: 0.25rem;
    }
    
    .nav-tabs .nav-link {
        padding: 0.5rem 0.75rem;
        font-size: 0.8rem;
        margin: 0.125rem;
        text-align: center;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    /* 关键指标卡片布局 */
    #dashboardCards .col-md-3 {
        flex: 0 0 100%;
        max-width: 100%;
        margin-bottom: 0.75rem;
    }
    
    #dashboardCards .card {
        margin-bottom: 0.5rem;
    }
    
    #dashboardCards .card-body {
        padding: 1rem;
    }
    
    #dashboardCards .card h4 {
        font-size: 1.3rem;
    }
    
    /* 卡片内容优化 */
    .card {
        margin-bottom: 0.75rem;
    }
    
    .card-header {
        padding: 0.75rem 1rem;
    }
    
    .card-header h5 {
        font-size: 1rem;
    }
    
    .card-body {
        padding: 0.75rem;
    }
    
    /* 按钮优化 */
    .btn {
        padding: 0.5rem 1rem;
        font-size: 0.8rem;
        margin-bottom: 0.25rem;
        white-space: nowrap;
    }
    
    /* 表单控件优化 */
    .form-control, .form-select {
        padding: 0.5rem 0.75rem;
        font-size: 0.9rem;
    }
    
    /* 表格优化 */
    .table-responsive {
        font-size: 0.8rem;
        margin-bottom: 0.5rem;
    }
    
    .table th, .table td {
        padding: 0.5rem 0.75rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    /* 搜索框优化 */
    #memberSearch, #productSearch, #consumptionSearch {
        width: 100% !important;
        margin-bottom: 0.75rem;
        font-size: 0.9rem;
    }
    
    /* 模态框优化 */
    .modal-dialog {
        margin: 0.5rem;
        max-width: calc(100% - 1rem);
    }
    
    .modal-content {
        border-radius: 0.75rem;
    }
    
    .modal-header {
        padding: 0.75rem 1rem;
    }
    
    .modal-body {
        padding: 0.75rem;
    }
    
    /* 表格水平滚动优化 */
    .table-responsive::-webkit-scrollbar {
        height: 6px;
    }
    
    .table-responsive::-webkit-scrollbar-thumb {
        background: rgba(102, 126, 234, 0.5);
        border-radius: 3px;
    }
}

@media (max-width: 576px) {
    /* 小屏手机特别优化 */
    .container {
        padding: 0.25rem;
    }
    
    .nav-tabs .nav-item {
        flex: 1 0 50%;
    }
    
    .nav-tabs .nav-link {
        font-size: 0.75rem;
        padding: 0.4rem 0.6rem;
    }
    
    /* 表单布局优化 */
    .row .col-md-6 {
        flex: 0 0 100%;
        max-width: 100%;
    }
    
    /* 按钮组优化 */
    .btn-group .btn {
        flex: 1;
        min-width: auto;
    }
    
    /* 卡片内容压缩 */
    .card-body {
        padding: 0.5rem;
    }
    
    /* 下拉菜单优化 */
    .dropdown-menu {
        min-width: 200px;
        font-size: 0.9rem;
    }
}

@media (max-width: 375px) {
    /* 超小屏手机优化 */
    body {
        font-size: 13px;
    }
    
    h1.text-center {
        font-size: 1.25rem;
    }
    
    .nav-tabs .nav-item {
        flex: 1 0 100%;
    }
    
    .nav-tabs .nav-link {
        font-size: 0.7rem;
    }
    
    /* 按钮文字大小调整 */
    .btn {
        font-size: 0.75rem;
        padding: 0.4rem 0.8rem;
    }
}

/* 触摸设备优化 */
@media (hover: none) and (pointer: coarse) {
    /* 触摸设备增大点击区域 */
    .btn {
        min-height: 44px;
        min-width: 44px;
    }
    
    .nav-link {
        min-height: 44px;
        padding: 12px 16px;
    }
    
    .form-control, .form-select {
        min-height: 44px;
    }
    
    /* 触摸滚动优化 */
    .table-responsive {
        -webkit-overflow-scrolling: touch;
    }
    
    /* 禁用长按选择 */
    .table-responsive {
        -webkit-user-select: none;
        -moz-user-select: none;
        -ms-user-select: none;
        user-select: none;
    }
    
    /* 触摸反馈 */
    .btn:active, .nav-link:active {
        transform: scale(0.98);
        transition: transform 0.1s ease;
    }
}

/* 横屏优化 */
@media (max-width: 768px) and (orientation: landscape) {
    .container {
        padding: 0.5rem;
    }
    
    .nav-tabs .nav-item {
        flex: 1 0 25%;
    }
    
    .table-responsive {
        max-height: 40vh;
    }
}

/* 暗色模式支持 */
@media (prefers-color-scheme: dark) {
    .card {
        background: rgba(30, 30, 40, 0.95);
        color: #ffffff;
    }
    
    .card-header {
        background: linear-gradient(135deg, #2d3748, #4a5568);
    }
    
    .nav-tabs {
        background: rgba(30, 30, 40, 0.95);
    }
    
    .form-control, .form-select {
        background: rgba(45, 55, 72, 0.8);
        border-color: #4a5568;
        color: #ffffff;
    }
    
    .form-control:focus, .form-select:focus {
        background: rgba(45, 55, 72, 1);
        color: #ffffff;
    }
}

/* 可访问性优化 */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .btn:hover, .card:hover {
        transform: none !important;
    }
}

/* 动画效果 */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.card, .nav-tabs, #dashboardCards .card {
    animation: fadeInUp 0.6s ease-out;
}

/* 滚动条样式优化 */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #667eea, #764ba2);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #764ba2, #667eea);
}