* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --success-gradient: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    --danger-gradient: linear-gradient(135deg, #eb3349 0%, #f45c43 100%);
    --warning-gradient: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f5576c 100%);
    background-size: 400% 400%;
    animation: gradientBG 15s ease infinite;
    min-height: 100vh;
    padding: 20px;
}

@keyframes gradientBG {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.container {
    max-width: 1200px;
}

/* 导航栏 */
.navbar-brand {
    font-weight: bold;
    font-size: 1.5rem;
}

.navbar-text {
    font-size: 0.9rem;
    opacity: 0.8;
}

.bg-gradient {
    background: var(--primary-gradient) !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

/* 状态卡片 */
.status-card {
    background: white;
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    padding: 30px;
    margin-bottom: 30px;
    display: flex;
    align-items: center;
    gap: 30px;
}

.status-icon {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: var(--success-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 20px rgba(56, 239, 125, 0.4);
}

.status-icon i {
    font-size: 2.5rem;
    color: white;
}

.status-icon.running i {
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.1); opacity: 0.8; }
}

.status-info {
    flex: 1;
}

.status-info h5 {
    color: #666;
    margin-bottom: 5px;
    font-weight: 500;
}

#status-text {
    font-size: 1.5rem;
    font-weight: bold;
    color: #333;
    margin-bottom: 15px;
}

.stats {
    display: flex;
    gap: 40px;
}

.stat-item {
    text-align: center;
}

.stat-label {
    display: block;
    color: #999;
    font-size: 0.85rem;
    margin-bottom: 5px;
}

.stat-value {
    font-size: 1.8rem;
    font-weight: bold;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* 标签页 */
.custom-tabs {
    background: white;
    border-radius: 15px 15px 0 0;
    padding: 10px 20px 0;
    margin-bottom: 0;
    box-shadow: 0 -5px 20px rgba(0, 0, 0, 0.1);
}

.nav-tabs .nav-link {
    border: none;
    color: #666;
    font-weight: 500;
    padding: 15px 25px;
    border-radius: 10px 10px 0 0;
    margin-right: 5px;
    transition: all 0.3s;
}

.nav-tabs .nav-link:hover {
    background: #f8f9fa;
    color: #667eea;
}

.nav-tabs .nav-link.active {
    background: white;
    color: #667eea;
    font-weight: 600;
    box-shadow: 0 -5px 15px rgba(102, 126, 234, 0.2);
}

.nav-tabs .nav-link i {
    margin-right: 8px;
}

/* 标签内容 */
.tab-content {
    background: white;
    border-radius: 0 0 15px 15px;
    padding: 30px;
    box-shadow: 0 5px 30px rgba(0, 0, 0, 0.15);
    min-height: 500px;
}

/* 卡片 */
.card {
    border: none;
    border-radius: 15px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.08);
    margin-bottom: 25px;
    transition: transform 0.3s, box-shadow 0.3s;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
}

.card-header {
    background: white;
    border-bottom: 2px solid #f8f9fa;
    padding: 20px;
    border-radius: 15px 15px 0 0;
}

.card-header h5 {
    margin: 0;
    color: #333;
    font-weight: 600;
}

.card-header i {
    margin-right: 8px;
    color: #667eea;
}

.card-body {
    padding: 25px;
}

/* 表单 */
.form-label {
    font-weight: 500;
    color: #555;
    margin-bottom: 8px;
}

.form-control {
    border: 2px solid #e9ecef;
    border-radius: 10px;
    padding: 12px 15px;
    font-size: 0.95rem;
    transition: all 0.3s;
}

.form-control:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-check {
    padding: 10px 0;
}

.form-check-input:checked {
    background-color: #667eea;
    border-color: #667eea;
}

