/* LKSK 运维面板 - 共享样式 */

:root {
  --bg: #f5f7fa;
  --bg2: #ffffff;
  --bg3: #f0f4f8;
  --ink: #1a2332;
  --ink2: #334155;
  --muted: #64748b;
  --muted2: #94a3b8;
  --rule: #e2e8f0;
  --rule2: #cbd5e1;
  --accent: #2563eb;
  --accent2: #3b82f6;
  --accent-light: #dbeafe;
  --accent-dark: #1d4ed8;
  --success: #10b981;
  --success-light: #d1fae5;
  --warning: #f59e0b;
  --warning-light: #fef3c7;
  --danger: #ef4444;
  --danger-light: #fee2e2;
  --purple: #8b5cf6;
  --purple-light: #ede9fe;
  --pink: #ec4899;
  --pink-light: #fce7f3;
  --cyan: #06b6d4;
  --cyan-light: #cffafe;
  --code-bg: #1e293b;
  --code-fg: #e2e8f0;
  --code-comment: #64748b;
  --code-green: #4ade80;
  --code-yellow: #fbbf24;
  --code-blue: #60a5fa;
  --code-pink: #f472b6;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
  --shadow: 0 4px 12px rgba(0,0,0,0.06);
  --shadow-lg: 0 10px 30px rgba(0,0,0,0.08);
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", "PingFang SC", "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.6;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

/* 顶部导航 */
.topbar {
  background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 50%, #7c3aed 100%);
  color: #fff;
  padding: 0 24px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.2);
}
.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
}
.topbar-logo {
  width: 36px;
  height: 36px;
  background: rgba(255,255,255,0.2);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}
.topbar-title {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.01em;
}
.topbar-subtitle {
  font-size: 12px;
  opacity: 0.75;
  margin-left: 4px;
}
.topbar-right {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 13px;
}
.topbar-badge {
  background: rgba(255,255,255,0.18);
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
}

/* 面包屑 */
.breadcrumb {
  background: var(--bg2);
  border-bottom: 1px solid var(--rule);
  padding: 12px 24px;
  font-size: 13px;
  color: var(--muted);
}
.breadcrumb a {
  color: var(--accent);
  text-decoration: none;
}
.breadcrumb a:hover { text-decoration: underline; }
.breadcrumb .sep {
  margin: 0 8px;
  color: var(--muted2);
}
.breadcrumb .current {
  color: var(--ink);
  font-weight: 500;
}

/* 主内容区 */
.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 24px;
}

/* 首页 Hero */
.home-hero {
  background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 50%, #7c3aed 100%);
  color: #fff;
  padding: 48px 32px;
  border-radius: var(--radius-lg);
  margin-bottom: 28px;
  position: relative;
  overflow: hidden;
}
.home-hero::before {
  content: '';
  position: absolute;
  top: -100%;
  right: -20%;
  width: 60%;
  height: 300%;
  background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 60%);
  transform: rotate(15deg);
}
.home-hero h1 {
  font-size: 32px;
  font-weight: 700;
  margin-bottom: 8px;
  position: relative;
}
.home-hero p {
  font-size: 15px;
  opacity: 0.85;
  max-width: 500px;
  position: relative;
}
.home-hero-stats {
  display: flex;
  gap: 32px;
  margin-top: 24px;
  position: relative;
}
.home-hero-stat .num {
  font-size: 36px;
  font-weight: 700;
  line-height: 1;
}
.home-hero-stat .label {
  font-size: 12px;
  opacity: 0.75;
  margin-top: 4px;
}

/* 区域标题 */
.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding: 0 4px;
}
.section-title h2 {
  font-size: 20px;
  font-weight: 700;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 8px;
}
.section-title h2 .icon {
  font-size: 22px;
}
.section-title .tip {
  font-size: 12px;
  color: var(--muted);
  padding-right: 4px;
  white-space: nowrap;
}

/* 服务器卡片网格 */
.server-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.server-card {
  background: var(--bg2);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 20px;
  transition: all 0.25s ease;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}
