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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: #f5f7fa;
    color: #333;
    line-height: 1.6;
}

.container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 20px;
}

/* 头部样式 */
.header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 30px;
    border-radius: 12px;
    margin-bottom: 20px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.header h1 {
    font-size: 28px;
    margin-bottom: 20px;
}

.stats-bar {
    display: flex;
    gap: 30px;
    flex-wrap: wrap;
}

.stat-item {
    display: flex;
    flex-direction: column;
    background: rgba(255, 255, 255, 0.15);
    padding: 15px 25px;
    border-radius: 8px;
    backdrop-filter: blur(10px);
}

.stat-label {
    font-size: 14px;
    opacity: 0.9;
}

.stat-value {
    font-size: 32px;
    font-weight: bold;
    margin-top: 5px;
}

.stat-pending {
    color: #ffd700;
}

.stat-approved {
    color: #4ade80;
}

.stat-rejected {
    color: #f87171;
}

/* 过滤栏 */
.filter-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    gap: 15px;
    flex-wrap: wrap;
}

.filter-tabs {
    display: flex;
    gap: 10px;
}

.filter-btn {
    padding: 10px 20px;
    border: 2px solid #e2e8f0;
    background: white;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
}

.filter-btn:hover {
    border-color: #667eea;
    color: #667eea;
}

.filter-btn.active {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.search-box input {
    padding: 10px 15px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 14px;
    width: 300px;
    transition: border-color 0.2s;
}

.search-box input:focus {
    outline: none;
    border-color: #667eea;
}

.refresh-btn {
    padding: 10px 20px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: background 0.2s;
}

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

/* 表格样式 */
.license-table-container {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    overflow-x: auto;
}

.license-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 1200px;
}

.license-table thead {
    background: #f8fafc;
    border-bottom: 2px solid #e2e8f0;
}

.license-table th {
    padding: 15px 12px;
    text-align: left;
    font-weight: 600;
    color: #64748b;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.license-table td {
    padding: 12px;
    border-bottom: 1px solid #f1f5f9;
    font-size: 13px;
    vertical-align: middle;
}

.license-table tbody tr:hover {
    background: #f8fafc;
}

.loading-text {
    text-align: center;
    padding: 40px !important;
    color: #94a3b8;
}

/* 状态标签 */
.status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    white-space: nowrap;
}

.status-pending {
    background: #fef3c7;
    color: #92400e;
}

.status-approved {
    background: #d1fae5;
    color: #065f46;
}

.status-rejected {
    background: #fee2e2;
    color: #991b1b;
}

/* 操作按钮 */
.action-btn {
    padding: 6px 12px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    margin: 2px;
    transition: all 0.2s;
    white-space: nowrap;
}

.action-approve {
    background: #10b981;
    color: white;
}

.action-approve:hover {
    background: #059669;
}

.action-reject {
    background: #ef4444;
    color: white;
}

.action-reject:hover {
    background: #dc2626;
}

.action-view {
    background: #3b82f6;
    color: white;
}

.action-view:hover {
    background: #2563eb;
}

.action-detail {
    background: #8b5cf6;
    color: white;
}

.action-detail:hover {
    background: #7c3aed;
}

.action-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* 设备指纹显示 */
.fingerprint-cell {
    font-family: 'Courier New', monospace;
    font-size: 11px;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #64748b;
}

/* 主机名 */
.hostname-cell {
    font-weight: 600;
    color: #1e293b;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* CPU/环境 */
.cpu-env-cell {
    font-size: 12px;
    max-width: 150px;
}

.cpu-env-cell .cpu {
    display: block;
    color: #475569;
}

.cpu-env-cell .env {
    display: block;
    font-size: 11px;
    color: #94a3b8;
    margin-top: 2px;
}

/* 空状态 */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.empty-icon {
    font-size: 64px;
    margin-bottom: 20px;
}

.empty-state p {
    color: #94a3b8;
    font-size: 16px;
}

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

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 12px;
    width: 90%;
    max-width: 700px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}

.modal-large {
    max-width: 900px;
}

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

.modal-header h2 {
    font-size: 20px;
    color: #1e293b;
}

.modal-close {
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: #94a3b8;
    line-height: 1;
}

.modal-close:hover {
    color: #475569;
}

.modal-body {
    padding: 30px;
}

/* 详情网格 */
.detail-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin-bottom: 30px;
}

.detail-row {
    margin-bottom: 0;
}

.detail-row.full-width {
    grid-column: 1 / -1;
}

