/* 账号管理页面样式 */

/* 页面头部 */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 0 20px;
}

.page-header h1 {
    margin: 0;
    color: #333;
    font-size: 24px;
}

/* 按钮样式 */
.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    transition: all 0.3s ease;
}

.btn-primary {
    background-color: #007bff;
    color: white;
}

.btn-primary:hover {
    background-color: #0056b3;
}

.btn-secondary {
    background-color: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background-color: #545b62;
}

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

.btn-success:hover {
    background-color: #1e7e34;
}

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

.btn-warning:hover {
    background-color: #e0a800;
}

.btn-danger {
    background-color: #dc3545;
    color: white;
}

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

.btn-sm {
    padding: 4px 8px;
    font-size: 12px;
}

/* 搜索和筛选区域 */
.search-filter-section {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    padding: 0 20px;
    flex-wrap: wrap;
}

.search-box {
    display: flex;
    flex: 0 0 auto;
    width: 300px;
    min-width: 250px;
    max-width: 400px;
}

.search-box input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px 0 0 4px;
    font-size: 14px;
}

.search-box button {
    padding: 8px 12px;
    background-color: #007bff;
    color: white;
    border: 1px solid #007bff;
    border-radius: 0 4px 4px 0;
    cursor: pointer;
}

.search-box button:hover {
    background-color: #0056b3;
}

.filter-box {
    display: flex;
    gap: 10px;
    align-items: center;
}

.filter-box select {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    background-color: white;
}

/* 表格容器 */
.table-container {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin: 0 20px;
    overflow-x: auto;
}

/* 表格样式 */
.account-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 800px;
}

.account-table th,
.account-table td {
    padding: 12px 10px; /* 增加行高 */
    text-align: left;
    border-bottom: 1px solid #eee;
    font-size: 14px; /* 调整字体大小 */
}

.account-table th {
    font-size: 15px; /* 调整字体大小 */
    background-color: #f8f9fa;
    font-weight: 600;
    color: #333;
    position: sticky;
    top: 0;
    z-index: 10;
}

.account-table tbody tr:nth-child(odd) {
    background-color: #fdfdfd; /* 斑马纹效果 */
}

.account-table tbody tr:hover {
    background-color: #f0f8ff; /* 悬停效果 */
}

/* 状态标签 */
.status-badge {
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.status-active {
    background-color: #d4edda;
    color: #155724;
}

.status-inactive {
    background-color: #f8d7da;
    color: #721c24;
}

.status-banned {
    background-color: #f5c6cb;
    color: #721c24;
    border: 1px solid #f1b0b7;
}

/* 操作按钮组 */
.action-buttons {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
}

.action-buttons .btn-sm {
    font-size: 11px;
    padding: 3px 6px;
}

/* 余额列样式 */
.balance-cell {
    font-weight: 600;
    color: #28a745;
    text-align: right;
    font-family: 'Courier New', monospace;
}

/* 模态框样式 */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
}

.modal-content {
    background-color: white;
    margin: 50px auto;
    border-radius: 8px;
    width: 90%;
    max-width: 500px;
    max-height: calc(100vh - 100px); /* 减去上下各50px的边距 */
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    position: relative;
    top: 50%;
    transform: translateY(-50%);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #eee;
}

.modal-header h3 {
    margin: 0;
    color: #333;
}

.close {
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
    color: #999;
}

.close:hover {
    color: #333;
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 20px;
    border-top: 1px solid #eee;
    flex-wrap: wrap; /* 允许按钮换行 */
}

/* 表单样式 */
.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #333;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    box-sizing: border-box;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 2px rgba(0,123,255,0.25);
}

/* 加载动画 */
.loading {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255,255,255,0.8);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 响应式设计 - 移动端适配 */
@media (max-width: 768px) {
    .page-header {
        flex-direction: column;
        gap: 15px;
        align-items: stretch;
        padding: 0 15px;
    }

    .page-header h1 {
        font-size: 20px;
        text-align: center;
    }

    .search-filter-section {
        flex-direction: column;
        padding: 0 15px;
    }

    .search-box {
        min-width: auto;
    }

    .table-container {
        margin: 0 15px;
        border-radius: 4px;
    }

    .account-table {
        font-size: 12px;
    }

    .account-table th,
    .account-table td {
        padding: 8px 6px;
    }

    .action-buttons {
        flex-direction: column;
    }

    .btn-sm {
        padding: 6px 10px;
        font-size: 11px;
    }

    .modal-content {
        margin: 10% auto;
        width: 95%;
    }

    .modal-header,
    .modal-body,
    .modal-footer {
        padding: 15px;
    }

    .pagination {
        flex-wrap: wrap;
        margin: 15px;
    }
}

@media (max-width: 480px) {
    .account-table {
        min-width: 600px;
    }
    
    .page-header h1 {
        font-size: 18px;
    }
    
    .btn {
        font-size: 12px;
        padding: 6px 12px;
    }
    
    .modal-content {
        margin: 5% auto;
        width: 98%;
    }
}