.server-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--accent);
  transform: scaleX(0);
  transition: transform 0.3s ease;
}
.server-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}
.server-card:hover::before {
  transform: scaleX(1);
}
.server-card.intl::before { background: #2563eb; }
.server-card.cn::before { background: #f59e0b; }
.server-card.test::before { background: #8b5cf6; }
.server-card.monitor::before { background: #10b981; }
.server-card.deploy::before { background: #ec4899; }
.server-card.db::before { background: #06b6d4; }

.server-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
}
.server-card-name {
  font-size: 17px;
  font-weight: 700;
  color: var(--ink);
}
.server-card-ip {
  font-family: 'Consolas', 'Monaco', monospace;
  font-size: 13px;
  color: var(--accent);
  background: var(--accent-light);
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 500;
}

.server-card-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.tag {
  display: inline-block;
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 999px;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.tag.intl { background: #dbeafe; color: #1d4ed8; }
.tag.cn { background: #fef3c7; color: #b45309; }
.tag.test { background: #ede9fe; color: #6d28d9; }
.tag.monitor { background: #d1fae5; color: #047857; }
.tag.deploy { background: #fce7f3; color: #be185d; }
.tag.db { background: #cffafe; color: #0e7490; }
.tag.env { background: var(--bg3); color: var(--muted); }

.server-card-info {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 14px;
}
.server-card-info .row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
}
.server-card-info .label {
  color: var(--muted2);
  font-size: 12px;
}

.server-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 12px;
  border-top: 1px solid var(--rule);
}
.server-card-services {
  font-size: 12px;
  color: var(--muted);
}
.server-card-services strong {
  color: var(--ink2);
  font-weight: 600;
}
.server-card-arrow {
  color: var(--accent);
  font-size: 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* 状态指示灯 */
.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: middle;
}
.status-dot.online {
  background: var(--success);
  box-shadow: 0 0 0 3px var(--success-light);
}
.status-dot.offline {
  background: var(--danger);
  box-shadow: 0 0 0 3px var(--danger-light);
}
.status-dot.warning {
  background: var(--warning);
  box-shadow: 0 0 0 3px var(--warning-light);
}

/* ========= 服务器详情页 ========= */

/* 页面头部 */
.page-header {
  background: var(--bg2);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  padding: 24px 28px;
  margin-bottom: 20px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 16px;
}
.page-header-left h1 {
  font-size: 24px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.page-header-left h1 .ip-text {
  font-family: 'Consolas', monospace;
  font-size: 15px;
  color: var(--accent);
  background: var(--accent-light);
  padding: 4px 10px;
  border-radius: 6px;
  font-weight: 600;
}
.page-header-desc {
  color: var(--muted);
  font-size: 13px;
}

.page-header-right {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid var(--rule);
  background: var(--bg2);
  color: var(--ink2);
  text-decoration: none;
  transition: all 0.2s;
}
.btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-light);
}
.btn.primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.btn.primary:hover {
  background: var(--accent-dark);
  border-color: var(--accent-dark);
  color: #fff;
}
.btn.success {
  background: var(--success);
  color: #fff;
  border-color: var(--success);
}
.btn.success:hover { opacity: 0.9; color: #fff; }

/* 两栏布局 */
.detail-layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 20px;
}

/* 侧边栏导航 */
.side-nav {
  background: var(--bg2);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 12px;
  position: sticky;
  top: 80px;
  align-self: start;
}
.side-nav h3 {
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 10px;
  padding: 0 8px;
  font-weight: 700;
}
.side-nav ul {
  list-style: none;
}
.side-nav li a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--ink2);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.2s;
  margin-bottom: 2px;
}
.side-nav li a:hover {
  background: var(--bg3);
  color: var(--ink);
}
.side-nav li a.active {
  background: var(--accent-light);
  color: var(--accent);
}
.side-nav li a .icon {
  font-size: 16px;
  width: 20px;
  text-align: center;
}
.side-nav-section {
  margin-bottom: 16px;
}
.side-nav-section:last-child { margin-bottom: 0; }

/* 主内容区 */
.detail-content {
  min-width: 0;
}

/* 卡片 */
.card {
  background: var(--bg2);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  margin-bottom: 16px;
  overflow: hidden;
}
.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--rule);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.card-header h2 {
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 8px;
}
.card-header h2 .icon {
  font-size: 18px;
}
.card-header .badge {
  font-size: 11px;
  padding: 3px 8px;
  background: var(--bg3);
  color: var(--muted);
  border-radius: 4px;
  font-weight: 500;
}
.card-body {
  padding: 20px;
}

/* 信息网格 */
.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}
.info-item {
  background: var(--bg);
  border: 1px solid var(--rule);
  border-radius: 8px;
  padding: 12px 14px;
}
.info-item .label {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 4px;
}
.info-item .value {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  word-break: break-all;
}
.info-item .value.mono {
  font-family: 'Consolas', monospace;
  font-size: 13px;
}
.info-item .value.code {
  font-family: 'Consolas', monospace;
  font-size: 12px;
  background: var(--code-bg);
  color: var(--code-green);
  padding: 2px 6px;
  border-radius: 4px;
  display: inline-block;
}

/* 步骤指引 */
.steps {
  margin: 8px 0;
}
.step {
  display: flex;
  gap: 14px;
  padding: 14px 0;
  border-bottom: 1px dashed var(--rule);
  position: relative;
}
.step:last-child { border-bottom: none; }
.step-num {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  background: var(--accent);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
}
.step-content { flex: 1; min-width: 0; }
.step-title {
  font-weight: 600;
  font-size: 14px;
  color: var(--ink);
  margin-bottom: 4px;
}
.step-desc {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 8px;
  line-height: 1.6;
}

/* 命令块 */
.cmd-block {
  position: relative;
  margin: 8px 0;
  border-radius: 8px;
  overflow: hidden;
}
.cmd-block-header {
  background: #0f172a;
  color: var(--muted2);
  padding: 6px 12px;
  font-size: 11px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.cmd-block-header .dots {
  display: flex;
  gap: 5px;
}
.cmd-block-header .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}
.cmd-block-header .dot.r { background: #ff5f57; }
.cmd-block-header .dot.y { background: #febc2e; }
.cmd-block-header .dot.g { background: #28c840; }
.cmd-block pre {
  background: var(--code-bg);
  color: var(--code-fg);
  padding: 14px 16px;
  margin: 0;
  overflow-x: auto;
  font-family: 'Consolas', 'Monaco', monospace;
  font-size: 13px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-all;
}
.cmd-copy {
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.15);
  color: #fff;
  padding: 3px 10px;
  border-radius: 4px;
  font-size: 11px;
  cursor: pointer;
  transition: all 0.2s;
}
.cmd-copy:hover {
  background: rgba(255,255,255,0.2);
}
.cmd-copy.copied {
  background: var(--success);
  border-color: var(--success);
}

/* 命令说明 */
.cmd-explain {
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
  padding-left: 4px;
  line-height: 1.5;
}
.cmd-explain strong {
  color: var(--ink2);
  font-weight: 600;
}

/* 警告/提示框 */
.callout {
  padding: 14px 16px;
  border-radius: 8px;
  margin: 12px 0;
  border-left: 4px solid;
  font-size: 13px;
  line-height: 1.6;
}
.callout-title {
  font-weight: 700;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
}
.callout.info {
  background: var(--accent-light);
  border-color: var(--accent);
  color: #1e3a8a;
}
.callout.warning {
  background: var(--warning-light);
  border-color: var(--warning);
  color: #78350f;
}
.callout.danger {
  background: var(--danger-light);
  border-color: var(--danger);
  color: #7f1d1d;
}
.callout.success {
  background: var(--success-light);
  border-color: var(--success);
  color: #064e3b;
}
.callout.beginner {
  background: #fef3c7;
  border-color: #f59e0b;
  color: #78350f;
}

/* 小白提示特殊样式 */
.callout.beginner .callout-title::before {
  content: '👶';
}

/* 服务列表 */
.service-list {
  margin: 4px 0;
}
.service-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--rule);
}
.service-item:last-child { border-bottom: none; }
.service-left {
  display: flex;
  align-items: center;
  gap: 12px;
}
.service-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}
.service-icon.web { background: #dbeafe; }
.service-icon.api { background: #d1fae5; }
.service-icon.db { background: #cffafe; }
.service-icon.cache { background: #fef3c7; }
.service-icon.proxy { background: #ede9fe; }
.service-icon.admin { background: #fce7f3; }
.service-icon.pay { background: #ffedd5; }
.service-icon.monitor { background: #e0e7ff; }

.service-info .name {
  font-weight: 600;
  font-size: 14px;
  color: var(--ink);
}
.service-info .desc {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}
.service-right {
  display: flex;
  align-items: center;
  gap: 8px;
}
.service-port {
  font-family: 'Consolas', monospace;
  font-size: 12px;
  background: var(--bg3);
  color: var(--muted);
  padding: 2px 8px;
  border-radius: 4px;
}

/* 命令分类卡片 */
.cmd-category {
  margin-bottom: 16px;
}
.cmd-category-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--rule);
}
.cmd-category-title .icon {
  font-size: 16px;
}

/* 故障排查 */
.trouble-item {
  border: 1px solid var(--rule);
  border-radius: 8px;
  margin-bottom: 10px;
  overflow: hidden;
}
.trouble-question {
  padding: 12px 16px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg);
  font-weight: 600;
  font-size: 13px;
  color: var(--ink);
  transition: background 0.2s;
}
.trouble-question:hover {
  background: var(--bg3);
}
.trouble-question .arrow {
  color: var(--muted);
  transition: transform 0.2s;
  font-size: 12px;
}
.trouble-item.open .trouble-question .arrow {
  transform: rotate(180deg);
}
.trouble-answer {
  display: none;
  padding: 14px 16px;
  border-top: 1px solid var(--rule);
  font-size: 13px;
  color: var(--ink2);
  line-height: 1.7;
}
.trouble-item.open .trouble-answer {
  display: block;
}
.trouble-answer ol, .trouble-answer ul {
  padding-left: 20px;
  margin: 6px 0;
}
.trouble-answer li {
  margin-bottom: 4px;
}

/* 表格 */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.data-table th {
  background: var(--bg3);
  text-align: left;
  padding: 10px 14px;
  font-weight: 600;
  color: var(--ink);
  border-bottom: 2px solid var(--rule);
  font-size: 12px;
}
.data-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--rule);
  color: var(--ink2);
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--bg); }
.data-table .mono {
  font-family: 'Consolas', monospace;
  font-size: 12px;
}

/* 底部 */
.footer {
  text-align: center;
  padding: 24px;
  color: var(--muted);
  font-size: 12px;
  border-top: 1px solid var(--rule);
  margin-top: 24px;
}

/* 快速返回 */
.back-home {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 48px;
  height: 48px;
  background: var(--accent);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(37, 99, 235, 0.3);
  text-decoration: none;
  font-size: 20px;
  z-index: 50;
  transition: all 0.2s;
}
.back-home:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(37, 99, 235, 0.4);
}

/* 响应式 */
@media (max-width: 960px) {
  .detail-layout {
    grid-template-columns: 1fr;
  }
  .side-nav {
    position: static;
    order: 2;
  }
  .home-hero { padding: 32px 20px; }
  .home-hero h1 { font-size: 24px; }
}
@media (max-width: 600px) {
  .container { padding: 16px; }
  .server-grid { grid-template-columns: 1fr; }
  .info-grid { grid-template-columns: 1fr; }
  .page-header { padding: 16px; }
  .page-header-left h1 { font-size: 20px; }
  .card-body { padding: 14px; }
  .topbar { padding: 0 16px; }
  .back-home { bottom: 16px; right: 16px; width: 42px; height: 42px; }
}

/* 打印 */
@media print {
  .side-nav, .back-home, .topbar { display: none; }
  .detail-layout { grid-template-columns: 1fr; }
  .card { break-inside: avoid; box-shadow: none; }
  body { background: #fff; }
}
