/* 数达智算运维控制台样式 */

:root {
    --ops-bg: #f4f6fb;
    --ops-surface: #ffffff;
    --ops-primary: #1f2937;
    --ops-sidebar: #0f172a;
    --ops-accent: #2563eb;
    --ops-accent-soft: rgba(37, 99, 235, 0.12);
    --ops-success: #16a34a;
    --ops-warning: #f59e0b;
    --ops-danger: #dc2626;
    --ops-info: #0ea5e9;
    --ops-muted: #94a3b8;
    --ops-border: #e2e8f0;
    --ops-shadow: 0 12px 30px rgba(15, 23, 42, 0.12);
    --ops-sidebar-width: 264px;
}

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

body {
    font-family: 'Inter', 'Segoe UI', 'Microsoft YaHei', sans-serif;
    background: var(--ops-bg);
    color: var(--ops-primary);
    line-height: 1.6;
}

a {
    color: inherit;
    text-decoration: none;
}

button {
    font-family: inherit;
}

/***** 登录页 *****/
.login-page {
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    background: radial-gradient(circle at top, rgba(37, 99, 235, 0.2), rgba(15, 23, 42, 0.95));
    padding: 24px;
}

.login-container {
    width: min(420px, 100%);
}

.login-box {
    background: rgba(15, 23, 42, 0.75);
    border: 1px solid rgba(148, 163, 184, 0.25);
    border-radius: 20px;
    padding: 36px 32px;
    backdrop-filter: blur(10px);
    color: #e2e8f0;
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.4);
}

.login-header {
    text-align: center;
    margin-bottom: 28px;
}

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

.login-header p {
    color: rgba(226, 232, 240, 0.7);
    font-size: 14px;
}

.login-form {
    display: grid;
    gap: 16px;
}

.login-form .form-group {
    display: grid;
    gap: 6px;
}

.login-form label {
    font-size: 14px;
    color: rgba(226, 232, 240, 0.85);
}

.login-form input {
    border-radius: 12px;
    border: 1px solid rgba(148, 163, 184, 0.35);
    background: rgba(15, 23, 42, 0.6);
    color: #e2e8f0;
    padding: 12px 14px;
    transition: border-color 0.2s ease, background 0.2s ease;
}

.login-form input:focus {
    outline: none;
    border-color: rgba(37, 99, 235, 0.7);
    background: rgba(15, 23, 42, 0.85);
}

.login-tips {
    margin-top: 12px;
    padding: 14px 16px;
    border-radius: 12px;
    background: rgba(37, 99, 235, 0.12);
    color: rgba(226, 232, 240, 0.85);
    font-size: 13px;
}

.login-tips .warning {
    display: block;
    margin-top: 6px;
    color: #fcd34d;
    font-weight: 500;
}

/***** 按钮 *****/
.btn-primary,
.btn-secondary,
.btn-danger,
.btn-refresh,
.btn-logout,
.btn-outline {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: 12px;
    border: none;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.2s ease;
    box-shadow: 0 6px 18px rgba(37, 99, 235, 0.12);
}

