/* style.css - 样式文件 */
:root {
    --primary-color: #3498db;
    --secondary-color: #2c3e50;
    --success-color: #2ecc71;
    --danger-color: #e74c3c;
    --warning-color: #f39c12;
    --light-color: #f8f9fa;
    --dark-color: #343a40;
    --gray-color: #95a5a6;
    --border-color: #e0e0e0;
    --shadow-color: rgba(0, 0, 0, 0.1);
    --ec2-color: #ff9900;
    --lightsail-color: #42b4e6;
    --region-japan: #9b59b6;
    --region-hongkong: #3498db;
    --region-singapore: #2ecc71;
    --region-other: #95a5a6;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

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

/* 登录页面样式 */
.login-body {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #1a2a6c, #3498db);
    padding: 20px;
}

.login-container {
    background-color: white;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    width: 100%;
    max-width: 400px;
    overflow: hidden;
}

.login-header {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    text-align: center;
    padding: 30px 20px;
}

.login-header h1 {
    font-size: 24px;
    margin-bottom: 8px;
    font-weight: 600;
}

.login-header p {
    font-size: 14px;
    opacity: 0.9;
}

.login-form {
    padding: 25px;
}

.input-group {
    position: relative;
    margin-bottom: 20px;
}

.input-icon {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    fill: var(--gray-color);
}

.login-input {
    width: 100%;
    padding: 12px 15px 12px 45px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 16px;
    transition: all 0.3s;
}

.login-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.error-message {
    color: var(--danger-color);
    font-size: 14px;
    margin-bottom: 15px;
    text-align: center;
}

.login-button {
    width: 100%;
    padding: 14px;
    background: linear-gradient(to right, var(--primary-color), #2980b9);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.login-button:hover {
    background: linear-gradient(to right, #2980b9, var(--primary-color));
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.login-footer {
    text-align: center;
    padding: 15px;
    font-size: 12px;
    color: var(--gray-color);
    border-top: 1px solid var(--border-color);
}

/* 主面板样式 */
.dashboard-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
}

.header-left h1 {
    font-size: 28px;
    color: var(--secondary-color);
    margin-bottom: 5px;
}

.subtitle {
    color: var(--gray-color);
    font-size: 14px;
}

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

.btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s ease;
    font-size: 14px;
}

.btn-icon {
    width: 18px;
    height: 18px;
}

.btn-primary {
    background: linear-gradient(to right, var(--primary-color), #2980b9);
    color: white;
}

.btn-primary:hover {
    background: linear-gradient(to right, #2980b9, var(--primary-color));
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.btn-secondary {
    background-color: #ecf0f1;
    color: var(--secondary-color);
}

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

.btn-logout {
    background: linear-gradient(to right, #e74c3c, #c0392b);
    color: white;
    text-decoration: none;
}

.btn-logout:hover {
    background: linear-gradient(to right, #c0392b, #e74c3c);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.btn-icon {
    background: transparent;
    border: none;
    padding: 8px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-icon:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

/* 新增配置面板 */
.new-config-panel {
    background-color: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
    margin-bottom: 30px;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background-color: #f8f9fa;
    border-bottom: 1px solid var(--border-color);
}

.panel-header h3 {
    font-size: 18px;
    color: var(--secondary-color);
    margin: 0;
}

.panel-content {
    padding: 20px;
}

.config-form .form-row {
    display: flex;
    gap: 20px;
    margin-bottom: 15px;
}

.config-form .form-group {
    flex: 1;
}

.config-form label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--secondary-color);
    font-size: 14px;
}

.config-form input,
.config-form select {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 14px;
    transition: all 0.3s;
}

.custom-select {
    position: relative;
}

.custom-select::after {
    content: "";
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    border: 6px solid transparent;
    border-top-color: var(--gray-color);
    pointer-events: none;
}

.config-form input:focus,
.config-form select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

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

/* 统计卡片 */
.stats-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background-color: white;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.05);
    transition: all 0.3s;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.stat-value {
    font-size: 36px;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 5px;
}

.stat-label {
    color: var(--gray-color);
    font-size: 14px;
}

/* 实例部分 */
.instance-section {
    margin-bottom: 40px;
}

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

.section-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 20px;
    color: var(--secondary-color);
    padding-bottom: 10px;
    border-bottom: 2px solid var(--primary-color);
}

.section-icon {
    width: 24px;
    height: 24px;
    fill: var(--primary-color);
}

.section-actions {
    display: flex;
    gap: 15px;
}

.search-box {
    position: relative;
}

.search-box input {
    padding: 10px 15px 10px 35px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 14px;
    width: 200px;
}

.search-icon {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    fill: var(--gray-color);
}

/* 配置网格 */
.config-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 20px;
}

.config-card {
    background-color: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.05);
    transition: all 0.3s;
    display: flex;
    flex-direction: column;
}

.config-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background-color: #f8f9fa;
    border-bottom: 1px solid var(--border-color);
}

.card-header h3 {
    margin: 0;
    font-size: 16px;
    color: var(--secondary-color);
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 70%;
}

.instance-type-badge {
    font-size: 10px;
    padding: 4px 8px;
    border-radius: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.ec2-badge {
    background-color: rgba(255, 153, 0, 0.1);
    color: var(--ec2-color);
}

.lightsail-badge {
    background-color: rgba(66, 180, 230, 0.1);
    color: var(--lightsail-color);
}

.card-body {
    padding: 15px;
    flex: 1;
}

.config-item {
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid #f0f0f0;
}

.config-item:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.config-item label {
    font-size: 12px;
    font-weight: 600;
    color: var(--gray-color);
    display: block;
    margin-bottom: 5px;
}

.config-item span {
    font-size: 14px;
    word-break: break-all;
}

.sensitive-data {
    color: var(--secondary-color);
    font-weight: 500;
}

.region-badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
}

.card-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    border-top: 1px solid var(--border-color);
    background-color: #f8f9fa;
}