/* 按钮 */
.btn {
    border-radius: 10px;
    padding: 12px 25px;
    font-weight: 600;
    transition: all 0.3s;
    border: none;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.btn-primary {
    background: var(--primary-gradient);
}

.btn-success {
    background: var(--success-gradient);
}

.btn-danger {
    background: var(--danger-gradient);
}

.btn-lg {
    padding: 15px 30px;
    font-size: 1.1rem;
}

.btn i {
    margin-right: 8px;
}

/* 群组列表 */
.group-list-container {
    max-height: 400px;
    overflow-y: auto;
    margin-bottom: 20px;
}

.list-group-item {
    border: none;
    padding: 15px;
    margin-bottom: 10px;
    border-radius: 10px;
    background: #f8f9fa;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s;
}

.list-group-item:hover {
    background: #e9ecef;
    transform: translateX(5px);
}

.list-group-item .group-link {
    font-weight: 500;
    color: #333;
    word-break: break-all;
}

.list-group-item .group-actions {
    display: flex;
    gap: 10px;
}

/* 日志容器 */
.log-container {
    background: #1e1e1e;
    border-radius: 15px;
    padding: 20px;
    max-height: 500px;
    overflow-y: auto;
    font-family: 'Courier New', monospace;
}

.log-container::-webkit-scrollbar {
    width: 8px;
}

.log-container::-webkit-scrollbar-track {
    background: #2d2d2d;
    border-radius: 4px;
}

.log-container::-webkit-scrollbar-thumb {
    background: #555;
    border-radius: 4px;
}

#log-output {
    color: #00ff00;
    line-height: 1.8;
    margin: 0;
}

.log-time {
    color: #888;
    margin-right: 10px;
}

.log-info {
    color: #00bfff;
}

.log-success {
    color: #00ff00;
}

.log-error {
    color: #ff4444;
}

.log-warning {
    color: #ffaa00;
}

.log-rest {
    color: #f093fb;
    font-weight: bold;
}

/* 徽章 */
.badge {
    padding: 8px 15px;
    font-size: 0.9rem;
    font-weight: 600;
}

/* 卡密列表容器 */
.key-list-container {
    max-height: 400px;
    overflow-y: auto;
    margin-bottom: 20px;
}

/* 模态框 */
.modal-content {
    border-radius: 20px;
    border: none;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.modal-header {
    border-bottom: 2px solid #f8f9fa;
    padding: 20px 25px;
    background: white;
    border-radius: 20px 20px 0 0;
}

.modal-body {
    padding: 25px;
}

.modal-footer {
    border-top: 2px solid #f8f9fa;
    padding: 20px 25px;
    background: white;
    border-radius: 0 0 20px 20px;
}

/* 授权提示 */
#auth-alert {
    border-radius: 15px;
    margin-bottom: 20px;
    border: none;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
}

/* 响应式 */
@media (max-width: 992px) {
    .container {
        padding: 0 15px;
    }
    
    body {
        padding: 15px;
    }
}

@media (max-width: 768px) {
    .status-card {
        flex-direction: column;
        text-align: center;
        padding: 20px;
    }
    
    .stats {
        flex-wrap: wrap;
        justify-content: center;
        gap: 20px;
    }
    
    .stat-item {
        flex: 1 1 auto;
        min-width: 80px;
    }
    
    .status-icon {
        width: 60px;
        height: 60px;
        margin-bottom: 15px;
    }
    
    .status-icon i {
        font-size: 2rem;
    }
    
    #status-text {
        font-size: 1.2rem;
        margin-bottom: 10px;
    }
    
    .stat-value {
        font-size: 1.5rem;
    }
    
    /* 标签页优化 */
    .nav-tabs .nav-link {
        padding: 12px 15px;
        font-size: 0.9rem;
    }
    
    .nav-tabs .nav-link i {
        margin-right: 5px;
    }
    
    /* 卡片优化 */
    .card {
        margin-bottom: 20px;
    }
    
    .card-body {
        padding: 20px;
    }
    
    /* 按钮优化 */
    .btn {
        padding: 10px 20px;
        font-size: 0.95rem;
    }
    
    .btn-lg {
        padding: 12px 20px;
        font-size: 1rem;
    }
    
    /* 表单优化 */
    .form-control {
        padding: 10px 12px;
        font-size: 0.9rem;
    }
    
    /* 日志优化 */
    .log-container {
        max-height: 350px;
        padding: 15px;
        font-size: 0.85rem;
    }
    
    #log-output {
        font-size: 0.85rem;
        line-height: 1.6;
    }
    
    /* 表格优化 */
    .table {
        font-size: 0.85rem;
    }
    
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    /* 群组列表优化 */
    .group-list-container {
        max-height: 300px;
    }
    
    .list-group-item {
        padding: 12px;
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .list-group-item .group-actions {
        width: 100%;
        justify-content: flex-end;
    }
    
    /* 状态卡片在移动端 */
    .status-info {
        width: 100%;
    }
    
    /* 标签内容在移动端 */
    .tab-content {
        padding: 20px 15px;
        min-height: auto;
    }
    
    /* 卡片头部在移动端 */
    .card-header {
        padding: 15px;
    }
    
    .card-header h5 {
        font-size: 1rem;
    }
}

