* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f5f7fa;
    color: #333;
    padding-bottom: 60px; /* 为移动端底部导航留空间 */
}

/* 页面控制 */
.page {
    display: none;
    min-height: calc(100vh - 60px); /* 减去底部导航高度 */
}

.page.active {
    display: block;
}

/* 登录页面 */
.login-container {
    max-width: 400px;
    margin: 100px auto;
    padding: 40px;
    background-color: white;
    border-radius: 10px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
}

.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.login-header h1 {
    color: #4a6fa5;
    margin-bottom: 10px;
    font-size: 24px;
}

.login-header p {
    color: #777;
}

.login-form .form-group {
    margin-bottom: 20px;
}

.login-form label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #555;
}

.login-form input {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 16px;
    transition: border-color 0.3s;
}

.login-form input:focus {
    border-color: #4a6fa5;
    outline: none;
}

.login-footer {
    margin-top: 20px;
    text-align: center;
    color: #888;
    font-size: 14px;
}

/* 按钮样式 */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
}

.btn-primary {
    background-color: #4a6fa5;
    color: white;
}

.btn-primary:hover {
    background-color: #3a5a85;
}

.btn-secondary {
    background-color: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background-color: #5a6268;
}

.btn-danger {
    background-color: #dc3545;
    color: white;
}

.btn-danger:hover {
    background-color: #c82333;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 14px;
    width: auto;
}

.btn-inline {
    width: auto;
    display: inline-flex;
}

.license-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding-top: 10px;
    border-top: 1px solid #eee;
    margin-top: 15px;
}

/* 管理员页面布局 */
#admin-page {
    display: flex;
    min-height: 100vh;
}

/* 侧边栏 */
.sidebar {
    width: 250px;
    background-color: #2c3e50;
    color: white;
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid #34495e;
}

.sidebar-header h2 {
    font-size: 20px;
    margin-bottom: 15px;
}

.admin-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sidebar-menu {
    list-style: none;
    padding: 20px 0;
    flex-grow: 1;
}

.sidebar-menu li {
    padding: 12px 20px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.sidebar-menu li:hover {
    background-color: #34495e;
}

.sidebar-menu li.active {
    background-color: #4a6fa5;
    border-left: 4px solid #3498db;
}

.sidebar-menu a {
    color: white;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* 主内容区 */
.main-content {
    flex-grow: 1;
    padding: 20px;
    overflow-y: auto;
}

.content-page {
    display: none;
}

.content-page.active {
    display: block;
}

/* 页面头部 */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

.page-header h1 {
    font-size: 24px;
    color: #2c3e50;
}

.page-header .actions {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.search-box {
    display: flex;
    gap: 5px;
}

.search-box input {
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 5px;
    min-width: 200px;
    font-size: 14px;
}

/* 统计页面 - 移动端优化 */
.stats-section {
    margin-bottom: 30px;
}

.stats-section h2 {
    font-size: 20px;
    margin-bottom: 15px;
    color: #2c3e50;
    padding-bottom: 10px;
    border-bottom: 2px solid #4a6fa5;
}

/* 应用统计卡片组 */
.app-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 15px;
    margin-bottom: 25px;
}

.app-stat-card {
    background-color: white;
    border-radius: 10px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.08);
    transition: transform 0.3s;
}

.app-stat-card:hover {
    transform: translateY(-3px);
}

.app-stat-icon {
    width: 50px;
    height: 50px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 20px;
}

.app-stat-info h3 {
    font-size: 24px;
    margin-bottom: 5px;
    color: #2c3e50;
}

.app-stat-info p {
    color: #7f8c8d;
    font-size: 14px;
}

/* 授权码统计卡片组 */
.license-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 15px;
}

.license-stat-card {
    background-color: white;
    border-radius: 10px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.08);
    transition: transform 0.3s;
}

.license-stat-card:hover {
    transform: translateY(-3px);
}

.license-stat-icon {
    width: 50px;
    height: 50px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 20px;
}

.license-stat-info h3 {
    font-size: 24px;
    margin-bottom: 5px;
    color: #2c3e50;
}

.license-stat-info p {
    color: #7f8c8d;
    font-size: 14px;
}

/* 最近活动 */
.recent-activities {
    background-color: white;
    border-radius: 10px;
    padding: 20px;
    margin-top: 25px;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.08);
}

.recent-activities h3 {
    font-size: 18px;
    margin-bottom: 15px;
    color: #2c3e50;
}

.activities-list {
    margin-top: 15px;
}

.activity-item {
    padding: 15px;
    border-bottom: 1px solid #eee;
    display: flex;
    align-items: flex-start;
    gap: 15px;
}

.activity-item:last-child {
    border-bottom: none;
}

.activity-icon {
    min-width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: #f8f9fa;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #4a6fa5;
    font-size: 16px;
}

