/* 选项卡样式 */
.tabs {
    display: flex;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 20px;
    overflow-x: auto;
    white-space: nowrap;
}

.tab-btn {
    padding: 10px 20px;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    color: var(--text-color);
    transition: all 0.3s;
}

.tab-btn:hover {
    color: var(--primary-color);
}

.tab-btn.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

/* 记住设备开关样式 */
.remember-wrapper {
    display: flex;
    align-items: center;
    margin-bottom: 20px;
    padding: 12px 16px;
    background: linear-gradient(135deg, #fff8f5 0%, #fff 100%);
    border-radius: 10px;
    border: 1px solid #ffe8e0;
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 26px;
    margin-right: 12px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: 0.3s;
    border-radius: 26px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.toggle-switch input:checked + .toggle-slider {
    background: linear-gradient(135deg, #ff6b35 0%, #ff8c33 100%);
}

.toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(22px);
}

.toggle-switch input:focus + .toggle-slider {
    box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.2);
}

.remember-text {
    font-size: 14px;
    color: #666;
    font-weight: 500;
}

.login-btn {
    width: 100%;
    padding: 14px;
    font-size: 16px;
    font-weight: 600;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 筛选栏样式 */
.filter-bar {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 20px;
    padding: 15px;
    background-color: var(--header-bg);
    border-radius: 8px;
}

/* 批量操作样式 */
.batch-actions {
    margin-top: 20px;
    display: flex;
    gap: 10px;
}

/* 后台主容器放宽，减少卡密列表拥挤感 */
.main-content .container {
    max-width: 1520px;
}

/* 卡密列表表格优化 */
.tab-content[data-tab="card-keys"] .table-responsive {
    margin-top: 16px;
    border: 1px solid var(--border-color);
    border-radius: 16px;
    overflow: auto;
    background: var(--card-bg);
    box-shadow: 0 10px 28px rgba(31, 45, 61, 0.06);
}

#card-key-table {
    min-width: 1350px;
    table-layout: fixed;
    border-collapse: separate;
    border-spacing: 0;
}

#card-key-table thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    padding: 14px 12px;
    white-space: nowrap;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: var(--text-color);
    background: linear-gradient(180deg, var(--header-bg) 0%, rgba(74, 137, 220, 0.08) 100%);
    box-shadow: inset 0 -1px 0 var(--border-color);
}

#card-key-table thead th:first-child {
    border-top-left-radius: 16px;
}

#card-key-table thead th:last-child {
    border-top-right-radius: 16px;
}

#card-key-table td {
    padding: 14px 12px;
    vertical-align: top;
    line-height: 1.65;
    color: var(--text-color);
    background: transparent;
}

#card-key-table tbody tr {
    transition: background-color 0.2s ease, box-shadow 0.2s ease;
}

#card-key-table tbody tr:nth-child(even) {
    background: rgba(74, 137, 220, 0.035);
}

#card-key-table tbody tr:hover {
    background: rgba(74, 137, 220, 0.08);
}

#card-key-table td:nth-child(1),
#card-key-table th:nth-child(1) {
    width: 52px;
    min-width: 52px;
    text-align: center;
}

#card-key-table td:nth-child(2),
#card-key-table th:nth-child(2) {
    width: 160px;
    min-width: 160px;
}

#card-key-table td:nth-child(3),
#card-key-table th:nth-child(3) {
    width: 96px;
    min-width: 96px;
}

#card-key-table td:nth-child(4),
#card-key-table th:nth-child(4) {
    width: 110px;
    min-width: 110px;
}

#card-key-table td:nth-child(5),
#card-key-table th:nth-child(5),
#card-key-table td:nth-child(6),
#card-key-table th:nth-child(6) {
    width: 120px;
    min-width: 120px;
}

#card-key-table td:nth-child(7),
#card-key-table th:nth-child(7),
#card-key-table td:nth-child(8),
#card-key-table th:nth-child(8) {
    width: 150px;
    min-width: 150px;
}

#card-key-table td:nth-child(9),
#card-key-table th:nth-child(9) {
    width: 110px;
    min-width: 110px;
}

