/* 闲鱼自动发货系统 - 现代管理后台 UI（参考闲鱼自动回复管理系统） */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
    --bg: #f8fafc;
    --bg-card: #ffffff;
    --bg-sidebar: #ffffff;
    --bg-hover: #f1f5f9;
    --bg-active: #eff6ff;
    --border: #e2e8f0;
    --border-light: #f1f5f9;
    --text: #0f172a;
    --text-secondary: #334155;
    --text-muted: #64748b;
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --primary-light: #eff6ff;
    --success: #059669;
    --success-light: #ecfdf5;
    --warning: #d97706;
    --warning-light: #fffbeb;
    --danger: #dc2626;
    --danger-light: #fef2f2;
    --info: #0891b2;
    --info-light: #ecfeff;
    --purple: #7c3aed;
    --purple-light: #f5f3ff;
    --radius: 12px;
    --radius-lg: 16px;
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
    --shadow: 0 1px 3px rgba(15, 23, 42, 0.08), 0 1px 2px rgba(15, 23, 42, 0.04);
    --shadow-md: 0 4px 6px -1px rgba(15, 23, 42, 0.08), 0 2px 4px -2px rgba(15, 23, 42, 0.05);
    --font: "Inter", "PingFang SC", "Microsoft YaHei", sans-serif;
    --sidebar-width: 256px;
}

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

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

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

code {
    background: var(--bg-hover);
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 0.85em;
    color: var(--text-secondary);
    font-family: ui-monospace, monospace;
}

/* Layout */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 200;
    transition: transform 0.25s ease;
}

.brand {
    padding: 20px 20px 16px;
    display: flex;
    gap: 12px;
    align-items: center;
}

.brand-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 20px;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
}

.brand strong { display: block; font-size: 15px; font-weight: 600; color: var(--text); }
.brand small { color: var(--text-muted); font-size: 12px; }

.nav-menu { flex: 1; padding: 8px 12px; overflow-y: auto; }

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    color: var(--text-muted);
    border-radius: 8px;
    margin-bottom: 2px;
    transition: all 0.15s;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
}

.nav-item:hover {
    background: var(--bg-hover);
    color: var(--text);
    text-decoration: none;
}

.nav-item.active {
    background: var(--bg-active);
    color: var(--primary);
}

.nav-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    opacity: 0.7;
}

.nav-item.active .nav-icon { opacity: 1; }

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    color: var(--text-muted);
    background: var(--bg);
}

.sidebar-footer a {
    color: var(--text-muted);
    font-size: 13px;
}

.sidebar-footer a:hover { color: var(--danger); }

.main-wrapper {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.topbar {
    height: 64px;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.topbar-left { display: flex; align-items: center; gap: 12px; }

.menu-toggle {
    display: none;
    width: 36px;
    height: 36px;
    border: 1px solid var(--border);
    background: var(--bg-card);
    border-radius: 8px;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
}

.topbar-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 13px;
    color: var(--text-muted);
}

.status-dot {
    width: 8px;
    height: 8px;
    background: var(--success);
    border-radius: 50%;
    display: inline-block;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.main-content {
    flex: 1;
    padding: 28px 32px 40px;
    max-width: 1440px;
}

/* Page */
.page-header { margin-bottom: 24px; }

.page-header h1 {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 4px;
    color: var(--text);
}

.page-header p { color: var(--text-muted); font-size: 14px; }

/* Cards */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    margin-bottom: 24px;
    box-shadow: var(--shadow-sm);
}

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

.card-header h3 { font-size: 15px; font-weight: 600; color: var(--text); }

.card-body { padding: 20px; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }

/* Stats */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    display: flex;
    align-items: flex-start;
    gap: 16px;
    box-shadow: var(--shadow-sm);
    transition: box-shadow 0.2s, transform 0.2s;
}

.stat-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-icon svg { width: 24px; height: 24px; }