.activity-info h4 {
    margin-bottom: 5px;
    font-size: 16px;
}

.activity-info p {
    color: #777;
    font-size: 14px;
    margin-bottom: 5px;
}

.activity-info small {
    color: #999;
    font-size: 12px;
}

/* 应用管理页面 - 移动端优化 */
.app-list {
    display: grid;
    grid-template-columns: 1fr;
    gap: 15px;
}

@media (min-width: 768px) {
    .app-list {
        grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    }
}

.app-card {
    background-color: white;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.08);
    transition: transform 0.3s;
}

.app-card:hover {
    transform: translateY(-3px);
}

.app-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 15px;
}

.app-name {
    font-size: 18px;
    font-weight: 600;
    color: #2c3e50;
}

.app-id {
    font-family: 'Courier New', monospace;
    background-color: #f8f9fa;
    padding: 3px 6px;
    border-radius: 3px;
    font-size: 12px;
    color: #666;
}

.app-description {
    color: #666;
    font-size: 14px;
    margin-bottom: 15px;
    line-height: 1.5;
}

.app-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    color: #999;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
}

.app-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* 开关样式 */
.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 24px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: #4a6fa5;
}

input:focus + .slider {
    box-shadow: 0 0 1px #4a6fa5;
}

input:checked + .slider:before {
    transform: translateX(26px);
}

.switch-label {
    font-size: 14px;
    color: #666;
    margin-left: 10px;
}

/* 授权码页面 - 移动端优化 */
.license-list {
    display: grid;
    grid-template-columns: 1fr;
    gap: 15px;
}

.license-card {
    background-color: white;
    border-radius: 10px;
    padding: 15px;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.08);
    transition: all 0.3s;
    cursor: pointer;
    border: 2px solid transparent;
}

.license-card:hover {
    transform: translateY(-3px);
    border-color: #4a6fa5;
}

.license-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.license-key {
    font-family: 'Courier New', monospace;
    font-size: 14px;
    font-weight: 600;
    color: #2c3e50;
    word-break: break-all;
}

.license-status {
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.license-status.used {
    background-color: #d1ecf1;
    color: #0c5460;
}

.license-status.unused {
    background-color: #d4edda;
    color: #155724;
}

.license-status.expired {
    background-color: #f8d7da;
    color: #721c24;
}

.license-status.expiring {
    background-color: #fff3cd;
    color: #856404;
}

.license-info {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-top: 10px;
}

.info-item {
    font-size: 13px;
}

.info-label {
    color: #999;
    font-weight: 500;
    margin-bottom: 3px;
}

.info-value {
    color: #333;
    font-weight: 500;
}

/* 授权码详情模态框 */
.license-detail-modal .modal-body {
    max-height: 70vh;
    overflow-y: auto;
}

.detail-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 15px;
}

@media (min-width: 768px) {
    .detail-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.detail-item {
    padding: 10px;
    background-color: #f8f9fa;
    border-radius: 5px;
}

.detail-label {
    font-size: 12px;
    color: #999;
    margin-bottom: 5px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.detail-value {
    font-size: 14px;
    color: #333;
    font-weight: 500;
    word-break: break-word;
}

.copy-license-btn {
    width: 100%;
    margin-top: 20px;
}

/* 日志页面 - 移动端优化 */
.log-list {
    display: grid;
    grid-template-columns: 1fr;
    gap: 15px;
}

.log-card {
    background-color: white;
    border-radius: 10px;
    padding: 15px;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.08);
}

.log-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 10px;
}

.log-action {
    font-size: 16px;
    font-weight: 600;
    color: #2c3e50;
}

.log-admin {
    font-size: 12px;
    color: #4a6fa5;
    background-color: #e8f4ff;
    padding: 2px 8px;
    border-radius: 10px;
}

.log-details {
    color: #666;
    font-size: 14px;
    margin-bottom: 10px;
    line-height: 1.4;
}

.log-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    color: #999;
}

.log-ip {
    font-family: 'Courier New', monospace;
}

/* 个人资料页面 - 移动端优化 */
.profile-card {
    background-color: white;
    border-radius: 10px;
    padding: 25px;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.08);
    max-width: 600px;
    margin: 0 auto;
}

.profile-header {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 25px;
}

.avatar {
    font-size: 50px;
    color: #4a6fa5;
}

.profile-info h2 {
    margin-bottom: 5px;
    font-size: 22px;
}

.profile-info p {
    color: #777;
    font-size: 14px;
}

.profile-stats {
    margin-bottom: 25px;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid #eee;
}

