/* =============================================
   闲鱼订单管理中心 - 亮色主题侧边栏样式
   ============================================= */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* ---------- CSS Variables ---------- */
:root {
    --bg-primary: #f8fafc;        /* 整体背景变亮 */
    --bg-card: #ffffff;           /* 卡片背景纯白 */
    --bg-card-hover: #f1f5f9;
    --bg-surface: #f1f5f9;
    --sidebar-bg: #ffffff;        /* 侧边栏背景 */
    
    --accent: #6366f1;            /* 强调色保持蓝色系/紫色系 */
    --accent-light: #818cf8;
    --accent-glow: rgba(99, 102, 241, 0.15);
    --gradient-main: linear-gradient(135deg, #4f46e5 0%, #6366f1 50%, #818cf8 100%);
    --gradient-warm: linear-gradient(135deg, #f97316 0%, #f59e0b 100%);
    
    --text-primary: #0f172a;      /* 深色文字 */
    --text-secondary: #475569;
    --text-muted: #64748b;
    
    --success: #10b981;
    --success-bg: rgba(16, 185, 129, 0.1);
    --error: #ef4444;
    --error-bg: rgba(239, 68, 68, 0.1);
    --warning: #f59e0b;
    --warning-bg: rgba(245, 158, 11, 0.1);
    
    --border: #e2e8f0;            /* 边框色调整为适合亮色模式 */
    --border-active: rgba(99, 102, 241, 0.4);
    
    --radius: 12px;
    --radius-sm: 8px;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.05);
    --shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.08);
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    
    --sidebar-width: 260px;
}

/* ---------- Reset & Base ---------- */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.6;
}


/* ---------- Auth Overlay / Modal ---------- */
.auth-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.85); /* 深色纯背景代替 blur */
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
    visibility: visible;
    transition: var(--transition);
}