#card-key-table td:nth-child(10),
#card-key-table th:nth-child(10) {
    width: 100px;
    min-width: 100px;
}

#card-key-table td:nth-child(11),
#card-key-table th:nth-child(11) {
    width: 280px;
    min-width: 280px;
}

#card-key-table td:nth-child(7),
#card-key-table td:nth-child(8),
#card-key-table td:nth-child(9) {
    font-size: 13px;
    color: var(--gray-color);
}

#card-key-table td:nth-child(11) {
    white-space: normal;
}

#card-key-table td:nth-child(11) .btn {
    width: auto !important;
    margin: 0 6px 6px 0 !important;
    min-width: 60px;
    justify-content: center;
    border-radius: 12px;
    padding: 6px 10px;
    box-shadow: none;
    font-size: 12px;
}

#card-key-table td:nth-child(11) .btn:last-child {
    margin-right: 0 !important;
}

#card-key-table .card-key-inline-toggle {
    display: inline-flex !important;
    align-items: flex-start !important;
    flex-wrap: wrap;
    gap: 6px;
    max-width: 100%;
    padding: 2px 0 !important;
    line-height: 1.55;
}

#card-key-table .card-key-inline-short,
#card-key-table .card-key-inline-full {
    max-width: 100%;
}

#card-key-table .card-key-inline-hint {
    padding: 2px 8px;
    border-radius: 999px;
    background: rgba(74, 137, 220, 0.1);
    color: var(--primary-color) !important;
    font-size: 11px !important;
    font-weight: 600;
}

#card-key-table .card-key-checkbox,
#select-all-card-keys {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

#card-key-table td > div {
    word-break: break-word;
}

.tab-content[data-tab="card-keys"] .table-responsive::-webkit-scrollbar {
    height: 10px;
    width: 10px;
}

.tab-content[data-tab="card-keys"] .table-responsive::-webkit-scrollbar-track {
    background: rgba(74, 137, 220, 0.06);
    border-radius: 999px;
}

.tab-content[data-tab="card-keys"] .table-responsive::-webkit-scrollbar-thumb {
    background: rgba(74, 137, 220, 0.35);
    border-radius: 999px;
}

.tab-content[data-tab="card-keys"] .table-responsive::-webkit-scrollbar-thumb:hover {
    background: rgba(74, 137, 220, 0.55);
}

[data-theme="dark"] .tab-content[data-tab="card-keys"] .table-responsive {
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.25);
}

[data-theme="dark"] #card-key-table thead th {
    background: linear-gradient(180deg, rgba(93, 156, 236, 0.18) 0%, rgba(93, 156, 236, 0.08) 100%);
}

[data-theme="dark"] #card-key-table tbody tr:nth-child(even) {
    background: rgba(255, 255, 255, 0.03);
}

[data-theme="dark"] #card-key-table tbody tr:hover {
    background: rgba(93, 156, 236, 0.16);
}

[data-theme="dark"] #card-key-table .card-key-inline-hint {
    background: rgba(93, 156, 236, 0.18);
    color: #9dc7ff !important;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .tabs {
        flex-wrap: wrap;
    }
    
    .tab-btn {
        flex: 1;
        text-align: center;
        padding: 10px;
    }
    
    .filter-bar {
        flex-direction: column;
    }

    .main-content .container {
        max-width: 100%;
    }

    #card-key-table {
        min-width: 1260px;
    }

    #card-key-table td,
    #card-key-table th {
        padding: 10px 8px;
    }

    #card-key-table td:nth-child(11) .btn {
        min-width: 68px;
        padding: 6px 10px;
    }
}

/* 登录模态框样式 */
.login-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    -webkit-backdrop-filter: blur(5px);
    backdrop-filter: blur(5px);
}

.login-modal-content {
    background: white;
    padding: 40px;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    max-width: 400px;
    width: 90%;
    text-align: center;
}

.login-modal-content h2 {
    margin: 0 0 20px 0;
    color: #333;
    font-size: 24px;
}

.login-form {
    margin-top: 20px;
}

.login-form .form-group {
    margin-bottom: 15px;
}

.login-form .form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #333;
}