.btn-primary {
    background: linear-gradient(135deg, #2563eb, #3b82f6);
    color: #fff;
}

.btn-primary:hover {
    filter: brightness(1.05);
}

.btn-secondary {
    background: rgba(15, 23, 42, 0.08);
    color: var(--ops-primary);
    border: 1px solid rgba(15, 23, 42, 0.12);
}

.btn-secondary:hover {
    background: rgba(15, 23, 42, 0.12);
}

.btn-danger {
    background: linear-gradient(135deg, #dc2626, #ef4444);
    color: #fff;
}

.btn-refresh {
    background: rgba(37, 99, 235, 0.12);
    color: #2563eb;
    border: 1px solid rgba(37, 99, 235, 0.18);
    box-shadow: none;
}

.btn-refresh:hover {
    background: rgba(37, 99, 235, 0.16);
}

.btn-outline {
    background: transparent;
    border: 1px solid rgba(15, 23, 42, 0.18);
    color: var(--ops-primary);
    box-shadow: none;
}

.btn-logout {
    background: transparent;
    border: 1px solid rgba(148, 163, 184, 0.4);
    color: var(--ops-muted);
    box-shadow: none;
    padding: 8px 14px;
}

.btn-block {
    width: 100%;
}

.btn-sm {
    padding: 8px 14px;
    font-size: 13px;
    border-radius: 10px;
}

/***** 布局 *****/
.ops-layout {
    min-height: 100vh;
    display: flex;
    background: var(--ops-bg);
}

.ops-sidebar {
    width: var(--ops-sidebar-width);
    background: linear-gradient(180deg, var(--ops-sidebar), #111827);
    color: #e2e8f0;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    bottom: 0;
    z-index: 10;
    box-shadow: 12px 0 32px rgba(15, 23, 42, 0.3);
}

.ops-sidebar__brand {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 28px 24px 24px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.15);
}

.ops-logo {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    background: rgba(37, 99, 235, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    color: #3b82f6;
}

.ops-sidebar__brand h2 {
    font-size: 18px;
    font-weight: 600;
}

.ops-sidebar__brand p {
    font-size: 13px;
    color: rgba(226, 232, 240, 0.65);
}

.ops-menu {
    padding: 18px 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}

.ops-menu__item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 24px;
    color: rgba(226, 232, 240, 0.70);
    font-size: 14px;
    font-weight: 500;
    transition: background 0.2s ease, color 0.2s ease;
    border-left: 3px solid transparent;
}

.ops-menu__item .icon {
    font-size: 18px;
}

.ops-menu__item:hover {
    color: #fff;
    background: rgba(30, 64, 175, 0.28);
}

.ops-menu__item.is-active {
    color: #fff;
    background: rgba(37, 99, 235, 0.24);
    border-left-color: #3b82f6;
}

.ops-menu__item--secondary {
    color: rgba(226, 232, 240, 0.65);
    border-left-color: transparent;
}

.ops-sidebar__footer {
    padding: 20px 24px 28px;
    border-top: 1px solid rgba(148, 163, 184, 0.12);
}

.ops-main {
    flex: 1;
    margin-left: var(--ops-sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.ops-header {
    position: sticky;
    top: 0;
    z-index: 8;
    background: rgba(244, 246, 251, 0.85);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(148, 163, 184, 0.15);
    padding: 24px 32px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 24px;
}

.ops-header__label {
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--ops-muted);
    margin-bottom: 4px;
}

.ops-header__info h1 {
    font-size: 22px;
    font-weight: 600;
    color: var(--ops-primary);
}

.ops-header__actions,
.header-actions {
    display: inline-flex;
    align-items: center;
    gap: 12px;
}

.ops-header__meta {
    padding: 6px 10px;
    border-radius: 999px;
    background: rgba(37, 99, 235, 0.12);
    color: #2563eb;
    font-size: 12px;
    font-weight: 500;
}

.user-info {
    color: var(--ops-muted);
    font-size: 13px;
}

.ops-content,
.page-content,
.dashboard-content {
    display: flex;
    flex-direction: column;
    gap: 24px;
    padding: 28px 32px 40px;
}

/***** 卡片与网格 *****/
.section-card {
    background: var(--ops-surface);
    border-radius: 18px;
    padding: 22px 24px;
    box-shadow: var(--ops-shadow);
    border: 1px solid rgba(148, 163, 184, 0.12);
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.section-card__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.section-card h2 {
    font-size: 18px;
    font-weight: 600;
    color: var(--ops-primary);
}

.stats-grid,
.resource-grid,
.info-grid,
.modules-status,
.alerts-list,
.metrics-grid,
.stats-grid-mini,
.backup-list {
    display: grid;
    gap: 16px;
}

.stats-grid {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.stats-grid-mini {
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

.info-grid {
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.modules-status {
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.stat-card {
    border-radius: 16px;
    padding: 18px;
    display: flex;
    align-items: center;
    gap: 16px;
    background: rgba(255, 255, 255, 0.65);
    border: 1px solid rgba(148, 163, 184, 0.14);
    box-shadow: var(--ops-shadow);
}

.stat-icon {
    width: 42px;
    height: 42px;
    border-radius: 14px;
    background: rgba(37, 99, 235, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: #2563eb;
}

.stat-info h3 {
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--ops-muted);
}

.stat-value {
    font-size: 24px;
    font-weight: 600;
    color: var(--ops-primary);
}

.resource-grid {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

.resource-item {
    display: grid;
    gap: 8px;
}

.progress-bar {
    width: 100%;
    height: 16px;
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.18);
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    color: #fff;
    border-radius: 999px;
    background: linear-gradient(90deg, #2563eb, #3b82f6);
    transition: width 0.3s ease, background 0.3s ease;
}

.modules-status .module-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px;
    border-radius: 14px;
    background: rgba(15, 23, 42, 0.04);
    border: 1px solid rgba(148, 163, 184, 0.2);
}

.status-badge {
    padding: 5px 12px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    color: #fff;
}

.status-running {
    background: rgba(22, 163, 74, 0.9);
}

.status-degraded {
    background: rgba(245, 158, 11, 0.9);
}

.status-offline {
    background: rgba(220, 38, 38, 0.9);
}

.alerts-list .alert-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 13px;
    color: #fff;
}

.alert-warning {
    background: linear-gradient(135deg, #f59e0b, #f97316);
}

.alert-info {
    background: linear-gradient(135deg, #0ea5e9, #38bdf8);
}

.alert-critical {
    background: linear-gradient(135deg, #dc2626, #ef4444);
}

.metrics-grid {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.performance-score {
    display: grid;
    gap: 12px;
    padding: 12px;
    border-radius: 14px;
    background: rgba(37, 99, 235, 0.06);
}

.request-stats {
    display: grid;
    gap: 12px;
}

.loading {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 18px;
    color: var(--ops-muted);
    font-size: 14px;
    background: rgba(15, 23, 42, 0.04);
    border-radius: 12px;
}

/***** 表格和表单 *****/
.filter-form {
    display: flex;
    gap: 16px;
    align-items: flex-end;
    flex-wrap: wrap;
}

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

.form-group label {
    font-size: 13px;
    color: var(--ops-muted);
}

.form-group input,
.form-group select,
.config-form input,
.config-form select,
.config-form textarea {
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid rgba(148, 163, 184, 0.4);
    background: rgba(255, 255, 255, 0.7);
    transition: border-color 0.2s ease, background 0.2s ease;
    font-size: 14px;
}

.form-group input:focus,
.form-group select:focus,
.config-form input:focus,
.config-form select:focus,
.config-form textarea:focus {
    outline: none;
    border-color: rgba(37, 99, 235, 0.65);
    background: #fff;
}

.modules-table,
.logs-table,
.data-table {
    border-radius: 16px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(148, 163, 184, 0.16);
    box-shadow: var(--ops-shadow);
}

.modules-table table,
.logs-table table,
.data-table table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.modules-table th,
.logs-table th,
.data-table th,
.modules-table td,
.logs-table td,
.data-table td {
    padding: 14px 16px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.14);
    text-align: left;
}

.modules-table th,
.logs-table th,
.data-table th {
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-size: 12px;
    color: var(--ops-muted);
    background: rgba(241, 245, 249, 0.65);
}

.config-form {
    display: grid;
    gap: 18px;
}

.config-form .config-group {
    display: grid;
    gap: 10px;
}

.backup-list .backup-item {
    display: flex;
    justify-content: space-between;
    padding: 14px 16px;
    border-radius: 14px;
    background: rgba(15, 23, 42, 0.04);
    border: 1px solid rgba(148, 163, 184, 0.18);
    font-size: 13px;
}

/***** 模态框 *****/
.modal {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1200;
}

.modal-content {
    background: var(--ops-surface);
    border-radius: 18px;
    width: min(760px, 92%);
    max-height: 82vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 24px 64px rgba(15, 23, 42, 0.25);
    border: 1px solid rgba(148, 163, 184, 0.18);
}

.modal-header,
.modal-footer {
    padding: 18px 22px;
    background: rgba(241, 245, 249, 0.75);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
}

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

.modal-body pre {
    background: #0f172a;
    color: #e2e8f0;
    padding: 18px;
    border-radius: 12px;
    font-size: 13px;
    line-height: 1.5;
}

.modal-close {
    background: none;
    border: none;
    font-size: 22px;
    cursor: pointer;
    color: var(--ops-muted);
}

/***** Toast *****/
.toast {
    position: fixed;
    top: 26px;
    right: 26px;
    padding: 14px 20px;
    border-radius: 14px;
    color: #fff;
    box-shadow: 0 20px 40px rgba(15, 23, 42, 0.2);
    z-index: 1500;
    animation: slideIn 0.3s ease;
    font-size: 14px;
}

.toast-info {
    background: linear-gradient(135deg, #2563eb, #3b82f6);
}

.toast-success {
    background: linear-gradient(135deg, #16a34a, #22c55e);
}

.toast-warning {
    background: linear-gradient(135deg, #f59e0b, #f97316);
}

.toast-error {
    background: linear-gradient(135deg, #dc2626, #ef4444);
}

.toast--hide {
    animation: slideOut 0.3s ease forwards;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideOut {
    from {
        opacity: 1;
        transform: translateY(0);
    }
    to {
        opacity: 0;
        transform: translateY(-8px);
    }
}

/***** 响应式 *****/
@media (max-width: 1100px) {
    :root {
        --ops-sidebar-width: 240px;
    }
}

@media (max-width: 960px) {
    :root {
        --ops-sidebar-width: 0;
    }

    .ops-sidebar {
        display: none;
    }

    .ops-main {
        margin-left: 0;
    }

    .ops-content,
    .page-content,
    .dashboard-content {
        padding: 24px 20px 32px;
    }

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