/* ============================================================
   Domain.Fish · Windows 7 风格共享样式 (app.css)
   基于 7.css (khang-nd) 的 Aero 组件，叠加桌面/任务栏/资源管理器列表等
   前台(index.php) 与 后台(admin_*.php) 共用
   ============================================================ */

/* ---------- 基础与字体 ---------- */
* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

/* 按钮（覆盖 <a class="btn"> 锚点，原生 button 也会被 7.css 染色，这里兜底统一） */
a.btn,
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 23px;
  padding: 4px 14px;
  font-size: 13px;
  line-height: 1;
  text-decoration: none;
  color: #1a1a1a;
  background: linear-gradient(#fdfdfd, #e9eef3);
  border: 1px solid #8e8f8f;
  border-radius: 3px;
  cursor: pointer;
  box-shadow: inset 0 0 0 1px #fff;
}
a.btn:hover,
.btn:hover { border-color: #3c7fb1; }
a.btn:active,
.btn:active { border-color: #6d91ab; box-shadow: inset 1px 1px 0 #0003, inset -1px 1px 0 #0001; }
.btn-default {
  background: linear-gradient(#eaf6fd, #bee6fd 0, #a7d9f5);
  border-color: #3c7fb1;
  color: #103a66;
  font-weight: 600;
}
.btn-secondary { background: linear-gradient(#fdfdfd, #e9eef3); }
.btn-sm { padding: 3px 10px; font-size: 12px; }

/* 7.css 默认字体对中文不友好，补上中文回退 */
body,
.window,
button,
input,
select,
textarea,
.title-bar-text {
  font-family: "Segoe UI", "Microsoft YaHei", "微软雅黑", "PingFang SC",
    "Noto Sans CJK SC", sans-serif;
}

/* ---------- Win7 桌面壁纸（极光蓝） ---------- */
.win7-desktop {
  min-height: 100vh;
  background:
    radial-gradient(140% 100% at 50% -10%, #3f7fc4 0%, #24579c 38%, #143a72 70%, #0c2648 100%),
    radial-gradient(60% 50% at 80% 90%, rgba(120, 200, 255, 0.25), transparent 70%);
  background-attachment: fixed;
}

/* ---------- 窗口容器（居中） ---------- */
.win7-window {
  max-width: 1100px;
  margin: 22px auto 56px;
  padding: 0 14px;
}
.win7-window > .window {
  width: 100%;
}

/* ---------- 菜单栏（文件/编辑/查看/帮助） ---------- */
.menubar {
  list-style: none;
  display: flex;
  gap: 2px;
  margin: 0;
  padding: 2px 6px;
  background: var(--w7-surface, #f0f0f0);
  border: 1px solid var(--w7-w-bd, #8e8f8f);
  border-top: 0;
  box-shadow: inset 0 1px 0 #fff;
  font-size: 12px;
}
.menubar li {
  padding: 3px 9px;
  border-radius: 3px;
  cursor: default;
  color: #1a1a1a;
}
.menubar li:hover {
  background: linear-gradient(#eaf6fd, #cfe9fb);
  box-shadow: inset 0 0 0 1px #a9d3f0;
}
.menubar u { text-decoration: underline; }

/* ---------- 工具栏（倒计时 + 筛选） ---------- */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: linear-gradient(#fdfdfd, #eef3f8);
  border: 1px solid #b9c7d6;
  border-top: 0;
  box-shadow: inset 0 1px 0 #fff;
}
.toolbar .spacer { flex: 1; }

/* 分段按钮（筛选） */
.segment {
  display: inline-flex;
  border: 1px solid #8e8f8f;
  border-radius: 3px;
  overflow: hidden;
  background: #fff;
}
.segment button {
  min-width: auto;
  border: 0;
  border-right: 1px solid #b7b7b7;
  border-radius: 0;
  box-shadow: none;
  padding: 4px 14px;
  font-size: 12px;
  background: linear-gradient(#fdfdfd, #e9eef3);
}
.segment button:last-child { border-right: 0; }
.segment button.active {
  background: linear-gradient(#cfe6fb, #a9d2f5);
  box-shadow: inset 0 0 0 1px #7fb3e0;
  color: #103a66;
  font-weight: 600;
}
.segment button:before { content: none; }

/* ---------- 倒计时（数码管风格） ---------- */
.countdown {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #2a4a6b;
}
.countdown .cd-label { font-weight: 600; }
.countdown .cd-box {
  display: inline-block;
  min-width: 26px;
  text-align: center;
  font-family: "Consolas", "Courier New", monospace;
  font-weight: 700;
  font-size: 14px;
  color: #6dffb0;
  background: #0a1c10;
  border: 1px solid #000;
  border-radius: 3px;
  padding: 2px 4px;
  box-shadow: inset 0 0 6px #0f0, 0 0 0 1px #2a5;
}
.countdown .cd-sep { color: #6dffb0; font-weight: 700; }

/* ---------- 资源管理器风格列表（域名列表） ---------- */
.sunken {
  background: #fff;
  border: 1px solid #7f9bbd;
  box-shadow: inset 1px 1px 0 #6b88a8, inset -1px -1px 0 #fff;
  border-radius: 2px;
  overflow: hidden;
}
.table-wrap { overflow-x: auto; }

table.explorer {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  background: #fff;
}
table.explorer thead th {
  position: sticky;
  top: 0;
  text-align: left;
  padding: 7px 10px;
  font-weight: 600;
  color: #16395f;
  background: linear-gradient(#eaf3fb, #c9e0f3);
  border-right: 1px solid #b9d2e8;
  border-bottom: 1px solid #9bbdd9;
  box-shadow: inset 0 1px 0 #fff;
  white-space: nowrap;
}
table.explorer tbody td {
  padding: 8px 10px;
  border-right: 1px solid #e3edf6;
  border-bottom: 1px solid #eef3f8;
  vertical-align: middle;
}
table.explorer tbody tr:nth-child(even) { background: #f6fafd; }
table.explorer tbody tr:hover {
  background: linear-gradient(#fff9, #e6ecf5cc 90%, #fff);
  box-shadow: inset 0 0 0 1px #aaddfa;
}
table.explorer tbody tr.row-muted { color: #8a8a8a; background: #f1f1f1; }
table.explorer .domain-name {
  font-weight: 700;
  color: #0d3b66;
  font-family: "Consolas", "Microsoft YaHei", monospace;
}
table.explorer .col-domain { min-width: 160px; }
table.explorer .domain-name { overflow-wrap: anywhere; }
table.explorer .col-price { font-weight: 700; color: #b5460d; white-space: nowrap; }
table.explorer .col-desc { color: #555; max-width: 280px; }
table.explorer .col-actions { white-space: nowrap; }

/* 后台「域名管理」桌面端：域名收窄，给操作列留足空间，按钮强制一行 */
table.explorer.tbl-domains { table-layout: fixed; }
table.explorer.tbl-domains .col-dom { width: 32%; min-width: 120px; }
table.explorer.tbl-domains .col-price { width: 80px; }
table.explorer.tbl-domains .col-status { width: 70px; text-align: center; }
table.explorer.tbl-domains .col-actions { width: auto; min-width: 210px; }
table.explorer.tbl-domains .col-actions .btn-row { flex-wrap: nowrap; gap: 3px; }
table.explorer.tbl-domains .col-actions .btn { padding: 3px 7px; font-size: 12px; }

/* ---------- 徽章 / 印章 ---------- */
.badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
  border: 1px solid;
  line-height: 1.4;
}
.badge-sold {
  background: linear-gradient(#ededed, #d6d6d6);
  border-color: #b0b0b0;
  color: #5a5a5a;
}
.badge-available {
  background: linear-gradient(#d8f5dd, #aee6b8);
  border-color: #6fbf7f;
  color: #1f6b33;
}
.tld {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  color: #2e6da4;
  background: #eaf2fb;
  border: 1px solid #b9d2e8;
  border-radius: 3px;
  padding: 1px 5px;
  margin-left: 4px;
}

.domain-row-wrap { position: relative; }

/* ---------- 状态栏 ---------- */
.status-bar-field.ticker-field {
  flex-grow: 3;
  overflow: hidden;
  white-space: nowrap;
  position: relative;
}
.ticker-track {
  display: inline-block;
  padding-left: 100%;
  animation: ticker-scroll 22s linear infinite;
  color: #2a4a6b;
  font-size: 12px;
}
.ticker-track span { margin: 0 18px; }
.ticker-track .hot { color: #c81e1e; font-weight: 700; }
@keyframes ticker-scroll {
  from { transform: translateX(0); }
  to { transform: translateX(-100%); }
}

/* ---------- 统计卡片（后台） ---------- */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin: 12px 0;
}
.stat-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  background: linear-gradient(#fff, #f1f5fa);
  border: 1px solid #b9c7d6;
  border-radius: 4px;
  box-shadow: inset 0 1px 0 #fff, 0 1px 2px #0002;
}
.stat-icon {
  width: 42px;
  height: 42px;
  flex: none;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  box-shadow: inset 0 1px 0 #fff8, 0 1px 3px #0004;
}
.stat-icon.i-primary { background: linear-gradient(#5b9bd5, #2e6da4); }
.stat-icon.i-ok { background: linear-gradient(#7bc47b, #3f9d50); }
.stat-icon.i-warn { background: linear-gradient(#f0a85b, #d9802a); }
.stat-icon svg { width: 22px; height: 22px; }
.stat-value { display: block; font-size: 22px; font-weight: 800; color: #143a66; line-height: 1.1; }
.stat-label { display: block; font-size: 12px; color: #6a6a6a; }

/* ---------- 后台侧边导航 ---------- */
.win7-body {
  display: flex;
  align-items: stretch;
}
.win7-nav {
  width: 210px;
  flex: none;
  background: linear-gradient(#f4f8fc, #e7eef6);
  border-right: 1px solid #b9c7d6;
  padding: 8px 6px;
  overflow-y: auto;
}
.win7-nav .nav-section {
  font-size: 11px;
  font-weight: 700;
  color: #7a8aa0;
  text-transform: uppercase;
  letter-spacing: .5px;
  margin: 12px 8px 4px;
}
.win7-nav .nav-section:first-child { margin-top: 2px; }
.win7-nav a {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  margin: 2px 0;
  border-radius: 4px;
  color: #1a3a5c;
  text-decoration: none;
  font-size: 13px;
}
.win7-nav a svg { width: 18px; height: 18px; flex: none; }
.win7-nav a:hover {
  background: linear-gradient(#eaf3fb, #d3e7f7);
  box-shadow: inset 0 0 0 1px #a9d3f0;
}
.win7-nav a.active {
  background: linear-gradient(#cfe2fb, #a9d0f5);
  box-shadow: inset 0 0 0 1px #7fb3e0;
  color: #0d3b66;
  font-weight: 600;
}
.win7-main { flex: 1; min-width: 0; padding: 14px 16px; }

.content-head h1 { margin: 0 0 2px; font-size: 20px; color: #143a66; }
.content-head p { margin: 0 0 10px; color: #6a6a6a; font-size: 13px; }

/* 面板（卡片） */
.panel {
  background: #fff;
  border: 1px solid #b9c7d6;
  border-radius: 4px;
  margin: 12px 0;
  box-shadow: inset 0 1px 0 #fff, 0 1px 2px #0002;
  overflow: hidden;
}
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 12px;
  background: linear-gradient(#eef4fa, #dce8f4);
  border-bottom: 1px solid #c3d3e3;
  font-weight: 700;
  color: #16395f;
  font-size: 13px;
}
.panel-body { padding: 12px; }

/* 表单网格 */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.form-grid .field { display: flex; flex-direction: column; gap: 4px; }
.form-grid .field.col-2 { grid-column: 1 / -1; }
.form-grid label { font-size: 12px; color: #3a3a3a; font-weight: 600; }
.form-grid input[type=text],
.form-grid input[type=url],
.form-grid input[type=email],
.form-grid input[type=number],
.form-grid input[type=password],
.form-grid textarea,
.field input,
.field textarea {
  width: 100%;
  padding: 6px 8px;
  font-size: 13px;
}
.field-hint { font-size: 11px; color: #8a8a8a; }
.radio-row { display: flex; gap: 16px; align-items: center; padding-top: 4px; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

/* 提示框 */
.alert {
  padding: 9px 12px;
  border-radius: 3px;
  margin: 10px 0;
  font-size: 13px;
  border: 1px solid;
}
.alert-ok { background: #e8f7ec; border-color: #8fd0a0; color: #1f6b33; }
.alert-err { background: #fdeaea; border-color: #f0a0a0; color: #9c1f1f; }

/* ---------- 模态框（Aero 窗口） ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: #0007;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 16px;
}
.modal-overlay.open { display: flex; }
/* 覆盖 7.css 对 .window[role=dialog] 默认的 opacity:0/visibility:hidden（它只认 :target），
   让 JS 加 .open 类即可正常显示报价弹窗 */
.modal-overlay .window[role=dialog] {
  width: 440px;
  max-width: 94vw;
  position: relative;
  left: auto;
  top: auto;
  transform: none;
  opacity: 1;
  visibility: visible;
}

/* ---------- 报价详情片段 ---------- */
.bid-detail { font-size: 13px; }
.bid-detail .detail-item {
  padding: 6px 2px;
  border-bottom: 1px solid #e3edf6;
}
.bid-detail .detail-item:last-child { border-bottom: 0; }
.bid-detail .k { display: inline-block; min-width: 110px; color: #5a6b80; font-weight: 600; }
.bid-detail .ua {
  max-width: 320px;
  word-break: break-all;
  font-size: 11px;
  color: #777;
  margin-top: 2px;
}

/* ---------- 移动端抽屉导航 ---------- */
.nav-toggle { display: none; }

/* ============================================================
   响应式
   ============================================================ */
@media (max-width: 820px) {
  .win7-window { margin: 12px auto 52px; padding: 0 8px; }

  /* 后台导航变抽屉 */
  .win7-body { display: block; position: relative; }
  .win7-nav {
    position: fixed;
    top: 0; bottom: 0; left: 0;
    width: 230px;
    z-index: 80;
    transform: translateX(-100%);
    transition: transform .22s ease;
    box-shadow: 2px 0 10px #0006;
  }
  .win7-nav.open { transform: translateX(0); }
  .nav-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 0 0 8px;
  }
  .nav-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: #0005;
    z-index: 70;
  }
  .nav-overlay.show { display: block; }

  .form-grid { grid-template-columns: 1fr; }
  .toolbar { gap: 8px; }
  .countdown { font-size: 11px; }
  .menubar { flex-wrap: wrap; }
}

/* 手机端：域名列表只显示 域名 / 价格 / 操作，隐藏 备注 */
@media (max-width: 640px) {
  table.explorer { table-layout: fixed; }
  table.explorer thead th,
  table.explorer tbody td { padding: 6px; }
  table.explorer .col-desc { display: none !important; }
  table.explorer .col-domain { width: 50% !important; min-width: 0; }
  table.explorer .col-price { width: 22% !important; white-space: nowrap; }
  table.explorer .col-actions { width: 28% !important; white-space: nowrap; }
  table.explorer .domain-name { word-break: break-all; font-size: 12px; line-height: 1.35; }
  table.explorer .col-actions .btn { padding: 3px 6px !important; font-size: 11px !important; }

  /* 后台「域名管理」手机端：域名 / 价格 / 操作，隐藏状态（已售行已置灰），域名列优先占 50% */
  table.explorer.tbl-domains .col-dom { width: 23% !important; min-width: 0; }
  table.explorer.tbl-domains .col-price { width: 15% !important; white-space: nowrap; }
  table.explorer.tbl-domains .col-status { display: none !important; }
  table.explorer.tbl-domains .col-actions { width: 28% !important; }

  /* 后台「最新报价」手机端：域名 / 金额 / 操作，隐藏报价人与时间，域名列优先占 50% */
  table.explorer.tbl-bids .col-dom { width: 50% !important; min-width: 0; }
  table.explorer.tbl-bids .col-price { width: 28% !important; white-space: nowrap; }
  table.explorer.tbl-bids .col-bidder,
  table.explorer.tbl-bids .col-time { display: none !important; }
  table.explorer.tbl-bids .col-actions { width: 22% !important; }
}

@media (max-width: 520px) {
  .stat-grid { grid-template-columns: 1fr; }
}