@media (max-width: 576px) {
    body {
        padding: 10px;
    }
    
    .container {
        padding: 0 10px;
    }
    
    .navbar-brand {
        font-size: 1.2rem;
    }
    
    .navbar-text {
        font-size: 0.8rem;
    }
    
    .status-card {
        padding: 15px;
    }
    
    .stats {
        gap: 15px;
    }
    
    .stat-item {
        flex: 1 1 45%;
        min-width: 70px;
    }
    
    .stat-value {
        font-size: 1.2rem;
    }
    
    /* 导航栏按钮 */
    .nav-tabs .nav-link {
        padding: 10px 12px;
        font-size: 0.85rem;
    }
    
    /* 按钮在移动端 */
    .btn {
        padding: 8px 15px;
        font-size: 0.9rem;
    }
    
    .btn-lg {
        padding: 10px 15px;
        font-size: 0.95rem;
    }
    
    /* 表单在移动端 */
    .form-control {
        padding: 8px 10px;
        font-size: 0.85rem;
    }
    
    .form-label {
        font-size: 0.9rem;
    }
    
    /* 卡片在移动端 */
    .card-body {
        padding: 15px;
    }
    
    /* 日志在移动端 */
    .log-container {
        max-height: 300px;
        padding: 12px;
    }
    
    #log-output {
        font-size: 0.75rem;
        line-height: 1.5;
    }
    
    /* 表格在移动端 */
    .table {
        font-size: 0.75rem;
    }
    
    .table td,
    .table th {
        padding: 8px 5px;
    }
    
    /* 群组列表在移动端 */
    .group-list-container {
        max-height: 250px;
    }
    
    .list-group-item {
        padding: 10px;
    }
    
    /* 模态框在移动端 */
    .modal-content {
        margin: 15px;
    }
    
    .modal-body {
        padding: 20px 15px;
    }
    
    /* 徽章在移动端 */
    .badge {
        padding: 5px 10px;
        font-size: 0.8rem;
    }
}

/* 横屏手机优化 */
@media (max-height: 600px) and (orientation: landscape) {
    .status-card {
        flex-direction: row;
        padding: 15px;
    }
    
    .log-container {
        max-height: 250px;
    }
    
    .tab-content {
        min-height: auto;
    }
}

/* 动画 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.tab-content .card {
    animation: fadeIn 0.5s ease-out;
}

/* Toast */
.toast {
    background: white;
    border-radius: 15px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
}

.toast-header {
    background: var(--primary-gradient);
    color: white;
    border: none;
    border-radius: 15px 15px 0 0;
}

/* 触摸优化 */
@media (hover: none) {
    .btn:hover {
        transform: none;
    }
    
    .card:hover {
        transform: none;
    }
    
    .list-group-item:hover {
        background: #f8f9fa;
        transform: none;
    }
}

/* 安全区域适配 */
@supports (padding: env(safe-area-inset-bottom)) {
    body {
        padding-bottom: env(safe-area-inset-bottom);
    }
}