/* 表格在小屏幕上的优化 */
@media (max-width: 600px) {
    .table-container {
        overflow-x: scroll;
        -webkit-overflow-scrolling: touch;
    }
    
    .account-table th:nth-child(n+6),
    .account-table td:nth-child(n+6) {
        min-width: 100px;
    }
}

/* 暗色主题支持 */
@media (prefers-color-scheme: dark) {
    .table-container {
        background: #2d3748;
    }
    
    .account-table th {
        background-color: #4a5568;
        color: #e2e8f0;
    }
    
    .account-table td {
        color: #e2e8f0;
        border-bottom-color: #4a5568;
    }
    
    .account-table tbody tr:hover {
        background-color: #4a5568;
    }
    
    .modal-content {
        background-color: #2d3748;
        color: #e2e8f0;
    }
    
    .form-group input,
    .form-group select,
    .form-group textarea {
        background-color: #4a5568;
        color: #e2e8f0;
        border-color: #718096;
    }
}

/* 移动端响应式样式 */
@media (max-width: 768px) {
    /* 头部样式优化 */
    .header {
        padding: 10px 15px;
    }
    
    .header span {
        font-size: 16px;
    }
    
    /* 侧边栏优化 */
    .sidebar {
        width: 250px;
    }
    
    /* 内容区域优化 - 加强特异性 */
    body .content,
    .content {
        margin-left: 0 !important;
        margin-right: 0 !important;
        padding: 10px;
        width: 100% !important;
        box-sizing: border-box !important;
    }
    
    .page-header {
        margin: 0 0 15px 0;
        padding: 0 10px;
    }
    
    .page-header h1 {
        font-size: 20px;
    }
    
    /* 搜索筛选区域移动端优化 */
    .search-filter-section {
        flex-direction: column;
        gap: 10px;
        padding: 0 10px;
    }
    
    .search-box {
        width: 100%;
        max-width: none;
        min-width: auto;
    }
    
    .filter-box {
        flex-direction: column;
        gap: 10px;
        align-items: stretch;
    }
    
    .filter-box select {
        width: 100%;
    }
    
    .filter-box button {
        width: 100%;
        padding: 12px;
        font-size: 16px;
    }
    
    /* 表格容器移动端优化 - 加强特异性 */
    body .table-container,
    .table-container {
        margin: 0 auto !important;
        padding: 0 10px !important;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        max-width: 100% !important;
        box-sizing: border-box !important;
        width: calc(100% - 20px) !important;
    }
    
    .account-table {
        min-width: 800px;
        font-size: 14px;
    }
    
    .account-table th,
    .account-table td {
        padding: 8px 6px;
        white-space: nowrap;
    }
    
    /* 按钮优化 */
    .btn-sm {
        padding: 6px 10px;
        font-size: 12px;
        margin: 2px;
    }
    
    /* 分页优化 */
    .pagination {
        margin: 15px 10px;
        justify-content: center;
        flex-wrap: wrap;
    }
    
    .pagination button {
        margin: 2px;
        padding: 8px 12px;
        min-width: 40px;
    }
    
    /* 模态框移动端优化 */
    .modal-content {
        width: 95%;
        max-width: 400px;
        margin: 20px auto;
        max-height: 90vh;
        overflow-y: auto;
    }
    
    .modal-header {
        padding: 15px;
    }
    
    .modal-body {
        padding: 15px;
        max-height: 60vh;
        overflow-y: auto;
    }
    
    .modal-footer {
        padding: 15px;
        flex-direction: row; /* 允许按钮在同一行显示 */
        flex-wrap: wrap; /* 允许按钮换行 */
        justify-content: flex-end; /* 按钮靠右对齐 */
        gap: 10px;
    }
    
    .modal-footer button {
        padding: 8px 12px; /* 调整内边距 */
        font-size: 14px; /* 调整字体大小 */
    }
    
    /* 表单优化 */
    .form-group {
        margin-bottom: 15px;
    }
    
    .form-group input,
    .form-group select,
    .form-group textarea {
        padding: 12px;
        font-size: 16px;
        border-radius: 6px;
    }
    
    /* 加载提示优化 */
    .loading {
        padding: 20px;
    }
    
    .loading p {
        font-size: 16px;
        margin-top: 15px;
    }
}

/* 小屏幕设备进一步优化 */
@media (max-width: 480px) {
    .header {
        padding: 8px 10px;
    }
    
    body .content,
    .content {
        margin-left: 0 !important;
        margin-right: 0 !important;
        padding: 8px;
        width: 100% !important;
        box-sizing: border-box !important;
    }
    
    .search-filter-section {
        padding: 0 5px;
    }
    
    body .table-container,
    .table-container {
        margin: 0 auto !important;
        padding: 0 5px !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
        width: calc(100% - 10px) !important;
    }
    
    .account-table {
        font-size: 12px;
    }
    
    .account-table th,
    .account-table td {
        padding: 6px 4px;
    }
    
    .btn-sm {
        padding: 4px 6px;
        font-size: 11px;
    }
    
    .modal-content {
        width: 98%;
        margin: 10px auto;
    }
    
    .pagination {
        margin: 10px 5px;
    }
    
    .pagination button {
        padding: 6px 8px;
        font-size: 14px;
        min-width: 35px;
    }
}

