/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

/* 布局容器 */
.layout {
    display: flex;
    min-height: 100vh;
    max-width: 100vw;
    overflow-x: hidden;
}

/* 左侧导航栏 */
.sidebar {
    width: 260px;
    background: rgba(45, 55, 72, 0.95);
    backdrop-filter: blur(10px);
    color: white;
    display: flex;
    flex-direction: column;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
    z-index: 100;
}

.sidebar-header {
    padding: 25px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-header h2 {
    font-size: 1.3rem;
    font-weight: 600;
    color: white;
}

.sidebar-header h2 i {
    color: #667eea;
    margin-right: 10px;
}

.sidebar-nav {
    flex: 1;
    padding: 20px 0;
}

.sidebar-nav ul {
    list-style: none;
}

.sidebar-nav li {
    margin-bottom: 5px;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 15px 20px;
    color: #cbd5e0;
    text-decoration: none;
    transition: all 0.3s ease;
    border-left: 3px solid transparent;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border-left-color: #667eea;
}

.nav-item.active {
    background: rgba(102, 126, 234, 0.2);
    color: white;
    border-left-color: #667eea;
}

.nav-item i {
    font-size: 1.1rem;
    margin-right: 12px;
    width: 20px;
}

.sidebar-footer {
    padding: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 0.9rem;
    color: #a0aec0;
    text-align: center;
}

/* 主内容区域 */
.main-content {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    max-height: 100vh;
}

/* 页面内容 */
.page-content {
    display: none;
}

.page-content.active {
    display: block;
}

/* 页面头部 */
.page-header {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 20px 25px;
    margin-bottom: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.page-header h1 {
    color: #4a5568;
    font-size: 1.8rem;
    font-weight: 600;
    margin: 0;
}

.page-header h1 i {
    color: #667eea;
    margin-right: 10px;
}

.header-actions {
    display: flex;
    gap: 10px;
}

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

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.btn-primary {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
}

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

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

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

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

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

/* 统计面板 */
.stats-panel {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.stat-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 25px;
    display: flex;
    align-items: center;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-5px);
}

.stat-icon {
    font-size: 2.5rem;
    margin-right: 20px;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
}

.stat-content h3 {
    font-size: 2rem;
    font-weight: 700;
    color: #2d3748;
    margin-bottom: 5px;
}

.stat-content p {
    color: #718096;
    font-size: 0.9rem;
}

/* 工具栏 */
.toolbar {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.search-box {
    position: relative;
    flex: 1;
    max-width: 400px;
}

.search-box i {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #a0aec0;
}

.search-box input {
    width: 100%;
    padding: 12px 45px;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    font-size: 14px;
    transition: all 0.3s ease;
}

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

.filter-group {
    display: flex;
    gap: 15px;
}

.filter-group select {
    padding: 10px 15px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    background: white;
    cursor: pointer;
    transition: all 0.3s ease;
}

.filter-group select:focus {
    outline: none;
    border-color: #667eea;
}

/* 数据区域 */
.data-section {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 2px solid #e2e8f0;
}

.section-header h2 {
    color: #2d3748;
    font-size: 1.5rem;
    font-weight: 600;
}

.section-header h2 i {
    color: #667eea;
    margin-right: 10px;
}

.batch-actions {
    display: flex;
    gap: 10px;
}

/* 表格样式 */
.table-container {
    overflow-x: auto;
    margin-bottom: 20px;
}

/* 数据表格 */
.data-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    table-layout: fixed; /* 固定表格布局，防止列宽变化 */
}

.data-table th,
.data-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #e1e5e9;
    word-wrap: break-word; /* 长文本自动换行 */
    overflow: hidden; /* 超出内容隐藏 */
}

/* 优化列宽分布 - 根据用户需求调整 */
.data-table th:nth-child(1),
.data-table td:nth-child(1) {
    width: 6%; /* 复选框列 - 较小 */
}

.data-table th:nth-child(2),
.data-table td:nth-child(2) {
    width: 20%; /* 解锁码列 - 重要信息 */
}

.data-table th:nth-child(3),
.data-table td:nth-child(3) {
    width: 10%; /* 状态列 */
}

.data-table th:nth-child(4),
.data-table td:nth-child(4) {
    width: 8%; /* 天数列 - 较小 */
}

.data-table th:nth-child(5),
.data-table td:nth-child(5) {
    width: 15%; /* 设备ID列 */
}

