/* WhatsApp 短链接系统 - 样式 */
:root {
    --bg: #0b1220;
    --bg-soft: #111827;
    --card: #151c2c;
    --border: #243044;
    --text: #e5eefb;
    --muted: #8b9bb4;
    --primary: #25d366;
    --primary-hover: #1ebe57;
    --primary-text: #062812;
    --danger: #ef4444;
    --danger-hover: #dc2626;
    --secondary: #1e293b;
    --secondary-hover: #334155;
    --input-bg: #0f172a;
    --focus: rgba(37, 211, 102, 0.35);
    --radius: 12px;
    --shadow: 0 10px 40px rgba(0, 0, 0, 0.35);
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC",
        "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font);
    background: radial-gradient(1200px 600px at 10% -10%, #163024 0%, transparent 50%),
                radial-gradient(900px 500px at 100% 0%, #1a2744 0%, transparent 45%),
                var(--bg);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.5;
}

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

a:hover {
    text-decoration: underline;
}

/* ========== 登录页 ========== */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.login-card {
    width: 100%;
    max-width: 400px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 36px 32px;
    box-shadow: var(--shadow);
}

.login-brand {
    text-align: center;
    margin-bottom: 28px;
}

.logo {
    width: 56px;
    height: 56px;
    margin: 0 auto 14px;
    border-radius: 16px;
    background: linear-gradient(135deg, #25d366, #128c7e);
    color: #fff;
    font-weight: 800;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    letter-spacing: 0.5px;
    box-shadow: 0 8px 24px rgba(37, 211, 102, 0.3);
}

.login-brand h1 {
    margin: 0 0 6px;
    font-size: 22px;
    font-weight: 700;
}

.login-brand p {
    margin: 0;
    color: var(--muted);
    font-size: 14px;
}

.login-form label {
    display: block;
    margin-bottom: 8px;
    font-size: 13px;
    color: var(--muted);
}

.login-form input {
    width: 100%;
    margin-bottom: 18px;
}

/* ========== 顶栏 ========== */
.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    background: rgba(11, 18, 32, 0.85);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
}

.topbar-inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.logo-sm {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: linear-gradient(135deg, #25d366, #128c7e);
    color: #fff;
    font-size: 11px;
    font-weight: 800;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* 顶部双按钮菜单 */
.nav-menu {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 5px;
    background: linear-gradient(180deg, rgba(30, 41, 59, 0.95), rgba(15, 23, 42, 0.95));
    border: 1px solid rgba(51, 65, 85, 0.9);
    border-radius: 14px;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.04),
        0 4px 16px rgba(0, 0, 0, 0.25);
    flex: 0 1 auto;
    margin: 0 auto;
}

.nav-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-width: 132px;
    padding: 10px 18px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.02em;
    color: #94a3b8;
    background: transparent;
    border: 1px solid transparent;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
    transition:
        background 0.18s ease,
        color 0.18s ease,
        border-color 0.18s ease,
        box-shadow 0.18s ease,
        transform 0.12s ease;
}

.nav-btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 7px;
    background: rgba(148, 163, 184, 0.12);
    color: inherit;
    transition: background 0.18s ease, color 0.18s ease;
}

.nav-btn-icon svg {
    display: block;
}

.nav-btn-text {
    line-height: 1;
}

.nav-btn:hover {
    color: #e2e8f0;
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(148, 163, 184, 0.18);
    text-decoration: none;
}

.nav-btn:hover .nav-btn-icon {
    background: rgba(148, 163, 184, 0.2);
}

.nav-btn:active {
    transform: scale(0.97);
}

/* 选中态：实心按钮 */
.nav-btn.active {
    color: #052e16;
    background: linear-gradient(180deg, #34d399 0%, #25d366 55%, #1ebe57 100%);
    border-color: rgba(255, 255, 255, 0.18);
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.25) inset,
        0 6px 16px rgba(37, 211, 102, 0.35);
}

.nav-btn.active .nav-btn-icon {
    background: rgba(5, 46, 22, 0.15);
    color: #052e16;
}

.nav-btn.active:hover {
    color: #052e16;
    background: linear-gradient(180deg, #4ade80 0%, #25d366 55%, #16a34a 100%);
    text-decoration: none;
}

.nav-btn.active:active {
    transform: scale(0.97);
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.2) inset,
        0 3px 10px rgba(37, 211, 102, 0.28);
}

@media (max-width: 640px) {
    .topbar-inner {
        justify-content: center;
    }

    .nav-menu {
        order: 3;
        width: 100%;
        justify-content: stretch;
    }

    .nav-btn {
        flex: 1;
        min-width: 0;
        padding: 10px 12px;
    }

    .brand {
        margin-right: auto;
    }
}

/* ========== 布局 ========== */
.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 24px 20px 48px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
}

