/* 管理员控制台样式 */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f5f6fa;
}

.admin-container {
    display: grid;
    grid-template-rows: 60px 1fr;
    grid-template-columns: 250px 1fr;
    height: 100vh;
}

/* 顶部导航栏 */
.admin-header {
    grid-column: 1 / -1;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 30px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.admin-header h1 {
    font-size: 20px;
    font-weight: 600;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.logout-btn {
    color: white;
    text-decoration: none;
    padding: 8px 16px;
    border-radius: 4px;
    background-color: rgba(255, 255, 255, 0.2);
    transition: background-color 0.3s;
}

.logout-btn:hover {
    background-color: rgba(255, 255, 255, 0.3);
}

/* 侧边栏 */
.admin-sidebar {
    background-color: white;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.05);
    padding: 20px 0;
}

.sidebar-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 15px 25px;
    color: #333;
    text-decoration: none;
    transition: all 0.3s;
}

.sidebar-item:hover {
    background-color: #f8f9fa;
    color: #667eea;
}

.sidebar-item.active {
    background-color: #eef2ff;
    color: #667eea;
    border-left: 3px solid #667eea;
}

.sidebar-item .icon {
    font-size: 20px;
}

/* 主内容区 */
.admin-main {
    padding: 30px;
    overflow-y: auto;
}

.content-section {
    background-color: white;
    border-radius: 8px;
    padding: 25px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.section-header h2 {
    font-size: 24px;
    color: #333;
}

.refresh-btn {
    padding: 8px 16px;
    background-color: #667eea;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.refresh-btn:hover {
    background-color: #5568d3;
}

/* 筛选栏 */
.filter-bar {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
}

.filter-bar select,
.filter-bar input {
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.filter-bar input {
    flex: 1;
    max-width: 300px;
}

/* 资源表格 */
.resource-table,
.user-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
    table-layout: auto;
}

.resource-table th,
.resource-table td,
.user-table th,
.user-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #eee;
    vertical-align: middle;
}

.resource-table th,
.user-table th {
    background-color: #f8f9fa;
    font-weight: 600;
    color: #666;
    white-space: nowrap;
}

.resource-table tr:hover,
.user-table tr:hover {
    background-color: #f8f9fa;
}

/* 防止短文本列换行 */
.resource-table td:nth-child(7),  /* 状态 */
.resource-table td:nth-child(8),  /* 归属用户 */
.resource-table td:nth-child(9),  /* 到期时间 */
.resource-table td:nth-child(10), /* 操作 */
.resource-table th:nth-child(7),
.resource-table th:nth-child(8),
.resource-table th:nth-child(9),
.resource-table th:nth-child(10) {
    white-space: nowrap;
}

/* 状态徽章不换行 */
.status-badge {
    white-space: nowrap;
    display: inline-block;
}

/* 操作列按钮不换行 */
.resource-table td:last-child {
    white-space: nowrap;
}

/* 资源ID列固定窄宽 */
.resource-table th:first-child,
.resource-table td:first-child {
    white-space: nowrap;
}

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

    font-weight: 600;
}

/* 标签编辑单元格 */
.tag-cell {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.tag-display {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.edit-tag-icon {
    cursor: pointer;
    color: #999;
    font-style: normal;
    font-size: 13px;
    transition: color 0.2s;
    padding: 2px;
}

.edit-tag-icon:hover {
    color: #1890ff;
}

.tag-input {
    font-size: 14px;
    border: 1px solid #1890ff;
    border-radius: 4px;
    padding: 4px 8px;
    width: 160px;
    outline: none;
}

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

.status-stopped {
    background-color: #fff3cd;
    color: #856404;
}

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

.status-deleted {
    background-color: #6c757d;
    color: white;
}

/* 语言切换按钮 */
.lang-btn {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.5);
    color: white;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.3s;
}

.lang-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: white;
}

/* 操作按钮 */
.action-btn {
    padding: 6px 12px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    margin-right: 5px;
    transition: all 0.3s;
}

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

