/* ================================================================
   域名转发平台 - 样式表
   ================================================================ */

:root {
    --primary:     #4f6ef7;
    --primary-dark:#3a56d4;
    --success:     #22c55e;
    --danger:      #ef4444;
    --bg:          #f5f6fa;
    --surface:     #ffffff;
    --border:      #e2e8f0;
    --text:        #1e293b;
    --text-muted:  #94a3b8;
    --sidebar-bg:  #1e293b;
    --sidebar-w:   220px;
    --radius:      8px;
    --shadow:      0 1px 4px rgba(0,0,0,.08);
}

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

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

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
code {
    background: #f1f5f9;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: "Courier New", monospace;
    font-size: 13px;
}

/* ── 侧边栏 ──────────────────────────────────────────────────────── */
.sidebar {
    position: fixed;
    top: 0; left: 0;
    width: var(--sidebar-w);
    height: 100vh;
    background: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    z-index: 100;
    overflow: hidden;
}

.sidebar-brand {
    padding: 20px 18px 16px;
    border-bottom: 1px solid rgba(255,255,255,.07);
    flex-shrink: 0;
}

.sidebar-brand a {
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    text-decoration: none;
    display: block;
    line-height: 1.4;
}

.sidebar-nav {
    list-style: none;
    padding: 10px 8px;
    flex: 1;
    overflow-y: auto;
}

.sidebar-nav li { margin-bottom: 2px; }

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 9px 10px;
    border-radius: var(--radius);
    color: #94a3b8;
    font-size: 13.5px;
    font-weight: 500;
    text-decoration: none;
    transition: color .15s, background .15s;
    white-space: nowrap;
}

.sidebar-nav a svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.sidebar-nav a:hover { color: #fff; background: rgba(255,255,255,.07); text-decoration: none; }
.sidebar-nav a.active { color: #fff; background: var(--primary); }

.sidebar-footer {
    padding: 12px 10px;
    border-top: 1px solid rgba(255,255,255,.07);
    flex-shrink: 0;
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 7px;
    margin-bottom: 8px;
    padding: 0 2px;
}

.sidebar-username {
    color: #cbd5e1;
    font-size: 13px;
    font-weight: 500;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar-actions {
    display: flex;
    gap: 6px;
}

.sidebar-actions a {
    flex: 1;
    text-align: center;
    padding: 6px 4px;
    border-radius: 6px;
    border: 1px solid rgba(255,255,255,.2);
    color: #fff;
    font-size: 12px;
    text-decoration: none;
    transition: background .15s;
}

.sidebar-actions a:hover { background: rgba(255,255,255,.1); text-decoration: none; }

/* ── 主内容区 ─────────────────────────────────────────────────────── */
main {
    margin-left: var(--sidebar-w);
    min-height: 100vh;
}

/* ── 容器 ────────────────────────────────────────────────────────── */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px 20px;
}

/* ── 页头 ────────────────────────────────────────────────────────── */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.page-title { font-size: 20px; font-weight: 700; }

/* ── 卡片 ────────────────────────────────────────────────────────── */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    margin-bottom: 20px;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
}

.card-header h3 { font-size: 15px; font-weight: 600; }

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

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px 16px;
    box-shadow: var(--shadow);
    text-align: center;
}

.stat-value { font-size: 30px; font-weight: 700; color: var(--primary); line-height: 1.2; }
.stat-label { color: var(--text-muted); font-size: 13px; margin-top: 4px; }

/* ── 表格 ────────────────────────────────────────────────────────── */
.table { width: 100%; border-collapse: collapse; }

.table th,
.table td { padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--border); }

.table th {
    background: #f8fafc;
    font-weight: 600;
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .4px;
}

