/* ═══════════════════════════════════════════════════════════
   QRCode System — 深色商务主题样式
   配色：深蓝黑底 + 青色强调色
═══════════════════════════════════════════════════════════ */

:root {
    --bg-primary:    #0B0F1A;
    --bg-secondary:  #111827;
    --bg-tertiary:   #1A2234;
    --bg-card:       #141D2E;
    --accent:        #06B6D4;
    --accent-dark:   #0891B2;
    --accent-glow:   rgba(6, 182, 212, 0.15);
    --accent-border: rgba(6, 182, 212, 0.35);
    --text-primary:  #F1F5F9;
    --text-secondary:#94A3B8;
    --text-muted:    #475569;
    --border:        #1E293B;
    --border-light:  #2D3B50;
    --success:       #10B981;
    --error:         #EF4444;
    --warning:       #F59E0B;
    --shadow:        0 4px 24px rgba(0,0,0,0.4);
    --radius:        10px;
    --radius-sm:     6px;
}

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

body {
    background: var(--bg-primary);
    color: var(--text-primary);
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    font-size: 14px;
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ── 通用过渡 ─────────────────────────────────────────── */
a, button, input, .card { transition: all 0.2s ease; }

/* ── 滚动条 ──────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ── 动画 ────────────────────────────────────────────── */
@keyframes fadeUp {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}
@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50%       { transform: scale(1.05); }
}
@keyframes spin {
    to { transform: rotate(360deg); }
}
@keyframes slideDown {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
}

.animate-fade-up  { animation: fadeUp 0.45s ease both; }
.animate-fade-in  { animation: fadeIn 0.3s ease both; }
.animate-slide-down { animation: slideDown 0.25s ease both; }

/* ── 顶部导航 ─────────────────────────────────────────── */
.site-header {
    background: rgba(17, 24, 39, 0.9);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}
.header-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
    height: 60px;
    display: flex;
    align-items: center;
    gap: 32px;
}
.header-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    text-decoration: none;
    flex-shrink: 0;
}
.header-nav {
    display: flex;
    gap: 4px;
    flex: 1;
}
.nav-link {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.15s;
}
.nav-link:hover, .nav-link.active {
    background: var(--accent-glow);
    color: var(--accent);
}
.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-left: auto;
}
.user-badge {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 13px;
    color: var(--text-secondary);
    padding: 4px 10px;
    background: var(--bg-tertiary);
    border-radius: 20px;
    border: 1px solid var(--border);
}
.user-badge.guest { opacity: 0.6; }

/* ── 主内容区 ─────────────────────────────────────────── */
.page-main {
    flex: 1;
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    padding: 32px 24px 48px;
}

/* ── 页面标题栏 ───────────────────────────────────────── */
.page-title-bar {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 28px;
    gap: 20px;
    flex-wrap: wrap;
}
.page-title {
    font-size: 26px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.3;
}
.page-subtitle {
    font-size: 14px;
    color: var(--text-secondary);
    margin-top: 4px;
}
.stat-cards {
    display: flex;
    gap: 12px;
    flex-shrink: 0;
}
.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 24px;
    text-align: center;
    min-width: 100px;
}
.stat-num {
    font-size: 28px;
    font-weight: 700;
    color: var(--accent);
    line-height: 1;
}
.stat-label {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
    font-weight: 500;
}

/* ── 卡片 ─────────────────────────────────────────────── */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}
.card-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 18px 24px;
    border-bottom: 1px solid var(--border);
}
.card-title svg { color: var(--accent); flex-shrink: 0; }
.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    border-bottom: 1px solid var(--border);
    gap: 16px;
    flex-wrap: wrap;
}
.card-header .card-title {
    padding: 0;
    border: none;
    flex-shrink: 0;
}
.card-header .badge {
    background: var(--accent-glow);
    color: var(--accent);
    font-size: 12px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 20px;
    border: 1px solid var(--accent-border);
}

/* ── 新建卡片 ─────────────────────────────────────────── */
.create-card {
    margin-bottom: 20px;
    padding: 0;
}
.create-form {
    padding: 20px 24px 24px;
}
.form-row {
    display: flex;
    gap: 16px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}
.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
    min-width: 180px;
}
.form-group label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}
.label-hint {
    font-weight: 400;
    color: var(--text-muted);
    font-size: 12px;
}
.field-hint {
    font-size: 12px;
    color: var(--text-muted);
    min-height: 16px;
}
.field-hint.ok  { color: var(--success); }
.field-hint.err { color: var(--error); }

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

.input-prefix-wrap {
    display: flex;
    align-items: center;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
    transition: border-color 0.15s;
}
.input-prefix-wrap:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}
.input-prefix {
    padding: 0 12px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    font-size: 13px;
    color: var(--text-muted);
    white-space: nowrap;
    line-height: 40px;
    height: 40px;
    user-select: none;
}
.prefix-input {
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    background: transparent !important;
    flex: 1;
}