.login-form input {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    box-sizing: border-box;
}

.login-form input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.login-form .btn {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
}

.login-error {
    background: #fee;
    color: #c82333;
    padding: 10px;
    border-radius: 6px;
    margin-top: 15px;
    text-align: center;
    font-size: 14px;
}

.login-error.hidden {
    display: none;
}

/* 主内容区域样式 */
.main-content {
    display: block;
}

.main-content.hidden {
    display: none !important;
}

/* 隐藏类 */
.hidden {
    display: none !important;
}

/* 统计面板样式 */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.stat-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    color: white;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.stat-card:nth-child(2) {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.stat-card:nth-child(3) {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
}

.stat-card:nth-child(4) {
    background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
}

.stat-icon {
    font-size: 40px;
}

.stat-info {
    flex: 1;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 5px;
}

.stat-label {
    font-size: 14px;
    opacity: 0.9;
}

.stats-row {
    display: flex;
    flex-wrap: wrap;
    gap: 30px;
    padding: 15px;
    background: var(--header-bg);
    border-radius: 8px;
}

.stats-item {
    display: flex;
    align-items: center;
    gap: 10px;
}

.stats-label {
    color: var(--gray-color);
    font-size: 14px;
}

.stats-value {
    font-size: 18px;
    font-weight: 600;
    color: var(--primary-color);
}

/* 支付趋势图样式 */
.trend-chart-card {
    background: linear-gradient(180deg, rgba(74, 137, 220, 0.04) 0%, rgba(74, 137, 220, 0.01) 100%);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 18px;
}

.trend-chart-header {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    margin-bottom: 12px;
}

.trend-chart-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    font-size: 13px;
    color: var(--gray-color);
}

.legend-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}

.income-dot {
    background: linear-gradient(180deg, #4a89dc 0%, #5d9cec 100%);
}

.order-dot {
    background: linear-gradient(180deg, #ff8c33 0%, #ff6b35 100%);
}

.trend-chart {
    min-height: 320px;
    display: flex;
    align-items: stretch;
    justify-content: center;
}

.trend-chart-empty {
    width: 100%;
    min-height: 260px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--gray-color);
    background: var(--card-bg);
    border: 1px dashed var(--border-color);
    border-radius: 12px;
}

.trend-chart-bars {
    width: 100%;
    min-height: 320px;
    display: grid;
    grid-template-columns: repeat(7, minmax(80px, 1fr));
    gap: 14px;
    align-items: end;
}

.trend-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.trend-bar-wrap {
    width: 100%;
    height: 220px;
    display: flex;
    align-items: end;
    justify-content: center;
    gap: 10px;
    padding: 0 6px;
    border-bottom: 1px solid var(--border-color);
}

.trend-bar {
    position: relative;
    width: 24px;
    min-height: 0;
    border-radius: 12px 12px 6px 6px;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.trend-bar:hover {
    transform: translateY(-4px);
    opacity: 0.92;
}

.trend-bar-income {
    background: linear-gradient(180deg, #4a89dc 0%, #5d9cec 100%);
    box-shadow: 0 6px 16px rgba(74, 137, 220, 0.28);
}

.trend-bar-orders {
    background: linear-gradient(180deg, #ff9f43 0%, #ff6b35 100%);
    box-shadow: 0 6px 16px rgba(255, 107, 53, 0.24);
}

.trend-tooltip {
    position: absolute;
    left: 50%;
    bottom: calc(100% + 8px);
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.78);
    color: #fff;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 12px;
    line-height: 1;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.trend-bar:hover .trend-tooltip {
    opacity: 1;
}

.trend-group-values {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    min-height: 38px;
}

.trend-income-value {
    font-size: 12px;
    font-weight: 700;
    color: var(--primary-color);
}

.trend-order-value {
    font-size: 12px;
    color: #ff6b35;
    font-weight: 600;
}

.trend-label {
    font-size: 12px;
    color: var(--gray-color);
    font-weight: 600;
}

/* 弹窗样式 */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.modal.hidden {
    display: none !important;
}

.modal-content {
    background: var(--card-bg);
    border-radius: 12px;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
    margin: 0;
    font-size: 18px;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--gray-color);
    padding: 0;
    line-height: 1;
}

.modal-close:hover {
    color: var(--danger-color);
}

.modal-body {
    padding: 20px;
}

.modal-body .form-group {
    margin-bottom: 15px;
}

.modal-body .form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
}

.modal-body input,
.modal-body textarea,
.modal-body select {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 14px;
    box-sizing: border-box;
    background: var(--bg-color);
    color: var(--text-color);
}

.modal-body input:focus,
.modal-body textarea:focus,
.modal-body select:focus {
    outline: none;
    border-color: var(--primary-color);
}

/* 订单详情样式 */
.order-detail-row {
    display: flex;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
}

.order-detail-row:last-child {
    border-bottom: none;
}

.order-detail-label {
    width: 100px;
    color: var(--gray-color);
    flex-shrink: 0;
}

.order-detail-value {
    flex: 1;
    word-break: break-all;
}

/* 卡密状态筛选 */
.status-filter-group {
    display: flex;
    gap: 10px;
    align-items: center;
}

.status-filter-group select {
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-color);
    color: var(--text-color);
}

/* 复选框样式 */
.checkbox-group {
    margin: 15px 0;
}

.checkbox-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-weight: 500;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin-right: 8px;
    cursor: pointer;
    flex-shrink: 0;
}