.auth-overlay.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.auth-card {
    background: var(--bg-card);
    width: 100%;
    max-width: 400px;
    border-radius: calc(var(--radius) + 4px);
    padding: 32px;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
    animation: modalSlideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalSlideUp {
    from { opacity: 0; transform: translateY(20px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.auth-header {
    text-align: center;
    margin-bottom: 28px;
}

.auth-header h2 {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 6px;
}

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

.auth-input-group {
    margin-bottom: 16px;
}

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

.auth-card input {
    width: 100%;
    padding: 12px 14px;
    font-family: inherit;
    font-size: 14px;
    color: var(--text-primary);
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    outline: none;
    transition: var(--transition);
}

.auth-card input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
    background: var(--bg-card);
}

.auth-card input:disabled {
    background: var(--bg-primary);
    color: var(--text-muted);
    cursor: not-allowed;
}

.btn-primary {
    width: 100%;
    padding: 12px;
    background: var(--gradient-main);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    margin-top: 10px;
}

.btn-primary:hover:not(:disabled) {
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
    transform: translateY(-1px);
}

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

.btn-secondary {
    padding: 0 16px;
    background: var(--bg-surface);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

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

.auth-links {
    margin-top: 16px;
    text-align: center;
    font-size: 13px;
}

.auth-links a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition);
}

.auth-links a:hover {
    color: var(--accent-light);
    text-decoration: underline;
}

.auth-msg {
    margin-top: 12px;
    text-align: center;
    font-size: 13px;
    min-height: 20px;
}
.auth-msg.error { color: var(--error); }
.auth-msg.success { color: var(--success); }

/* ---------- App Layout (Sidebar + Main) ---------- */
.app-container {
    position: relative;
    z-index: 1;
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* ---------- Sidebar ---------- */
.sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 24px 16px;
    z-index: 10;
    box-shadow: var(--shadow-sm);
}

.sidebar-header {
    margin-bottom: 32px;
    padding: 0 8px;
}

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

.logo-icon {
    font-size: 32px;
    filter: drop-shadow(0 4px 6px rgba(99, 102, 241, 0.2));
}

.sidebar-header h1 {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

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

.sidebar-nav {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.sidebar-menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    text-align: left;
    transition: var(--transition);
}

.sidebar-menu-item:hover {
    background: var(--bg-surface);
    color: var(--text-primary);
}

.sidebar-menu-item.active {
    background: var(--accent-glow);
    color: var(--accent);
    font-weight: 600;
}

.sidebar-menu-item.active .menu-icon {
    transform: scale(1.1);
}

.menu-icon {
    font-size: 18px;
    transition: var(--transition);
}

.sidebar-footer {
    padding-top: 20px;
    border-top: 1px solid var(--border);
    text-align: center;
}

.header-status {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 20px;
    font-size: 12px;
    color: var(--text-secondary);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--success);
    box-shadow: 0 0 8px var(--success-bg);
}

/* ---------- Main Content Area ---------- */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    position: relative;
}

.top-header {
    height: 70px;
    padding: 0 32px;
    display: flex;
    align-items: center;
    border-bottom: 1px solid transparent;
    position: sticky;
    top: 0;
    background: rgba(248, 250, 252, 0.98); /* 不透明度调高代替 blur */
    z-index: 5;
}

.top-header .header-title {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
}

.content-wrapper {
    flex: 1;
    padding: 24px 32px;
    max-width: 1100px;
    width: 100%;
    margin: 0 auto;
}

.tab-panel {
    display: none;
    animation: fadeIn 0.35s ease;
}

.tab-panel.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.panel-header {
    margin-bottom: 24px;
}

.panel-header h2 {
    font-size: 22px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.panel-desc {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* ---------- Upload Card ---------- */
.upload-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 32px;
    box-shadow: var(--shadow);
    transition: var(--transition);
}

.upload-card:hover {
    box-shadow: var(--shadow-lg);
}

.upload-zone {
    border: 2px dashed rgba(99, 102, 241, 0.3);
    border-radius: var(--radius-sm);
    padding: 56px 24px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
    background: var(--bg-surface);
}

.upload-zone:hover {
    border-color: var(--accent);
    background: var(--accent-glow);
}

.upload-zone.drag-over {
    border-color: var(--accent);
    background: var(--accent-glow);
    transform: scale(1.02);
}

.upload-zone.has-file {
    border-color: var(--success);
    border-style: solid;
    background: var(--success-bg);
}

.upload-zone.uploading {
    pointer-events: none;
    opacity: 0.7;
}

.upload-icon {
    color: var(--accent);
    margin-bottom: 16px;
    transition: var(--transition);
}

.upload-zone:hover .upload-icon {
    transform: translateY(-4px) scale(1.1);
}

.upload-text {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.upload-hint {
    font-size: 13px;
    color: var(--text-muted);
}

.upload-file-name {
    margin-top: 16px;
    font-size: 14px;
    font-weight: 600;
    color: var(--accent);
    display: none;
}

.upload-file-name.show {
    display: block;
}

/* ---------- Submit Button ---------- */
.btn-submit {
    width: 100%;
    margin-top: 24px;
    padding: 14px 24px;
    background: var(--gradient-main);
    border: none;
    border-radius: var(--radius-sm);
    color: white;
    font-family: inherit;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.2);
}

.btn-submit:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(99, 102, 241, 0.35);
}

.btn-submit:active:not(:disabled) {
    transform: translateY(0);
}

.btn-submit:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    box-shadow: none;
}