/* ── 按钮 ─────────────────────────────────────────────── */
.btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
    font-family: inherit;
}
.btn-primary:hover { background: var(--accent-dark); }
.btn-primary:active { transform: scale(0.98); }
.btn-primary:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-primary.btn-block { width: 100%; justify-content: center; }

.btn-secondary {
    display: inline-flex; align-items: center; gap: 6px;
    background: var(--bg-tertiary); color: var(--text-primary);
    border: 1px solid var(--border-light); border-radius: var(--radius-sm);
    padding: 8px 16px; font-size: 14px; font-weight: 500; cursor: pointer;
    font-family: inherit;
}
.btn-secondary:hover { background: var(--border); }

.btn-ghost {
    display: inline-flex; align-items: center; gap: 5px;
    background: transparent; color: var(--text-secondary);
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    padding: 6px 12px; font-size: 13px; font-weight: 500; cursor: pointer;
    font-family: inherit;
}
.btn-ghost:hover { background: var(--bg-tertiary); color: var(--text-primary); border-color: var(--border-light); }

.btn-icon {
    display: inline-flex; align-items: center; justify-content: center;
    background: transparent; border: none; cursor: pointer;
    color: var(--text-muted); padding: 6px; border-radius: var(--radius-sm);
    transition: all 0.15s;
}
.btn-icon:hover { background: var(--bg-tertiary); color: var(--text-primary); }
.btn-icon.btn-delete:hover { background: rgba(239,68,68,0.12); color: var(--error); }
.btn-icon.btn-qr:hover { background: var(--accent-glow); color: var(--accent); }
.btn-icon.btn-edit:hover { background: rgba(245,158,11,0.12); color: var(--warning); }
.btn-icon.btn-save { color: var(--success); }
.btn-icon.btn-save:hover { background: rgba(16,185,129,0.12); }
.btn-icon.btn-cancel { color: var(--text-muted); }

/* ── 输入框 ───────────────────────────────────────────── */
.input-field {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
    width: 100%;
    box-sizing: border-box;
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.input-field::placeholder { color: var(--text-muted); }
.input-field:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}
.input-field:disabled {
    opacity: 0.5; cursor: not-allowed;
}