.btn-assign:hover {
    background-color: #218838;
}

.btn-view {
    background-color: #17a2b8;
    color: white;
}

.btn-view:hover {
    background-color: #138496;
}

/* 解绑按钮 */
.btn-unbind {
    background-color: #6c757d;
    color: white;
}

.btn-unbind:hover {
    background-color: #5a6268;
}

/* 统计栏 */
.stats-bar {
    display: flex;
    gap: 30px;
    padding: 15px;
    background-color: #f8f9fa;
    border-radius: 4px;
}

.stats-bar span {
    color: #666;
}

.stats-bar strong {
    color: #667eea;
    margin-left: 5px;
}

/* 弹窗 */
.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 {
    position: relative; /* 添加定位上下文 */
    background-color: white;
    margin: 100px auto;
    padding: 0;
    border-radius: 8px;
    width: 500px;
    box-shadow: 0 5px 30px rgba(0, 0, 0, 0.3);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    background-color: #667eea;
    color: white;
    border-radius: 8px 8px 0 0;
}

.modal-header h3 {
    margin: 0;
}

.close-btn {
    color: white;
    font-size: 28px;
    cursor: pointer;
}

.close-btn:hover {
    opacity: 0.8;
}

.modal-body {
    padding: 25px;
}

.resource-info {
    background-color: #f8f9fa;
    padding: 15px;
    border-radius: 4px;
    margin-bottom: 20px;
}

.resource-info p {
    margin: 8px 0;
}

.form-group {
    margin-bottom: 15px;
}

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

.form-group select {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.user-search-input {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    box-sizing: border-box;
}

.user-list {
    max-height: 240px;
    overflow-y: auto;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    margin-top: 8px;
}

.user-list-item {
    padding: 10px 15px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    transition: background-color 0.15s;
}

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

.user-list-item:hover {
    background-color: #f0f7ff;
}

.user-list-item.selected {
    background-color: #e6f4ff;
    border-left: 3px solid #667eea;
}

.user-list-empty {
    padding: 20px;
    text-align: center;
    color: #999;
    font-size: 14px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 20px;
    background-color: #f8f9fa;
    border-radius: 0 0 8px 8px;
}

.btn-cancel,
.btn-confirm {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
}

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

.btn-cancel:hover {
    background-color: #5a6268;
}

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

.btn-confirm:hover {
    background-color: #218838;
}

/* 用户管理：操作按钮组 */
.action-group {
    display: flex;
    gap: 6px;
    flex-wrap: nowrap;
    align-items: center;
}

/* 重置密码按钮 */
.btn-reset {
    background-color: #f0ad4e;
    color: white;
}

.btn-reset:hover {
    background-color: #ec971f;
}

/* 封禁按钮 */
.btn-ban {
    background-color: #dc3545;
    color: white;
}

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

/* 解封按钮 */
.btn-unban {
    background-color: #17a2b8;
    color: white;
}

.btn-unban:hover {
    background-color: #138496;
}

/* 用户资源查看弹窗 */
.modal-content-lg {
    width: 700px;
    max-width: 90vw;
    max-height: 80vh;
    overflow-y: auto;
}

.resource-section {
    margin-bottom: 24px;
}

.section-title {
    font-size: 16px;
    color: #2c3e50;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 2px solid #eef2ff;
    display: flex;
    align-items: center;
    gap: 8px;
}

.count-badge {
    display: inline-block;
    min-width: 24px;
    height: 22px;
    line-height: 22px;
    padding: 0 8px;
    background-color: #667eea;
    color: white;
    border-radius: 11px;
    font-size: 12px;
    font-weight: 600;
    text-align: center;
}

.resource-list-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 12px;
}

.resource-item {
    background-color: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 12px;
    transition: all 0.2s;
}

.resource-item:hover {
    border-color: #667eea;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.15);
}