.card-head {
    margin-bottom: 20px;
}

.card-head h2 {
    margin: 0 0 6px;
    font-size: 18px;
    font-weight: 700;
}

.card-head.row-between {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.muted {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
}

.muted strong {
    color: var(--text);
}

/* ========== 表单 ========== */
.form-grid {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.field label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 600;
}

.required {
    color: #f87171;
}

.optional {
    color: var(--muted);
    font-weight: 400;
    font-size: 12px;
}

.hint {
    margin: 0 0 10px;
    color: var(--muted);
    font-size: 12px;
}

input[type="text"],
input[type="password"],
textarea {
    width: 100%;
    background: var(--input-bg);
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: 10px;
    padding: 11px 14px;
    font-size: 14px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
}

input:focus,
textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--focus);
}

textarea {
    resize: vertical;
    min-height: 80px;
}

.phone-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 10px;
}

.phone-row {
    display: flex;
    gap: 8px;
    align-items: center;
}

.phone-row input {
    flex: 1;
}

.form-actions {
    padding-top: 4px;
}

/* ========== 按钮 ========== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border: none;
    border-radius: 10px;
    padding: 10px 18px;
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.15s, transform 0.1s, opacity 0.15s;
    text-decoration: none;
    white-space: nowrap;
}

.btn:active {
    transform: scale(0.98);
}

.btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--primary);
    color: var(--primary-text);
}

.btn-primary:hover:not(:disabled) {
    background: var(--primary-hover);
}

.btn-secondary {
    background: var(--secondary);
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--secondary-hover);
}

.btn-danger {
    background: rgba(239, 68, 68, 0.15);
    color: #fca5a5;
    border: 1px solid rgba(239, 68, 68, 0.35);
}

.btn-danger:hover:not(:disabled) {
    background: rgba(239, 68, 68, 0.28);
}

.btn-ghost {
    background: transparent;
    color: var(--muted);
    border: 1px solid transparent;
}

.btn-ghost:hover:not(:disabled) {
    color: var(--text);
    background: rgba(255, 255, 255, 0.05);
}

.btn-block {
    width: 100%;
}

.btn-sm {
    padding: 7px 12px;
    font-size: 13px;
    border-radius: 8px;
}

.btn-xs {
    padding: 4px 8px;
    font-size: 12px;
    border-radius: 6px;
}

.btn-icon {
    width: 40px;
    height: 40px;
    padding: 0;
    font-size: 20px;
    line-height: 1;
    flex-shrink: 0;
}

/* ========== 结果框 ========== */
.result-box {
    margin-top: 22px;
    padding: 16px;
    border-radius: 12px;
    background: rgba(37, 211, 102, 0.08);
    border: 1px solid rgba(37, 211, 102, 0.3);
}

.result-box.hidden {
    display: none;
}

.result-label {
    font-size: 13px;
    color: var(--primary);
    font-weight: 600;
    margin-bottom: 10px;
}

.result-row {
    display: flex;
    gap: 8px;
}

.result-row input {
    flex: 1;
    background: var(--input-bg);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    color: #86efac;
}

/* ========== 表格 ========== */
.table-wrap {
    overflow-x: auto;
    margin: 0 -4px;
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    min-width: 720px;
}

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

.table th {
    color: var(--muted);
    font-weight: 600;
    font-size: 12px;
    text-transform: none;
    white-space: nowrap;
}

.table tbody tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

.table .empty-row td {
    text-align: center;
    color: var(--muted);
    padding: 36px 12px;
}

.short-link {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 12px;
    word-break: break-all;
    margin-right: 6px;
}

.phone-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.tag {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    background: var(--secondary);
    border: 1px solid var(--border);
    font-size: 11px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    color: #cbd5e1;
}

.msg-cell {
    max-width: 180px;
    color: var(--muted);
}

.nowrap {
    white-space: nowrap;
}

/* ========== 提示 ========== */
.alert {
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 13px;
    margin-bottom: 16px;
}

.alert-error {
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.35);
    color: #fca5a5;
}

.toast {
    position: fixed;
    left: 50%;
    bottom: 28px;
    transform: translateX(-50%) translateY(20px);
    background: #1f2937;
    color: #fff;
    padding: 10px 18px;
    border-radius: 999px;
    font-size: 13px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s, transform 0.2s;
    z-index: 100;
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.toast.ok {
    border-color: rgba(37, 211, 102, 0.4);
}

.toast.err {
    border-color: rgba(239, 68, 68, 0.45);
}

/* ========== 响应式 ========== */
@media (max-width: 640px) {
    .login-card {
        padding: 28px 20px;
    }

    .card {
        padding: 18px 14px;
    }

    .result-row {
        flex-direction: column;
    }

    .card-head.row-between {
        flex-direction: column;
    }
}