.detail-label {
    display: block;
    font-weight: 600;
    color: #64748b;
    margin-bottom: 8px;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.detail-value {
    font-family: 'Courier New', monospace;
    background: #f1f5f9;
    padding: 10px 15px;
    border-radius: 6px;
    word-break: break-all;
    font-size: 13px;
    display: block;
}

.detail-value.fingerprint {
    font-size: 11px;
    word-break: break-all;
}

/* 详情区块 */
.detail-section {
    margin-bottom: 25px;
}

.detail-section h3 {
    font-size: 16px;
    color: #1e293b;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #e2e8f0;
}

.info-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 10px;
}

.info-item {
    background: #f8fafc;
    padding: 12px 15px;
    border-radius: 8px;
    border-left: 3px solid #667eea;
}

.info-item .info-name {
    font-weight: 600;
    color: #475569;
    font-size: 13px;
    margin-bottom: 5px;
}

.info-item .info-value {
    font-family: 'Courier New', monospace;
    font-size: 12px;
    color: #64748b;
    word-break: break-all;
}

/* 许可证显示 */
.license-key-display {
    width: 100%;
    min-height: 150px;
    padding: 15px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-family: 'Courier New', monospace;
    font-size: 11px;
    resize: vertical;
    background: #f8fafc;
    line-height: 1.5;
}

.modal-actions {
    margin-top: 20px;
    display: flex;
    gap: 10px;
}

.copy-btn, .download-btn {
    padding: 12px 24px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: background 0.2s;
}

.copy-btn:hover, .download-btn:hover {
    background: #5568d3;
}

.download-btn {
    background: #10b981;
}

.download-btn:hover {
    background: #059669;
}

/* Toast 通知 */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 2000;
}

.toast {
    background: white;
    padding: 15px 25px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: slideIn 0.3s ease-out;
    min-width: 250px;
}

.toast-success {
    border-left: 4px solid #10b981;
}

.toast-error {
    border-left: 4px solid #ef4444;
}

.toast-info {
    border-left: 4px solid #3b82f6;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* 响应式设计 */
@media (max-width: 1024px) {
    .container {
        padding: 10px;
    }

    .header {
        padding: 20px;
    }

    .header h1 {
        font-size: 22px;
    }

    .stats-bar {
        gap: 15px;
    }

    .stat-item {
        padding: 10px 15px;
    }

    .stat-value {
        font-size: 24px;
    }

    .filter-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .filter-tabs {
        flex-wrap: wrap;
    }

    .search-box input {
        width: 100%;
    }

    .detail-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .license-table {
        font-size: 12px;
    }

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

    .modal-content, .modal-large {
        width: 95%;
        max-height: 90vh;
    }

    .modal-body {
        padding: 15px;
    }
}

/* 标签页样式 */
.tab-nav {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    padding: 15px 20px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.tab-btn {
    padding: 10px 20px;
    border: none;
    background: transparent;
    color: #666;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.3s;
}

.tab-btn:hover {
    background: #f0f0f0;
}

.tab-btn.active {
    background: #667eea;
    color: white;
}

.tab-content {
    display: none;
}

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

/* API Key 管理样式 */
.api-key-container {
    background: white;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

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

.api-key-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    margin-bottom: 15px;
}

.api-key-item.inactive {
    opacity: 0.6;
}

.api-key-info {
    flex: 1;
}

.api-key-name {
    font-size: 16px;
    font-weight: bold;
    color: #2c3e50;
    margin-bottom: 5px;
}

.api-key-meta {
    font-size: 12px;
    color: #7f8c8d;
    display: flex;
    gap: 15px;
}

.api-key-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* 系统设置样式 */
.settings-container {
    background: white;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    max-width: 600px;
}

.settings-container h2 {
    color: #2c3e50;
    margin-bottom: 20px;
}

.settings-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.settings-form .form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.settings-form label {
    font-weight: 500;
    color: #2c3e50;
}

.settings-form input {
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 14px;
}

.settings-form input:focus {
    outline: none;
    border-color: #667eea;
}

.form-hint {
    font-size: 12px;
    color: #7f8c8d;
}

/* Token 显示 */
.token-display {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 6px;
    margin: 15px 0;
    word-break: break-all;
}

.token-display code {
    font-family: monospace;
    font-size: 14px;
    color: #2c3e50;
}

.warning-text {
    color: #e74c3c;
    font-size: 14px;
    margin-bottom: 10px;
}

/* 按钮样式 */
.btn-primary {
    padding: 12px 24px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.3s;
}

.btn-primary:hover {
    background: #5a67d8;
}

.btn-secondary {
    padding: 12px 24px;
    background: #e0e0e0;
    color: #333;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.3s;
}

.btn-secondary:hover {
    background: #d0d0d0;
}

.btn-danger {
    padding: 12px 24px;
    background: #e74c3c;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.3s;
}

.btn-danger:hover {
    background: #c0392b;
}

.modal-actions-row {
    display: flex;
    gap: 10px;
    margin-top: 20px;
    justify-content: flex-end;
}

.modal-small {
    max-width: 400px;
}