.data-table th:nth-child(6),
.data-table td:nth-child(6) {
    width: 12%; /* 解锁时间列 - 窄一些 */
}

.data-table th:nth-child(7),
.data-table td:nth-child(7) {
    width: 17%; /* 结束时间列 - 加宽 */
}

.data-table th:nth-child(8),
.data-table td:nth-child(8) {
    width: 17%; /* 创建时间列 - 加宽 */
}

.data-table th:nth-child(9),
.data-table td:nth-child(9) {
    width: 13%; /* 操作列 - 窄一些 */
}

/* 激活列表表格列宽定义 - 11列 */
#activations-table th:nth-child(1),
#activations-table td:nth-child(1) {
    width: 5%; /* 复选框列 */
}

#activations-table th:nth-child(2),
#activations-table td:nth-child(2) {
    width: 12%; /* 设备ID列 */
}

#activations-table th:nth-child(3),
#activations-table td:nth-child(3) {
    width: 8%; /* 状态列 */
}

#activations-table th:nth-child(4),
#activations-table td:nth-child(4) {
    width: 8%; /* 激活次数列 */
}

#activations-table th:nth-child(5),
#activations-table td:nth-child(5) {
    width: 8%; /* 剩余月数列 */
}

#activations-table th:nth-child(6),
#activations-table td:nth-child(6) {
    width: 8%; /* 剩余天数列 */
}

#activations-table th:nth-child(7),
#activations-table td:nth-child(7) {
    width: 14%; /* 激活时间列 */
}

#activations-table th:nth-child(8),
#activations-table td:nth-child(8) {
    width: 14%; /* 结束时间列 */
}

#activations-table th:nth-child(9),
#activations-table td:nth-child(9) {
    width: 13%; /* 使用激活码列 */
}

#activations-table th:nth-child(10),
#activations-table td:nth-child(10) {
    width: 10%; /* 已作废码列 */
}

#activations-table th:nth-child(11),
#activations-table td:nth-child(11) {
    width: 10%; /* 操作列 */
}

.data-table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #333;
    font-size: 14px;
    user-select: none;
}

/* 可排序表头样式 */
.data-table th.sortable {
    cursor: pointer;
    transition: background-color 0.2s;
    position: relative;
}

.data-table th.sortable:hover {
    background: #e9ecef;
}

.data-table th.sortable i {
    margin-left: 5px;
    color: #999;
    font-size: 12px;
}

.data-table th.sortable.asc i:before {
    content: "\f0de"; /* fa-sort-up */
    color: #007bff;
}

.data-table th.sortable.desc i:before {
    content: "\f0dd"; /* fa-sort-down */
    color: #007bff;
}

.data-table td {
    font-size: 14px;
    color: #555;
}

.data-table tbody tr:hover {
    background-color: #f7fafc;
}

.data-table tbody tr:nth-child(even) {
    background-color: #f8f9fa;
}

/* 状态标签 */
.status-badge {
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    color: white;
    text-align: center;
    display: inline-block;
    min-width: 60px;
}