.resource-id {
    font-size: 14px;
    color: #2c3e50;
    margin-bottom: 8px;
    padding-bottom: 8px;
    border-bottom: 1px dashed #dee2e6;
}

.resource-id strong {
    color: #667eea;
    font-size: 16px;
}

.resource-info-row {
    font-size: 13px;
    color: #495057;
    line-height: 1.8;
}

.info-label {
    color: #6c757d;
    margin-right: 4px;
}

.loading-tip,
.empty-tip {
    grid-column: 1 / -1;
    text-align: center;
    color: #999;
    padding: 24px;
    font-size: 14px;
}

/* 未分配标记 */
.unassigned {
    color: #999;
}

.assigned {
    color: #28a745;
    font-weight: 600;
}

/* 资源详情弹窗样式 */
#resource-detail-modal .modal-content {
    position: relative; /* 确保关闭按钮相对于弹窗定位 */
    width: 700px;
    max-width: 90vw; /* 响应式宽度 */
    max-height: 80vh;
    margin: 50px auto;
    padding: 30px;
    overflow-y: auto;
}

#resource-detail-modal h3 {
    margin: 0 0 20px 0;
    color: #667eea;
    padding-bottom: 15px;
    border-bottom: 2px solid #eef2ff;
}

#resource-detail-modal .detail-section {
    margin-bottom: 25px;
}

#resource-detail-modal .detail-section h4 {
    color: #333;
    margin-bottom: 15px;
    padding-bottom: 8px;
    border-bottom: 1px solid #eee;
}

#resource-detail-modal .detail-table {
    width: 100%;
    border-collapse: collapse;
}

#resource-detail-modal .detail-table td {
    padding: 10px;
    border-bottom: 1px solid #f0f0f0;
}

#resource-detail-modal .detail-table td:first-child {
    width: 150px;
    font-weight: 600;
    color: #666;
    background-color: #f8f9fa;
}

#resource-detail-modal .json-display {
    background-color: #f8f9fa;
    padding: 15px;
    border-radius: 4px;
    overflow-x: auto;
    font-size: 12px;
    line-height: 1.6;
    border: 1px solid #e0e0e0;
    max-height: 400px;
    overflow-y: auto;
}

/* 监控数据网格布局 */
.monitor-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin: 15px 0;
}

.monitor-item {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    text-align: center;
}

.monitor-label {
    font-size: 12px;
    color: #666;
    margin-bottom: 8px;
}

.monitor-value {
    font-size: 24px;
    font-weight: bold;
    color: #333;
    margin-bottom: 10px;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: #e0e0e0;
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #28a745 0%, #ffc107 50%, #dc3545 100%);
    border-radius: 4px;
    transition: width 0.3s ease;
}

#resource-detail-modal .close {
    position: absolute;
    right: 15px;
    top: 15px;
    font-size: 32px;
    font-weight: bold;
    color: #999;
    cursor: pointer;
    z-index: 10;
    background: white;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

#resource-detail-modal .close:hover {
    color: #667eea;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

#resource-detail-modal .error {
    background-color: #f8d7da;
    padding: 15px;
    border-radius: 4px;
    border: 1px solid #f5c6cb;
}

#resource-detail-modal .error h4 {
    color: #721c24;
}

#resource-detail-modal .error-message {
    color: #721c24;
    margin: 0;
}