/* PC 和 移动端视图切换 */
.pc-view {
    display: block;
}

.mobile-card-view {
    display: none;
}

.pc-pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 20px;
    padding: 0 20px;
}

.pagination-info {
    color: #666;
    font-size: 14px;
}

.pagination {
    display: flex;
    gap: 5px;
}

.pagination a, .pagination span {
    padding: 6px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    text-decoration: none;
    color: #333;
    font-size: 14px;
}

.pagination a:hover {
    background-color: #f5f5f5;
}

.pagination .current {
    background-color: #007bff;
    color: white;
    border-color: #007bff;
}

.pagination .disabled {
    color: #999;
    cursor: not-allowed;
    background-color: #f9f9f9;
}

/* 移动端卡片布局样式 */
.account-card-list {
    display: grid;
    grid-template-columns: 1fr;
    gap: 15px;
    margin-top: 15px;
}

.load-more-container {
    display: none !important; /* 默认在PC端强制隐藏 */
    justify-content: center;
    margin: 20px 0;
}

@media (max-width: 768px) {
    .account-card {
        margin-bottom: 12px;
    }
}

.load-more-container button {
    padding: 10px 20px;
    font-size: 16px;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.load-more-container button:hover {
    opacity: 0.9;
}

.load-more-container #noMoreData {
    font-size: 14px;
    color: #666;
    text-align: center;
    margin-top: 10px;
}

@media (max-width: 768px) {
    .pc-view {
        display: none;
    }

    .pc-pagination {
        display: none !important;
    }

    .mobile-card-view {
        display: block;
        margin: 0 15px;
    }

    .load-more-container {
        display: flex !important; /* 在移动端显示 */
        padding: 0 15px; /* 添加内边距 */
    }

    .load-more-container button {
        width: 100%; /* 按钮宽度占满容器 */
        padding: 12px; /* 增加内边距使其更高 */
        font-size: 16px;
        border-radius: 8px; /* 更圆润的边角 */
    }
}

.account-card {
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    padding: 15px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    position: relative;
    overflow: hidden;
}

.account-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
}

.card-header .username {
    font-size: 18px;
    font-weight: 700;
    color: #333;
}

.card-header .user-id {
    font-size: 13px;
    color: #888;
}

.card-body {
    margin-bottom: 10px;
}

.card-item {
    display: flex;
    justify-content: space-between;
    padding: 5px 0;
    border-bottom: 1px dashed #f0f0f0;
    font-size: 14px;
}

.card-item:last-child {
    border-bottom: none;
}

.card-item-label {
    color: #666;
    font-weight: 500;
}

.card-item-value {
    color: #333;
    text-align: right;
}

.card-actions {
    display: flex;
    flex-wrap: wrap; /* 允许按钮换行 */
    gap: 8px;
    justify-content: flex-end;
    margin-top: 15px;
    padding-top: 10px;
    border-top: 1px solid #eee;
}

.card-actions .btn-sm {
    flex-grow: 1;
    min-width: 80px;
    text-align: center;
}

/* 状态徽章 */
.card-status-badge {
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    display: inline-block;
}

.card-status-active {
    background-color: #d4edda;
    color: #155724;
}

.card-status-inactive {
    background-color: #f8d7da;
    color: #721c24;
}

.card-status-banned {
    background-color: #f5c6cb;
    color: #721c24;
    border: 1px solid #f1b0b7;
}

/* 暗色主题支持 */
@media (prefers-color-scheme: dark) {
    .account-card {
        background: #2d3748;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    }

    .card-header .username,
    .card-item-value {
        color: #e2e8f0;
    }

    .card-header .user-id,
    .card-item-label {
        color: #a0aec0;
    }

    .card-header,
    .card-item,
    .card-actions {
        border-color: #4a5568;
    }
}

/* 移动端卡片操作按钮优化 */
  @media (max-width: 768px) {
      .card-actions .btn-sm {
        padding: 8px 12px; /* 增加内边距 */
        font-size: 13px; /* 稍微增大字体 */
        min-width: unset; /* 移除最小宽度限制，让flex-grow更好地工作 */
        flex-grow: 1; /* 确保按钮填充可用空间 */
        text-align: center;
        border-radius: 8px; /* 更圆润的边角 */
        box-shadow: 0 2px 4px rgba(0,0,0,0.1); /* 添加轻微阴影 */
    }

    .card-actions .btn-sm:active {
        transform: translateY(1px); /* 点击时下沉效果 */
        box-shadow: 0 1px 2px rgba(0,0,0,0.15); /* 点击时阴影变小 */
    }

    .card-actions .btn-info {
        background-color: #17a2b8; /* 信息蓝 */
    }

    .card-actions .btn-info:hover {
        background-color: #138496;
    }

    .card-actions .btn-warning {
        background-color: #ffc107; /* 警告黄 */
        color: #212529; /* 确保文字颜色可见 */
    }

    .card-actions .btn-warning:hover {
        background-color: #e0a800;
    }

    .card-actions .btn-danger {
        background-color: #dc3545; /* 危险红 */
    }

    .card-actions .btn-danger:hover {
        background-color: #c82333;
    }
}