.stat-icon-blue { background: var(--primary-light); color: var(--primary); }
.stat-icon-green { background: var(--success-light); color: var(--success); }
.stat-icon-amber { background: var(--warning-light); color: var(--warning); }
.stat-icon-cyan { background: var(--info-light); color: var(--info); }
.stat-icon-purple { background: var(--purple-light); color: var(--purple); }
.stat-icon-slate { background: var(--bg-hover); color: var(--text-muted); }

.stat-body { flex: 1; min-width: 0; }

.stat-label {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 4px;
    font-weight: 500;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    line-height: 1.2;
    color: var(--text);
}

.stat-sub { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* Forms */
.form-group { margin-bottom: 16px; }

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 6px;
    color: var(--text-secondary);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-size: 14px;
    font-family: var(--font);
    transition: border-color 0.15s, box-shadow 0.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(37, 99, 235, 0.12);
}

.form-group input::placeholder,
.form-group textarea::placeholder { color: #94a3b8; }

.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 16px; }

.hint { font-size: 12px; color: var(--text-muted); margin-top: 6px; }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 9px 18px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    font-family: var(--font);
    cursor: pointer;
    transition: all 0.15s;
    text-decoration: none;
}

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); color: #fff; }

.btn-block { width: 100%; }

.btn-lg { padding: 12px 24px; font-size: 15px; }

.btn-sm { padding: 6px 12px; font-size: 12px; }

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

.btn-ghost:hover {
    background: var(--bg-hover);
    color: var(--text);
    border-color: #cbd5e1;
}

.btn-danger {
    background: var(--danger-light);
    color: var(--danger);
    border: 1px solid #fecaca;
}

.btn-danger:hover { background: var(--danger); color: #fff; border-color: var(--danger); }

/* Table */
.table-wrap { overflow-x: auto; }

.data-table { width: 100%; border-collapse: collapse; font-size: 14px; }

.data-table th {
    text-align: left;
    padding: 12px 16px;
    font-size: 12px;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
    font-weight: 500;
    background: var(--bg);
}

.data-table td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-light);
    color: var(--text-secondary);
}

.data-table tr:last-child td { border-bottom: none; }

.data-table tr:hover td { background: var(--bg); }

.empty { text-align: center; color: var(--text-muted); padding: 40px; }

.text-truncate {
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 9999px;
    font-size: 12px;
    font-weight: 500;
}

.badge-success { background: var(--success-light); color: var(--success); }
.badge-warning { background: var(--warning-light); color: var(--warning); }
.badge-info { background: var(--info-light); color: var(--info); }
.badge-gray { background: var(--bg-hover); color: var(--text-muted); }
.badge-paid { background: var(--primary-light); color: var(--primary); }
.badge-completed { background: var(--success-light); color: var(--success); }
.badge-refunding { background: var(--danger-light); color: var(--danger); }

/* Alerts */
.alert {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 14px;
}

.alert-success { background: var(--success-light); border: 1px solid #a7f3d0; color: var(--success); }
.alert-error { background: var(--danger-light); border: 1px solid #fecaca; color: var(--danger); }
.alert-info { background: var(--primary-light); border: 1px solid #bfdbfe; color: var(--primary); }

/* Login */
.page-login {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #eff6ff 0%, #f8fafc 50%, #f1f5f9 100%);
}

.login-wrap { width: 100%; max-width: 420px; padding: 20px; }

.login-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 40px 36px;
    box-shadow: var(--shadow-md);
}

.login-header { text-align: center; margin-bottom: 32px; }

.login-logo {
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    font-size: 28px;
    color: #fff;
    box-shadow: 0 8px 24px rgba(37, 99, 235, 0.3);
}

.login-header h1 { font-size: 22px; margin-bottom: 4px; font-weight: 700; }
.login-header p { color: var(--text-muted); font-size: 14px; }

.login-hint { text-align: center; margin-top: 20px; font-size: 12px; color: var(--text-muted); }

/* Misc */
.filter-bar { display: flex; gap: 8px; margin-bottom: 20px; flex-wrap: wrap; }

.filter-btn {
    padding: 8px 16px;
    border-radius: 9999px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 13px;
    text-decoration: none;
    transition: all 0.15s;
    font-weight: 500;
}

.filter-btn:hover,
.filter-btn.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
    text-decoration: none;
}

.quick-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.quick-btn {
    padding: 16px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    transition: all 0.15s;
    text-decoration: none;
}

.quick-btn:hover {
    border-color: var(--primary);
    background: var(--primary-light);
    color: var(--primary);
    text-decoration: none;
}

.guide-steps .step {
    padding: 12px 0;
    border-bottom: 1px solid var(--border-light);
    font-size: 14px;
    color: var(--text-secondary);
}

.guide-steps .step span {
    display: inline-block;
    width: 24px;
    height: 24px;
    line-height: 24px;
    text-align: center;
    background: var(--primary-light);
    color: var(--primary);
    border-radius: 50%;
    font-size: 12px;
    font-weight: 600;
    margin-right: 10px;
}

.copy-box {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
}

.copy-box code { flex: 1; font-size: 13px; background: transparent; padding: 0; }

.pool-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }

.pool-card {
    padding: 16px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    text-decoration: none;
    color: var(--text);
    transition: all 0.15s;
}

.pool-card:hover,
.pool-card.active {
    border-color: var(--primary);
    background: var(--primary-light);
    text-decoration: none;
}

.pool-name { font-weight: 600; margin-bottom: 8px; color: var(--text); }
.pool-available { font-size: 24px; font-weight: 700; color: var(--success); }

.link { font-size: 13px; color: var(--primary); font-weight: 500; }
.link:hover { color: var(--primary-hover); }

.actions { white-space: nowrap; }

.card-highlight {
    border-color: #bfdbfe;
    background: linear-gradient(135deg, var(--primary-light), var(--bg-card));
}

.copy-box-lg { flex-wrap: wrap; gap: 8px; }
.copy-box-lg code { flex: 1; min-width: 200px; word-break: break-all; }

.share-textarea {
    flex: 1;
    min-width: 100%;
    min-height: 120px;
    background: var(--bg);
    border: none;
    color: var(--text);
    font-size: 13px;
    line-height: 1.6;
    resize: vertical;
    font-family: var(--font);
}

.auth-tips {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 12px;
}

.auth-tips code { font-size: 11px; }

.delivery-mode-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }

.mode-option {
    display: block;
    padding: 16px;
    border: 2px solid var(--border);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.15s;
    background: var(--bg-card);
}

.mode-option input { margin-right: 8px; }

.mode-option.active {
    border-color: var(--primary);
    background: var(--primary-light);
}

.mode-option strong { display: block; margin-bottom: 6px; color: var(--text); }
.mode-option small { color: var(--text-muted); font-size: 12px; }

.preview-phone {
    background: #1e293b;
    border-radius: 16px;
    padding: 16px;
    max-width: 320px;
    box-shadow: var(--shadow-md);
}

.preview-phone-header { font-size: 12px; color: #94a3b8; margin-bottom: 12px; text-align: center; }

.preview-bubble {
    background: #3b82f6;
    color: #fff;
    padding: 12px 14px;
    border-radius: 12px 12px 12px 4px;
    font-size: 14px;
    line-height: 1.6;
    word-break: break-word;
}

details.card { border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--bg-card); box-shadow: var(--shadow-sm); }
details.card summary { list-style: none; }
details.card summary::-webkit-details-marker { display: none; }
.form-inline-bind { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.form-inline-bind .form-group { flex: 1; min-width: 240px; }
.inline-form { display: inline; }

/* Sidebar overlay (mobile) */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.4);
    z-index: 150;
    backdrop-filter: blur(2px);
}

/* Responsive */
@media (max-width: 1024px) {
    .stat-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 900px) {
    .grid-2 { grid-template-columns: 1fr; }
    .delivery-mode-grid { grid-template-columns: 1fr; }

    .menu-toggle { display: flex; }

    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
        box-shadow: var(--shadow-md);
    }

    .sidebar-overlay.show { display: block; }

    .main-wrapper { margin-left: 0; }

    .main-content { padding: 20px 16px 32px; }
    .topbar { padding: 0 16px; }
}

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