.btn-loader {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Result Area ---------- */
.result-area {
    margin-top: 24px;
}

.result-card {
    padding: 20px 24px;
    border-radius: var(--radius-sm);
    border: 1px solid;
    background: var(--bg-card);
    animation: slideUp 0.3s ease;
    box-shadow: var(--shadow-sm);
}

.result-card.success { border-color: var(--success); background: #f0fdf4; }
.result-card.error { border-color: var(--error); background: #fef2f2; }
.result-card.warning { border-color: var(--warning); background: #fffbeb; }

.result-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.result-icon { font-size: 20px; }
.result-title { font-size: 16px; font-weight: 600; }
.result-card.success .result-title { color: var(--success); }
.result-card.error .result-title { color: var(--error); }
.result-card.warning .result-title { color: var(--warning); }

.result-message {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.6;
}

.result-details {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid rgba(0,0,0,0.05);
}

.result-detail-row {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    font-size: 13px;
}

.result-detail-label { color: var(--text-muted); }
.result-detail-value { color: var(--text-primary); font-weight: 600; }

/* ---------- Dashboard ---------- */
.dashboard-tabs {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 16px;
}

.d-tab {
    padding: 8px 18px;
    background: var(--bg-surface);
    border: 1px solid transparent;
    border-radius: 20px;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.d-tab:hover {
    background: #e2e8f0;
    color: var(--text-primary);
}

.d-tab.active {
    color: var(--accent);
    background: var(--accent-glow);
    border-color: rgba(99, 102, 241, 0.2);
    font-weight: 600;
}

.btn-refresh {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.btn-refresh:hover:not(:disabled) {
    background: #e2e8f0;
    color: var(--text-primary);
    border-color: #cbd5e1;
}

.btn-refresh.spinning svg { animation: spin 1s linear infinite; }

.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 24px;
}

.metric-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 18px;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
}

.metric-card:hover {
    transform: translateY(-4px);
    border-color: var(--accent-light);
    box-shadow: var(--shadow-lg);
}

.metric-icon {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    flex-shrink: 0;
}

.metric-info { flex: 1; }
.metric-label { font-size: 13px; color: var(--text-muted); margin-bottom: 4px; font-weight: 500; }
.metric-value { font-size: 28px; font-weight: 700; color: var(--text-primary); line-height: 1.2; letter-spacing: -0.02em; }

/* ---------- Dashboard Placeholder ---------- */
.dashboard-placeholder {
    background: var(--bg-card);
    border: 1px dashed var(--border);
    border-radius: var(--radius);
    padding: 80px 24px;
    text-align: center;
}

.placeholder-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.dashboard-placeholder h3 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-primary);
}

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

/* ---------- Footer ---------- */
.footer {
    padding: 24px 0;
    text-align: center;
    margin-top: auto;
}

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

/* ---------- URL Radar ---------- */
.radar-list-group { margin-bottom: 32px; }
.radar-list-title { font-size: 16px; font-weight: 600; color: var(--text-primary); margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
.radar-badge { padding: 4px 10px; border-radius: 12px; font-size: 12px; font-weight: 600; line-height: 1; }
.radar-badge.b-5 { background: rgba(99, 102, 241, 0.15); color: var(--accent); }
.radar-badge.b-7 { background: rgba(245, 158, 11, 0.15); color: var(--warning); }
.radar-badge.b-14 { background: rgba(239, 68, 68, 0.15); color: var(--error); }
.radar-item { background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 16px 20px; margin-bottom: 12px; transition: var(--transition); }
.radar-item:hover { border-color: var(--accent-light); box-shadow: var(--shadow-sm); transform: translateX(4px); }
.radar-item-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 8px; gap: 16px; }
.radar-url-name { font-size: 15px; font-weight: 600; color: var(--text-primary); word-break: break-all; }
.radar-desc { font-size: 13px; color: var(--text-secondary); line-height: 1.5; }
.radar-empty { text-align: center; padding: 40px 20px; color: var(--text-muted); background: var(--bg-surface); border-radius: var(--radius); border: 1px dashed var(--border); font-size: 14px; }

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
    .app-container { flex-direction: column; }
    .sidebar { width: 100%; border-right: none; border-bottom: 1px solid var(--border); padding: 16px; }
    .sidebar-header { margin-bottom: 16px; }
    .sidebar-nav { flex-direction: row; overflow-x: auto; padding-bottom: 8px; }
    .sidebar-menu-item { flex: 1; justify-content: center; min-width: 120px; text-align: center; }
    .sidebar-footer { display: none; }
    .top-header { display: none; }
    .content-wrapper { padding: 16px; }
    .upload-zone { padding: 32px 16px; }
}