/* 未使用状态 - 绿色 */
.status-unused {
    background: linear-gradient(135deg, #10b981, #059669);
}

/* 已使用状态 - 橙色 */
.status-used {
    background: linear-gradient(135deg, #f59e0b, #d97706);
}

/* 已作废状态 - 红色 */
.status-revoked {
    background: linear-gradient(135deg, #ef4444, #dc2626);
}

/* 保持旧的样式以向后兼容 */
.status-active {
    background: linear-gradient(135deg, #10b981, #059669);
}

.status-invalid {
    background: linear-gradient(135deg, #ef4444, #dc2626);
}

.status-expiring {
    background: linear-gradient(135deg, #f59e0b, #d97706);
}

.status-expired {
    background: linear-gradient(135deg, #ef4444, #dc2626);
}

/* 通用徽章样式 */
.badge {
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
    color: white;
    text-align: center;
    display: inline-block;
    min-width: 40px;
}

.badge-info {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
}

.badge-success {
    background: linear-gradient(135deg, #10b981, #059669);
}

.badge-warning {
    background: linear-gradient(135deg, #f59e0b, #d97706);
}

.badge-danger {
    background: linear-gradient(135deg, #ef4444, #dc2626);
}

.badge-secondary {
    background: linear-gradient(135deg, #6b7280, #4b5563);
}

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

.action-btn:hover {
    transform: scale(1.05);
}

.action-edit {
    background-color: #007bff;
    color: white;
}

.action-delete {
    background-color: #dc3545;
    color: white;
}

.action-extend {
    background-color: #28a745;
    color: white;
}

/* 分页 */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin-top: 20px;
}

#pageInfo, #activationPageInfo {
    font-weight: 500;
    color: #4a5568;
}

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

.modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 0;
    border-radius: 15px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    padding: 20px 25px;
    border-radius: 15px 15px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.3rem;
    font-weight: 600;
}

.close {
    color: white;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
}

.close:hover {
    transform: scale(1.1);
}

.modal-body {
    padding: 25px;
}

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #4a5568;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.3s ease;
}

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

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 25px;
    padding-top: 20px;
    border-top: 1px solid #e2e8f0;
}

.selected-list {
    max-height: 150px;
    overflow-y: auto;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 10px;
    background: #f8f9fa;
}

.selected-item {
    padding: 5px 10px;
    background: #e9ecef;
    border-radius: 4px;
    margin-bottom: 5px;
    font-size: 0.9rem;
}

/* 加载和消息提示 */
.loading {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(3px);
}

.loading div {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: white;
}

.spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

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

.message-box {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1500;
    max-width: 400px;
    padding: 15px 20px;
    border-radius: 10px;
    color: white;
    font-weight: 500;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    transform: translateX(450px);
    transition: all 0.3s ease;
}

.message-box.show {
    transform: translateX(0);
}

.message-box.success {
    background: linear-gradient(135deg, #48bb78, #38a169);
}

.message-box.error {
    background: linear-gradient(135deg, #f56565, #e53e3e);
}

.message-box.warning {
    background: linear-gradient(135deg, #ed8936, #dd6b20);
}

.message-box.info {
    background: linear-gradient(135deg, #4299e1, #3182ce);
}

/* 响应式设计 */
@media (max-width: 768px) {
    .layout {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        height: auto;
    }
    
    .sidebar-nav ul {
        display: flex;
        overflow-x: auto;
    }
    
    .sidebar-nav li {
        margin-bottom: 0;
        margin-right: 5px;
        white-space: nowrap;
    }
    
    .main-content {
        padding: 10px;
    }
    
    .page-header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .toolbar {
        flex-direction: column;
        gap: 15px;
    }
    
    .search-box {
        max-width: none;
    }
    
    .stats-panel {
        grid-template-columns: 1fr;
    }
    
    .section-header {
        flex-direction: column;
        gap: 15px;
        align-items: stretch;
    }
    
    .data-table {
        font-size: 12px;
    }
    
    .data-table th,
    .data-table td {
        padding: 8px 6px;
    }
    
    .modal-content {
        width: 95%;
        margin: 10% auto;
    }
} 

/* 单选按钮组样式 */
.radio-group {
    display: flex;
    gap: 20px;
    margin-top: 8px;
}

.radio-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-weight: normal;
    margin-bottom: 0;
}

.radio-label input[type="radio"] {
    margin-right: 8px;
    width: auto;
}

.radio-label span {
    user-select: none;
}

/* 天数输入组样式 */
.days-input-group {
    display: flex;
    align-items: center;
    gap: 5px;
}

.days-input-group input {
    flex: 1;
    min-width: 0;
}

.input-unit {
    color: #666;
    font-size: 14px;
    white-space: nowrap;
}

/* 快捷天数按钮组 */
.quick-days {
    display: flex;
    gap: 8px;
    margin-top: 10px;
    flex-wrap: wrap;
}

.btn-outline {
    background: transparent;
    border: 1px solid #ddd;
    color: #666;
    padding: 4px 12px;
    font-size: 12px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-outline:hover {
    background: #f8f9fa;
    border-color: #007bff;
    color: #007bff;
}

.btn-outline:active {
    background: #e9ecef;
}

/* 表单组间距调整 */
.form-group {
    margin-bottom: 20px;
}

.form-group:last-child {
    margin-bottom: 0;
}

/* 操作按钮样式 */
.action-btn {
    padding: 4px 8px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s ease;
    margin: 0 2px;
}

.action-btn.action-delete {
    background-color: #e74c3c;
    color: white;
}

.action-btn.action-delete:hover {
    background-color: #c0392b;
    transform: translateY(-1px);
}

.action-btn i {
    margin-right: 4px;
}

/* 确保操作列宽度固定 */
.data-table th:last-child,
.data-table td:last-child {
    width: 80px;
    text-align: center;
    white-space: nowrap;
} 