.view-log-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    background: none;
    border: none;
    color: var(--primary-color);
    font-size: 13px;
    cursor: pointer;
    padding: 5px 8px;
    border-radius: 4px;
    transition: all 0.2s;
}

.view-log-btn:hover {
    background-color: rgba(52, 152, 219, 0.1);
}

.action-icon {
    width: 16px;
    height: 16px;
}

.action-buttons {
    display: flex;
    gap: 8px;
}

.edit-btn, .delete-btn {
    background: none;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.edit-btn {
    color: var(--primary-color);
}

.edit-btn:hover {
    background-color: rgba(52, 152, 219, 0.1);
}

.delete-btn {
    color: var(--danger-color);
}

.delete-btn:hover {
    background-color: rgba(231, 76, 60, 0.1);
}

.empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 40px 20px;
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.05);
}

.empty-icon {
    width: 60px;
    height: 60px;
    fill: #e0e0e0;
    margin-bottom: 15px;
}

.empty-state h3 {
    color: var(--gray-color);
    margin-bottom: 10px;
}

.empty-state p {
    color: var(--gray-color);
    font-size: 14px;
}

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

.modal-content {
    background-color: #fff;
    border-radius: 8px;
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.modal-header {
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
    margin: 0;
}

.close {
    font-size: 24px;
    cursor: pointer;
    transition: color 0.2s;
    color: var(--gray-color);
}

.close:hover {
    color: var(--danger-color);
}

.modal-body {
    padding: 20px;
    overflow: auto;
    flex: 1;
}

.log-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-color);
}

.log-header h4 {
    margin: 0;
    color: var(--secondary-color);
}

.log-info {
    font-size: 13px;
    color: var(--gray-color);
}

.log-container {
    background-color: #2c3e50;
    border-radius: 6px;
    padding: 15px;
    color: #ecf0f1;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    line-height: 1.5;
    max-height: 60vh;
    overflow: auto;
}

#logContent {
    margin: 0;
    white-space: pre-wrap;
}