/* ============================================================
   网站查询系统 - 全局样式
   ============================================================ */

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

:root {
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-fg: #fff;
  --bg: #f8fafc;
  --surface: #fff;
  --border: #e2e8f0;
  --text: #1e293b;
  --text-muted: #64748b;
  --danger: #ef4444;
  --warning: #f59e0b;
  --success: #22c55e;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.05);
  --shadow-lg: 0 10px 25px rgba(0,0,0,.1);
}

body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 14px; color: var(--text); background: var(--bg); line-height: 1.6; }

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

.container { max-width: 960px; margin: 0 auto; padding: 0 16px; }

/* Header */
.site-header { background: var(--surface); border-bottom: 1px solid var(--border);
  padding: 12px 0; box-shadow: var(--shadow); }
.header-inner { display: flex; align-items: center; justify-content: space-between; }
.logo { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 16px; color: var(--text); }
.logo svg { color: var(--primary); }
.header-nav { display: flex; align-items: center; gap: 16px; }

/* Main */
.main-content { padding: 32px 0 64px; }

/* Card */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); }
.card-header { padding: 16px 20px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.card-title { font-size: 15px; font-weight: 600; }
.card-body { padding: 20px; }

/* Query Page */
.query-card { max-width: 680px; margin: 0 auto 32px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius); padding: 28px;
  box-shadow: var(--shadow); }
.query-title { font-size: 20px; font-weight: 700; margin-bottom: 4px; }
.query-desc { color: var(--text-muted); font-size: 13px; margin-bottom: 16px; }
.textarea { width: 100%; border: 1px solid var(--border); border-radius: var(--radius);
  padding: 10px 12px; font-size: 14px; font-family: inherit; resize: vertical;
  transition: border-color .2s; outline: none; }
.textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,.15); }

/* Buttons */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px;
  border-radius: var(--radius); font-size: 14px; font-weight: 500; cursor: pointer;
  border: 1px solid transparent; transition: all .15s; white-space: nowrap; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: var(--primary-fg); }