.checkbox-label span {
    user-select: none;
}

/* 订单详情高亮代码样式 */
.highlight-code {
    font-size: 16px;
    font-weight: 700;
    background: linear-gradient(135deg, #f5f7fa 0%, #e8ecf1 100%);
    padding: 4px 10px;
    border-radius: 6px;
    color: #333;
    border: 1px solid #e0e0e0;
}

/* 排行榜图标样式 */
.rank-icon {
    font-size: 24px;
    display: inline-block;
}

.rank-icon.gold {
    animation: shine 1.5s ease-in-out infinite;
}

.rank-icon.silver {
    opacity: 0.9;
}

.rank-icon.bronze {
    opacity: 0.85;
}

.rank-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: var(--header-bg);
    border-radius: 50%;
    font-weight: 600;
    font-size: 14px;
    color: var(--text-color);
}

@keyframes shine {
    0%, 100% {
        transform: scale(1);
        filter: brightness(1);
    }
    50% {
        transform: scale(1.1);
        filter: brightness(1.2);
    }
}

/* 移动端统计面板响应式 */
@media (max-width: 768px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .stat-card {
        padding: 15px 12px;
        flex-direction: column;
        text-align: center;
        gap: 8px;
    }

    .stat-icon {
        font-size: 28px;
    }

    .stat-value {
        font-size: 20px;
        margin-bottom: 2px;
    }

    .stat-label {
        font-size: 12px;
    }

    .stats-row {
        flex-direction: column;
        gap: 15px;
        padding: 12px;
    }

    .stats-item {
        justify-content: space-between;
        padding: 8px 0;
        border-bottom: 1px solid var(--border-color);
    }

    .stats-item:last-child {
        border-bottom: none;
    }

    .stats-label {
        font-size: 13px;
    }

    .stats-value {
        font-size: 16px;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }

    .stat-card {
        padding: 12px 10px;
    }

    .stat-icon {
        font-size: 24px;
    }

    .stat-value {
        font-size: 18px;
    }

    .stat-label {
        font-size: 11px;
    }

    .trend-chart-card {
        padding: 14px 10px;
    }

    .trend-chart {
        min-height: 280px;
    }

    .trend-chart-bars {
        grid-template-columns: repeat(7, minmax(42px, 1fr));
        gap: 8px;
        min-height: 280px;
    }

    .trend-bar-wrap {
        height: 180px;
        gap: 6px;
        padding: 0 2px;
    }

    .trend-bar {
        width: 16px;
        border-radius: 10px 10px 4px 4px;
    }

    .trend-group-values {
        min-height: 34px;
    }

    .trend-income-value,
    .trend-order-value,
    .trend-label {
        font-size: 10px;
    }

    .trend-chart-legend {
        gap: 10px;
        font-size: 12px;
    }
}