.filters {
    width: 100%;
    padding-bottom: 15px;
}
#license-filter {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    width: 100%;
    padding: 14px 18px;
    font-size: 15px;
    color: #2c3e50;
    background-color: #f8f9fa;
    border: 2px solid #eaeaea;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%237f8c8d' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 18px center;
    background-size: 18px;
    padding-right: 50px;
}
.stat-item:last-child {
    border-bottom: none;
}

.stat-label {
    color: #555;
    font-size: 14px;
}

.stat-value {
    font-weight: 600;
    color: #333;
    font-size: 14px;
}

.profile-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
}

.profile-actions .btn {
    width: auto;
    min-width: 140px;
}

.btn-success {
    background-color: #28a745;
    color: white;
}

.btn-success:hover {
    background-color: #218838;
}

.copy-btn {
    padding: 6px 12px;
    font-size: 12px;
}
/* 模态框 */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: none;
    z-index: 10000; /* 提高层级，确保在最上层 */
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal {
    position: fixed; /* 使用fixed定位 */
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%); /* 居中显示 */
    background-color: white;
    border-radius: 10px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    display: none;
    z-index: 10001; /* 比遮罩层更高 */
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
}

.modal.active {
    display: block;
}

.modal-header {
    padding: 20px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    background-color: white;
    z-index: 1;
}

.modal-header h3 {
    margin: 0;
    font-size: 18px;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #777;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    padding: 20px;
    border-top: 1px solid #eee;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    position: sticky;
    bottom: 0;
    background-color: white;
}

/* 表单组 */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #555;
    font-size: 14px;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 16px;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    border-color: #4a6fa5;
    outline: none;
}

.form-group textarea {
    resize: vertical;
    min-height: 100px;
}

/* 分页 */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin-top: 30px;
    flex-wrap: wrap;
}

.pagination-info {
    font-weight: 600;
    color: #666;
    font-size: 14px;
}

/* 移动端底部导航 */
.mobile-tabbar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: white;
    display: none;
    justify-content: space-around;
    padding: 10px 0;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    z-index: 100;
    border-top: 1px solid #eee;
}

.tab-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: #777;
    font-size: 12px;
    padding: 5px;
    flex: 1;
    transition: color 0.3s;
}

.tab-item.active {
    color: #4a6fa5;
}

.tab-item i {
    font-size: 20px;
    margin-bottom: 5px;
}

/* 加载动画 */
.loading {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 40px;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #4a6fa5;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 空状态提示 */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #999;
}

.empty-state i {
    font-size: 48px;
    margin-bottom: 15px;
    color: #ddd;
}

.empty-state h3 {
    margin-bottom: 10px;
    color: #666;
}

/* 响应式设计 */
@media (max-width: 992px) {
    .stats-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    }
    
    .search-box input {
        min-width: 150px;
    }
}

@media (max-width: 768px) {
    #admin-page {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        display: none;
    }
    
    .mobile-tabbar {
        display: flex;
    }
    
    .main-content {
        padding: 15px;
    }
    
    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .page-header h1 {
        font-size: 22px;
    }
    
    .page-header .actions {
        width: 100%;
        justify-content: space-between;
    }
    
    .search-box input {
        flex-grow: 1;
        min-width: 0;
    }
    
    .app-stat-card, .license-stat-card {
        padding: 15px;
    }
    
    .app-stat-icon, .license-stat-icon {
        width: 40px;
        height: 40px;
        font-size: 18px;
    }
    
    .app-stat-info h3, .license-stat-info h3 {
        font-size: 20px;
    }
    
    .modal {
        margin: 10px;
        max-height: 85vh;
    }
    
    .profile-actions {
        flex-direction: column;
    }
    
    .profile-actions .btn {
        width: 100%;
    }
}

@media (max-width: 576px) {
    .login-container {
        margin: 20px;
        padding: 25px;
    }
    
    .login-header h1 {
        font-size: 22px;
    }
    
    .main-content {
        padding: 12px;
    }
    
    .app-stats-grid, .license-stats-grid {
        grid-template-columns: 1fr;
    }
    
    .app-card, .license-card, .log-card {
        padding: 15px;
    }
    
    .modal-body {
        padding: 15px;
    }
    
    .modal-footer {
        padding: 15px;
        flex-direction: column;
    }
    
    .modal-footer .btn {
        width: 100%;
    }
    
    .btn {
        padding: 10px 15px;
        font-size: 14px;
    }
    
    .app-name {
        font-size: 16px;
    }
    
    .license-key {
        font-size: 13px;
    }
    
    .recent-activities {
        padding: 15px;
    }
    
    .activity-item {
        padding: 12px;
    }
}

/* 大屏幕优化 */
@media (min-width: 1200px) {
    .app-stats-grid, .license-stats-grid {
        grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    }
}

/* 平板优化 */
@media (min-width: 768px) and (max-width: 1199px) {
    .app-stats-grid, .license-stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}