.btn-primary:hover:not(:disabled) { background: var(--primary-hover); }
.btn-outline { background: transparent; border-color: var(--border); color: var(--text); }
.btn-outline:hover:not(:disabled) { background: var(--bg); }
.btn-danger  { background: var(--danger); color: #fff; }
.btn-danger:hover:not(:disabled) { background: #dc2626; }
.btn-sm  { padding: 4px 10px; font-size: 12px; }
.btn-lg  { padding: 10px 20px; font-size: 15px; }
.btn-block { width: 100%; justify-content: center; margin-top: 12px; }
.btn-icon { padding: 6px; border-radius: 6px; }

/* Results */
.results-area { max-width: 680px; margin: 0 auto; }
.results-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.result-count { font-size: 13px; color: var(--text-muted); }
.results-list { display: flex; flex-direction: column; gap: 10px; }

.result-item { background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px 16px; }
.result-item.status-error { border-color: #fca5a5; background: #fef2f2; }
.result-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.result-domain { font-weight: 600; font-size: 15px; word-break: break-all; }
.result-site  { font-size: 12px; color: var(--text-muted); margin-top: 3px;
  display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.result-site-note { font-size: 11px; color: #94a3b8; }
.result-site-loading { font-size: 12px; color: #94a3b8; }
.result-meta { display: flex; flex-wrap: wrap; gap: 16px 24px; margin-top: 10px; border-top: 1px solid var(--border); padding-top: 10px; }
.meta-item { display: flex; flex-direction: column; gap: 4px; min-width: 160px; }
.meta-label { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; font-weight: 600; }
.meta-label-sub { font-weight: 400; color: #94a3b8; font-size: 10px; text-transform: none; letter-spacing: 0; }
.meta-value { font-size: 14px; font-weight: 600; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.meta-empty { font-size: 13px; font-weight: 400; color: var(--text-muted); }
.meta-loading { font-size: 13px; font-weight: 400; color: #94a3b8; }
.result-tip { font-size: 12px; color: var(--text-muted); margin-top: 6px; padding: 4px 8px;
  background: #f1f5f9; border-radius: 4px; border-left: 2px solid #cbd5e1; }
.result-error { font-size: 13px; color: var(--danger); margin-top: 6px; }
.whois-btn { font-size: 12px; padding: 3px 8px; }

/* 加载中省略号动画 */
@keyframes dotBlink { 0%,100%{opacity:1} 50%{opacity:.3} }
.dot-ani { animation: dotBlink 1.2s infinite; }

/* Badges */
.badge { display: inline-flex; align-items: center; padding: 2px 7px; border-radius: 4px;
  font-size: 11px; font-weight: 600; white-space: nowrap; border: 1px solid transparent; }
.badge-default  { background: #dbeafe; color: #1d4ed8; border-color: #bfdbfe; }
.badge-danger   { background: #fee2e2; color: #b91c1c; border-color: #fca5a5; }
.badge-warning  { background: #fef3c7; color: #b45309; border-color: #fde68a; }
.badge-orange   { background: #ffedd5; color: #c2410c; border-color: #fdba74; }
.badge-secondary{ background: #f1f5f9; color: #475569; border-color: #e2e8f0; }

/* Modal */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.5);
  display: flex; align-items: center; justify-content: center; z-index: 100; padding: 16px; }
.modal { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow-lg);
  width: 100%; max-width: 580px; max-height: 90vh; display: flex; flex-direction: column; }
.modal-header { padding: 16px 20px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; }
.modal-header h3 { font-size: 15px; font-weight: 600; }
.modal-close { background: none; border: none; font-size: 22px; cursor: pointer;
  color: var(--text-muted); line-height: 1; padding: 0 4px; }
.modal-body { padding: 20px; overflow-y: auto; flex: 1; }
.whois-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.whois-item label { font-size: 11px; color: var(--text-muted); text-transform: uppercase; display: block; }
.whois-item span { font-size: 13px; word-break: break-all; }
.whois-ns { margin-top: 12px; }
.whois-ns ul { margin: 4px 0 0 16px; }
.whois-ns li { font-size: 13px; }
.loading-spinner { text-align: center; padding: 24px; color: var(--text-muted); }

/* Forms */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 13px; font-weight: 500; margin-bottom: 5px; }
.form-control { width: 100%; border: 1px solid var(--border); border-radius: var(--radius);
  padding: 8px 12px; font-size: 14px; font-family: inherit; outline: none; transition: border-color .2s; }
.form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,.15); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-hint { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

/* Table */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; white-space: nowrap; }
th, td { padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--border); font-size: 13px; }
th { background: var(--bg); font-weight: 600; color: var(--text-muted); }
tr:hover td { background: #f8fafc; }
.td-actions { display: flex; gap: 6px; }

/* Admin layout */
.admin-layout { display: flex; min-height: 100vh; }
.admin-sidebar { width: 220px; background: #1e293b; color: #e2e8f0;
  flex-shrink: 0; display: flex; flex-direction: column; }
.sidebar-brand { padding: 18px 16px; font-size: 15px; font-weight: 700;
  border-bottom: 1px solid rgba(255,255,255,.1); display: flex; align-items: center; gap: 8px; }
.sidebar-brand svg { color: #60a5fa; }
.sidebar-nav { flex: 1; padding: 12px 0; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 9px 16px;
  color: #94a3b8; font-size: 13.5px; cursor: pointer; transition: all .15s;
  text-decoration: none; border-left: 3px solid transparent; }
.nav-item:hover { color: #e2e8f0; background: rgba(255,255,255,.06); }
.nav-item.active { color: #fff; background: rgba(255,255,255,.1); border-left-color: #60a5fa; }
.nav-item svg { width: 16px; height: 16px; flex-shrink: 0; }
.admin-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.admin-topbar { background: var(--surface); border-bottom: 1px solid var(--border);
  padding: 12px 24px; display: flex; align-items: center; justify-content: space-between; }
.topbar-title { font-size: 15px; font-weight: 600; }
.admin-content { padding: 24px; flex: 1; overflow-y: auto; }

/* Stats grid */
.stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 24px; }
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px; box-shadow: var(--shadow); }
.stat-label { font-size: 12px; color: var(--text-muted); }
.stat-value { font-size: 28px; font-weight: 700; margin: 4px 0; }
.stat-icon  { font-size: 24px; }

/* Search bar */
.search-bar { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.search-bar .form-control { max-width: 300px; }

/* Alert */
.alert { padding: 10px 14px; border-radius: var(--radius); font-size: 13px;
  border: 1px solid transparent; margin-bottom: 16px; }
.alert-success { background: #f0fdf4; color: #15803d; border-color: #bbf7d0; }
.alert-error   { background: #fef2f2; color: #b91c1c; border-color: #fca5a5; }
.alert-info    { background: #eff6ff; color: #1d4ed8; border-color: #bfdbfe; }

/* Pagination */
.pagination { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 16px; }
.page-btn { padding: 5px 10px; border: 1px solid var(--border); border-radius: 6px;
  font-size: 13px; cursor: pointer; background: var(--surface); color: var(--text); }
.page-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.page-btn:hover:not(.active) { background: var(--bg); }

/* Expiry groups */
.server-group { margin-bottom: 12px; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.server-group-header { display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px; background: var(--bg); cursor: pointer; user-select: none;
  gap: 8px; }
.server-group-header:hover { background: #f1f5f9; }
.server-group-name { font-weight: 600; font-size: 13.5px; display: flex; align-items: center; gap: 8px; }
.server-group-body { border-top: 1px solid var(--border); }
.domain-row { display: flex; align-items: center; justify-content: space-between;
  padding: 8px 14px; border-bottom: 1px solid var(--border); }
.domain-row:last-child { border-bottom: none; }
.domain-row:hover { background: #f8fafc; }
.domain-name { font-size: 13px; word-break: break-all; flex: 1; min-width: 0; }

/* Login page */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--bg); }
.login-box  { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 32px; width: 100%; max-width: 380px; box-shadow: var(--shadow-lg); }
.login-logo { text-align: center; margin-bottom: 24px; }
.login-logo span { font-size: 20px; font-weight: 700; }

/* Utilities */
.hidden  { display: none !important; }
.flex    { display: flex; }
.items-center { align-items: center; }
.gap-8   { gap: 8px; }
.gap-12  { gap: 12px; }
.mt-4    { margin-top: 4px; }
.mt-8    { margin-top: 8px; }
.mt-16   { margin-top: 16px; }
.mb-16   { margin-bottom: 16px; }
.text-muted { color: var(--text-muted); }
.text-sm { font-size: 12px; }
.text-center { text-align: center; }
.w-full  { width: 100%; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

@media (max-width: 768px) {
  .stats-grid { grid-template-columns: 1fr; }
  .form-row   { grid-template-columns: 1fr; }
  .whois-grid { grid-template-columns: 1fr; }
  .admin-sidebar { display: none; }
  .admin-content { padding: 16px; }
  .sidebar-mobile-toggle { display: flex !important; }
}