/* 标签页导航 */
.tab-navigation {
    display: flex;
    gap: 0;
    margin-bottom: 20px;
    background-color: white;
    border-radius: 8px;
    padding: 0;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.tab-btn {
    padding: 15px 30px;
    border: none;
    background: transparent;
    color: #666;
    font-size: 15px;
    cursor: pointer;
    transition: all 0.3s;
    border-bottom: 3px solid transparent;
    font-weight: 500;
}

.tab-btn:hover {
    color: #667eea;
    background-color: #f8f9fa;
}

.tab-btn.active {
    color: #667eea;
    border-bottom-color: #667eea;
    background-color: #f8f9fa;
}

/* 折扣管理部分 */
.discount-section {
    background-color: white;
    border-radius: 8px;
    padding: 25px;
    margin-bottom: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.discount-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
}

.discount-table th,
.discount-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.discount-table th {
    background-color: #f8f9fa;
    font-weight: 600;
    color: #666;
    font-size: 14px;
}

.discount-table tr:hover {
    background-color: #f8f9fa;
}

.action-bar {
    margin-bottom: 15px;
    display: flex;
    justify-content: flex-end;
}

.btn-primary {
    background-color: #667eea;
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.3s;
}

.btn-primary:hover {
    background-color: #5568d3;
}

.btn-edit {
    background-color: #17a2b8;
    color: white;
}

.btn-edit:hover {
    background-color: #138496;
}

/* 表单样式 */
.form-group input[type="number"],
.form-group input[type="text"],
.form-group input[type="datetime-local"],
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    font-family: inherit;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.1);
}

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

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

.header-left h1 {
    font-size: 24px;
    color: #333;
    margin-bottom: 5px;
}

.subtitle {
    color: #999;
    font-size: 14px;
}

/* 用户搜索下拉框 */
.user-search-container {
    position: relative;
}

#user-search-input {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    font-family: inherit;
}

#user-search-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.1);
}

.user-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #ddd;
    border-top: none;
    border-radius: 0 0 4px 4px;
    max-height: 200px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
}

.user-dropdown.show {
    display: block;
}

.user-option {
    padding: 10px 15px;
    cursor: pointer;
    border-bottom: 1px solid #eee;
    font-size: 14px;
}

.user-option:last-child {
    border-bottom: none;
}

.user-option:hover {
    background-color: #f8f9fa;
}

.user-option.selected {
    background-color: #eef2ff;
    color: #667eea;
}

.user-option .user-id {
    color: #999;
    font-size: 12px;
    margin-left: 8px;
}

.user-option .user-status {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 11px;
    margin-left: 8px;
}

.user-option .user-status.status-1 {
    background-color: #d4edda;
    color: #155724;
}

.user-option .user-status.status-0 {
    background-color: #f8d7da;
    color: #721c24;
}

/* 订单管理样式 */
.order-table {
    width: 100%;
    border-collapse: collapse;
    background-color: white;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    border-radius: 8px;
    overflow: hidden;
}

.order-table th,
.order-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.order-table th {
    background-color: #f8f9fa;
    font-weight: 600;
    color: #666;
    font-size: 14px;
}

.order-table tr:hover {
    background-color: #f8f9fa;
}

.error-cell {
    max-width: 300px;
    word-wrap: break-word;
    font-size: 12px;
}

.error-info {
    background-color: #f8d7da;
    padding: 8px;
    border-radius: 4px;
    border-left: 3px solid #dc3545;
}

.error-text {
    color: #721c24;
    font-weight: 600;
    margin-bottom: 4px;
}

.error-time {
    color: #999;
    font-size: 11px;
}

.search-form {
    background-color: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    margin-bottom: 20px;
}

.form-row {
    display: flex;
    gap: 20px;
    align-items: flex-end;
    flex-wrap: wrap;
}

.form-row .form-group {
    flex: 1;
    min-width: 200px;
}

.form-row .form-group label {
    display: block;
    margin-bottom: 8px;
    color: #666;
    font-size: 14px;
    font-weight: 500;
}

.form-row .form-group input,
.form-row .form-group select {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.form-row .form-group button {
    margin-right: 10px;
}

.btn-secondary {
    background-color: #6c757d;
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.3s;
}

.btn-secondary:hover {
    background-color: #5a6268;
}

.pagination {
    margin-top: 20px;
    text-align: center;
}

.pagination button {
    margin: 0 5px;
    padding: 8px 16px;
    border: 1px solid #ddd;
    background: white;
    border-radius: 4px;
    cursor: pointer;
}

.pagination button.active {
    background-color: #667eea;
    color: white;
    border-color: #667eea;
}