/* ── 警告框 ──────────────────────────────────────────── */
.alert {
    padding: 10px 14px; border-radius: var(--radius-sm);
    font-size: 13px; margin-bottom: 16px; border: 1px solid;
    animation: fadeIn 0.2s ease;
}
.alert-error { background: rgba(239,68,68,0.1); border-color: rgba(239,68,68,0.3); color: #FCA5A5; }

/* ── 登录页 ──────────────────────────────────────────── */
.login-card {
    max-width: 400px;
    margin: 60px auto;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 40px;
    text-align: center;
    animation: fadeUp 0.4s ease;
}
.login-icon {
    width: 70px; height: 70px;
    background: var(--accent-glow);
    border: 1px solid var(--accent-border);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    margin: 0 auto 20px;
}
.login-card h2 {
    font-size: 20px; font-weight: 700; color: var(--text-primary); margin-bottom: 6px;
}
.login-desc { font-size: 14px; color: var(--text-secondary); margin-bottom: 24px; }
.login-form { display: flex; flex-direction: column; gap: 12px; text-align: left; }
.login-hint {
    font-size: 12px; color: var(--text-muted); margin-top: 14px;
}
.login-hint code {
    background: var(--bg-tertiary); padding: 2px 6px;
    border-radius: 4px; color: var(--accent); font-family: monospace;
}

/* ── 结果展示 ─────────────────────────────────────────── */
.result-box {
    border-top: 1px solid var(--border);
    padding: 20px 24px;
    animation: fadeUp 0.35s ease;
}
.result-split {
    display: flex;
    gap: 32px;
    align-items: center;
    flex-wrap: wrap;
}
.result-label {
    font-size: 12px; font-weight: 600; color: var(--text-muted);
    text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 6px;
}
.result-url-row {
    display: flex; align-items: center; gap: 8px;
}
.result-url {
    font-size: 15px; color: var(--accent); font-weight: 600;
    text-decoration: none; word-break: break-all;
}
.result-url:hover { text-decoration: underline; }
.result-qr canvas, .result-qr img {
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    background: #fff; /* 二维码需要白色背景 */
}
.result-qr canvas { display: block; }

/* ── 表格 ─────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.data-table th {
    padding: 12px 16px;
    text-align: left;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
.data-table td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tbody tr {
    transition: background 0.1s;
}
.data-table tbody tr:hover { background: rgba(6,182,212,0.04); }

.code-link {
    display: inline-flex; align-items: center; gap: 4px;
    color: var(--accent); font-weight: 600; font-size: 14px;
    text-decoration: none; font-family: 'Courier New', monospace;
}
.code-link:hover { text-decoration: underline; }
.code-link svg { opacity: 0.5; flex-shrink: 0; }

.url-cell { max-width: 400px; }
.url-text {
    display: block;
    color: var(--text-secondary);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    font-size: 13px;
}
.edit-url-input {
    padding: 6px 10px !important;
    font-size: 13px !important;
    width: 100%;
}

.scan-badge {
    display: inline-block;
    background: var(--accent-glow);
    color: var(--accent);
    font-weight: 700;
    font-size: 13px;
    padding: 3px 10px;
    border-radius: 20px;
    border: 1px solid var(--accent-border);
    min-width: 44px;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

.action-btns {
    display: flex; align-items: center; gap: 2px; justify-content: flex-end;
}

.empty-state {
    text-align: center; padding: 60px 20px !important; color: var(--text-muted);
}
.empty-state svg { display: block; margin: 0 auto 12px; opacity: 0.4; }
.empty-state p { font-size: 14px; line-height: 1.8; }
.empty-state span { font-size: 13px; opacity: 0.7; }

/* ── 搜索框 ──────────────────────────────────────────── */
.search-wrap {
    position: relative;
    display: flex;
    align-items: center;
}
.search-icon {
    position: absolute; left: 12px;
    color: var(--text-muted); pointer-events: none;
}
.search-input {
    padding-left: 36px !important;
    width: 260px; font-size: 13px;
}

/* ── 徽章 ─────────────────────────────────────────────── */
.badge {
    display: inline-flex; align-items: center;
    background: var(--accent-glow); color: var(--accent);
    font-size: 11px; font-weight: 700; padding: 2px 8px;
    border-radius: 20px; border: 1px solid var(--accent-border);
}

/* ── 文本辅助 ─────────────────────────────────────────── */
.text-center { text-align: center !important; }
.text-right  { text-align: right !important; }
.text-muted  { color: var(--text-muted); font-size: 12px; }
.flex-grow   { flex: 2 !important; }

/* ── 弹窗 ─────────────────────────────────────────────── */
.modal-overlay {
    display: none; position: fixed; inset: 0;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(4px);
    z-index: 1000;
    align-items: center; justify-content: center;
    animation: fadeIn 0.2s ease;
}
.modal-overlay.active { display: flex; }
.modal-box {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    box-shadow: 0 20px 60px rgba(0,0,0,0.6);
    width: 320px;
    animation: fadeUp 0.3s ease;
    overflow: hidden;
}
.modal-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}
.modal-header h3 { font-size: 15px; font-weight: 600; }
.modal-body {
    padding: 24px 20px;
    display: flex; flex-direction: column; align-items: center; gap: 16px;
}
.qr-display { display: flex; align-items: center; justify-content: center; }
.qr-display canvas, .qr-display img {
    border-radius: var(--radius-sm);
    background: #fff;
}
.btn-download {
    width: 100%; justify-content: center;
}

/* ── Toast ────────────────────────────────────────────── */
#toast {
    position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(80px);
    background: var(--bg-card); border: 1px solid var(--border-light);
    border-radius: var(--radius-sm); padding: 10px 20px;
    font-size: 13px; font-weight: 500; color: var(--text-primary);
    box-shadow: 0 8px 24px rgba(0,0,0,0.4); z-index: 9999;
    transition: transform 0.3s ease; pointer-events: none;
    display: flex; align-items: center; gap: 8px;
}
#toast.show { transform: translateX(-50%) translateY(0); }
#toast.success { border-color: rgba(16,185,129,0.4); }
#toast.error   { border-color: rgba(239,68,68,0.4); }
#toast .dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
#toast.success .dot { background: var(--success); }
#toast.error .dot   { background: var(--error); }

/* ── Footer ───────────────────────────────────────────── */
.site-footer {
    text-align: center;
    padding: 20px;
    font-size: 12px;
    color: var(--text-muted);
    border-top: 1px solid var(--border);
    margin-top: auto;
}

/* ── 响应式 ──────────────────────────────────────────── */
@media (max-width: 768px) {
    .header-inner { padding: 0 16px; gap: 16px; }
    .header-nav { display: none; }
    .page-main { padding: 20px 16px 40px; }
    .page-title-bar { flex-direction: column; }
    .stat-cards { width: 100%; }
    .form-row { flex-direction: column; }
    .flex-grow { flex: 1 !important; }
    .result-split { flex-direction: column; align-items: flex-start; }
    .search-input { width: 180px; }
    .data-table { font-size: 12px; }
    .data-table td, .data-table th { padding: 10px 12px; }
    .login-card { margin: 40px 16px; padding: 28px 24px; }
}
