/* 算力共享平台样式 */

/* 基础样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f5f5;
}

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

.btn {
    display: inline-block;
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    text-decoration: none;
    transition: background-color 0.3s;
}

.btn-primary {
    background-color: #007bff;
    color: white;
}

.btn-primary:hover {
    background-color: #0056b3;
}

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

.btn-secondary:hover {
    background-color: #545b62;
}

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

.btn-success:hover {
    background-color: #1e7e34;
}

.btn-danger {
    background-color: #dc3545;
    color: white;
}

.btn-danger:hover {
    background-color: #bd2130;
}

.text-center {
    text-align: center;
}

/* 页面切换 */
.page {
    display: none;
    min-height: 100vh;
}

.page.active {
    display: block;
}

/* 登录注册页面 */
.login-form, .register-form {
    max-width: 400px;
    margin: 50px auto;
    background: white;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 0 20px rgba(0,0,0,0.1);
}

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

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
}

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

.form-group input:focus, .form-group select:focus {
    outline: none;
    border-color: #007bff;
}

/* 头部 */
.header {
    background: #fff;
    border-bottom: 1px solid #e0e0e0;
    padding: 15px 0;
}

.header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 20px;
}

/* 导航 */
.nav {
    background: #f8f9fa;
    border-bottom: 1px solid #e0e0e0;
}

.nav ul {
    list-style: none;
    display: flex;
}

.nav li {
    margin-right: 30px;
}

.nav-link {
    text-decoration: none;
    color: #666;
    padding: 15px 0;
    display: block;
    border-bottom: 3px solid transparent;
    transition: all 0.3s;
}

.nav-link.active, .nav-link:hover {
    color: #007bff;
    border-bottom-color: #007bff;
}

/* 主内容 */
.main {
    padding: 30px 0;
    min-height: calc(100vh - 140px);
}

/* 控制台统计 */
.dashboard-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    text-align: center;
}

.stat-card h3 {
    margin-bottom: 10px;
    color: #666;
    font-size: 14px;
    text-transform: uppercase;
}

.stat-value {
    font-size: 32px;
    font-weight: bold;
    color: #007bff;
}

/* 任务和主机列表 */
.task-controls, .host-controls {
    margin-bottom: 20px;
    display: flex;
    gap: 10px;
}

.tasks-table, .hosts-table {
    width: 100%;
    background: white;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.tasks-table th, .tasks-table td,
.hosts-table th, .hosts-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #e0e0e0;
}

.tasks-table th, .hosts-table th {
    background: #f8f9fa;
    font-weight: bold;
}

.status-badge {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: bold;
}

.status-pending { background: #ffc107; color: #212529; }
.status-running { background: #007bff; color: white; }
.status-completed { background: #28a745; color: white; }
.status-failed { background: #dc3545; color: white; }
.status-online { background: #28a745; color: white; }
.status-offline { background: #6c757d; color: white; }
.status-busy { background: #ffc107; color: #212529; }

/* 模板卡片 */
.templates-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.template-card {
    background: white;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.template-header {
    padding: 20px;
    border-bottom: 1px solid #e0e0e0;
}

.template-body {
    padding: 20px;
}

.template-price {
    font-size: 24px;
    font-weight: bold;
    color: #007bff;
    margin-bottom: 10px;
}

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

/* 个人中心 */
.profile-info, .compute-logs {
    background: white;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.profile-info h3, .compute-logs h3 {
    margin-bottom: 20px;
    color: #333;
}

.profile-field {
    margin-bottom: 15px;
}

.profile-field label {
    display: inline-block;
    width: 100px;
    font-weight: bold;
}

.compute-log-item {
    padding: 10px 0;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.compute-log-item:last-child {
    border-bottom: none;
}

/* 模态框 */
.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 {
    background-color: white;
    margin: 10% auto;
    padding: 0;
    border-radius: 10px;
    width: 90%;
    max-width: 600px;
    position: relative;
}

.close {
    position: absolute;
    right: 20px;
    top: 15px;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    color: #aaa;
}

.close:hover {
    color: #000;
}

.modal-body {
    padding: 30px;
}

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

    .nav ul {
        flex-direction: column;
    }

    .nav li {
        margin-right: 0;
        margin-bottom: 10px;
    }

    .dashboard-stats {
        grid-template-columns: 1fr;
    }

    .user-info {
        flex-direction: column;
        gap: 10px;
    }

    .task-controls, .host-controls {
        flex-direction: column;
    }

    .template-actions {
        flex-direction: column;
    }
}

/* 加载动画 */
.loading {
    text-align: center;
    padding: 20px;
}

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

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

/* 消息提示 */
.alert {
    padding: 15px;
    margin-bottom: 20px;
    border: 1px solid transparent;
    border-radius: 5px;
}

.alert-success {
    color: #155724;
    background-color: #d4edda;
    border-color: #c3e6cb;
}

.alert-error {
    color: #721c24;
    background-color: #f8d7da;
    border-color: #f5c6cb;
}

.alert-info {
    color: #0c5460;
    background-color: #d1ecf1;
    border-color: #bee5eb;
}