.table tbody tr:hover { background: #f8fafc; }
.table tbody tr:last-child td { border-bottom: none; }

.url-cell { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.actions  { white-space: nowrap; }

/* ── 徽章 ────────────────────────────────────────────────────────── */
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 99px;
    font-size: 12px;
    font-weight: 500;
    line-height: 1.6;
}

.badge-success { background: #dcfce7; color: #15803d; }
.badge-primary { background: #dbeafe; color: #1d4ed8; }
.badge-muted   { background: #f1f5f9; color: #64748b; }
.badge-danger  { background: #fee2e2; color: #b91c1c; }

/* ── 按钮 ────────────────────────────────────────────────────────── */
.btn {
    display: inline-block;
    padding: 8px 16px;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid transparent;
    transition: background .15s, opacity .15s;
    text-decoration: none;
    line-height: 1.4;
}

.btn:hover { opacity: .88; text-decoration: none; }
.btn-primary  { background: var(--primary); color: #fff; }
.btn-danger   { background: var(--danger);  color: #fff; }
.btn-outline  { background: transparent; border-color: var(--border); color: var(--text); }
.btn-outline:hover { background: #f1f5f9; opacity: 1; }
.btn-block    { width: 100%; text-align: center; }
.btn-sm       { padding: 4px 10px; font-size: 13px; }

/* ── 表单 ────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }

.form-group label {
    display: block;
    font-weight: 500;
    margin-bottom: 6px;
    font-size: 14px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    color: var(--text);
    background: var(--surface);
    transition: border-color .15s, box-shadow .15s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79,110,247,.15);
}

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

.form-checkboxes { display: flex; gap: 20px; flex-wrap: wrap; margin-bottom: 16px; }

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-size: 14px;
}

.checkbox-label input[type="checkbox"] { width: 16px; height: 16px; cursor: pointer; }

.form-actions { display: flex; gap: 10px; margin-top: 8px; }

/* ── 搜索栏 ──────────────────────────────────────────────────────── */
.search-form { display: flex; gap: 8px; margin-bottom: 16px; }

.search-form input {
    flex: 1;
    max-width: 360px;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
}

/* ── 分页 ────────────────────────────────────────────────────────── */
.pagination {
    display: flex;
    gap: 4px;
    justify-content: center;
    padding: 14px;
    border-top: 1px solid var(--border);
    flex-wrap: wrap;
}

.pagination a {
    display: inline-block;
    padding: 5px 10px;
    border-radius: 6px;
    font-size: 13px;
    border: 1px solid var(--border);
    color: var(--text);
}

.pagination a:hover { background: #f1f5f9; text-decoration: none; }
.pagination a.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ── 提醒消息 ────────────────────────────────────────────────────── */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 16px;
    font-size: 14px;
}

.alert-success { background: #dcfce7; color: #15803d; border: 1px solid #bbf7d0; }
.alert-error   { background: #fee2e2; color: #b91c1c; border: 1px solid #fecaca; }

/* ── 弹窗 ────────────────────────────────────────────────────────── */
.modal {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
}

.modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.4); }

.modal-box {
    position: relative;
    background: var(--surface);
    border-radius: 12px;
    padding: 28px;
    width: 100%;
    max-width: 520px;
    box-shadow: 0 8px 32px rgba(0,0,0,.18);
    max-height: 90vh;
    overflow-y: auto;
}

.modal-box h3 {
    font-size: 17px;
    font-weight: 700;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

/* ── 认证页 ──────────────────────────────────────────────────────── */
.auth-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.auth-box {
    background: var(--surface);
    border-radius: 16px;
    padding: 36px 32px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 16px 48px rgba(0,0,0,.2);
}

.auth-box h1 { font-size: 22px; font-weight: 700; text-align: center; margin-bottom: 6px; }
.auth-box .subtitle { text-align: center; color: var(--text-muted); font-size: 13px; margin-bottom: 20px; }

.auth-tabs { display: flex; border-bottom: 2px solid var(--border); margin-bottom: 20px; }

.auth-tabs a {
    flex: 1;
    text-align: center;
    padding: 10px;
    color: var(--text-muted);
    font-weight: 500;
    text-decoration: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: color .15s;
}

.auth-tabs a.active { color: var(--primary); border-bottom-color: var(--primary); }

/* ── 工具类 ──────────────────────────────────────────────────────── */
.text-center { text-align: center; }
.text-muted  { color: var(--text-muted); font-size: 12px; }

/* ── 响应式 ──────────────────────────────────────────────────────── */
@media (max-width: 768px) {
    :root { --sidebar-w: 56px; }
    .sidebar-brand a,
    .sidebar-nav a span,
    .sidebar-username,
    .sidebar-actions a span,
    .sidebar-user .badge { display: none; }
    .sidebar-nav a { justify-content: center; padding: 10px; gap: 0; }
    .sidebar-actions a { padding: 6px; }
    .container { padding: 16px 12px; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .form-row { grid-template-columns: 1fr; }
    .modal-box { margin: 12px; padding: 20px; }
}
