/* ═══════════════════════════════════════
   NeTools.Online Design System
   亮色/暗色 CSS 变量体系
   ═══════════════════════════════════════ */

:root {
    /* ── 品牌色 ── */
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --primary-soft: rgba(99, 102, 241, 0.10);
    --primary-glow: rgba(99, 102, 241, 0.25);
    --accent: #8b5cf6;
    --accent-soft: rgba(139, 92, 246, 0.10);

    /* ── 语义色 ── */
    --success: #10b981;
    --success-soft: rgba(16, 185, 129, 0.12);
    --warning: #f59e0b;
    --warning-soft: rgba(245, 158, 11, 0.12);
    --danger: #ef4444;
    --danger-soft: rgba(239, 68, 68, 0.12);

    /* ── 背景 ── */
    --bg-body: #f1f5f9;
    --bg-card: #ffffff;
    --bg-elevated: #f8fafc;
    --bg-input: #f1f5f9;

    /* ── 文字 ── */
    --text-main: #1e293b;
    --text-muted: #64748b;
    --text-dim: #94a3b8;

    /* ── 边框 ── */
    --border: #e2e8f0;
    --border-light: #f1f5f9;

    /* ── 阴影 ── */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 24px rgba(0, 0, 0, 0.08);
    --shadow-xl: 0 20px 48px rgba(0, 0, 0, 0.10);

    /* ── 尺寸 ── */
    --sidebar-width: 280px;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-full: 9999px;

    /* ── 毛玻璃 ── */
    --glass-bg: rgba(255, 255, 255, 0.72);
    --glass-border: rgba(226, 232, 240, 0.5);
    --glass-shadow: 0 4px 32px rgba(0, 0, 0, 0.06);
}

[data-theme="dark"] {
    --primary: #818cf8;
    --primary-hover: #6366f1;
    --primary-soft: rgba(129, 140, 248, 0.12);
    --primary-glow: rgba(129, 140, 248, 0.20);
    --accent: #a78bfa;
    --accent-soft: rgba(167, 139, 250, 0.12);

    --success: #34d399;
    --success-soft: rgba(52, 211, 153, 0.12);
    --warning: #fbbf24;
    --warning-soft: rgba(251, 191, 36, 0.12);
    --danger: #f87171;
    --danger-soft: rgba(248, 113, 113, 0.12);

    --bg-body: #0b1121;
    --bg-card: #151d31;
    --bg-elevated: #1a2440;
    --bg-input: #1a2440;

    --text-main: #e2e8f0;
    --text-muted: #64748b;
    --text-dim: #475569;

    --border: #1e293b;
    --border-light: #1a1f35;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 24px rgba(0, 0, 0, 0.35);
    --shadow-xl: 0 20px 48px rgba(0, 0, 0, 0.4);

    --glass-bg: rgba(11, 17, 33, 0.78);
    --glass-border: rgba(30, 41, 59, 0.6);
    --glass-shadow: 0 4px 32px rgba(0, 0, 0, 0.25);
}

/* ═══════════════════════════════════════
   Reset & Base
   ═══════════════════════════════════════ */

*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: var(--bg-body);
    color: var(--text-main);
    display: flex;
    min-height: 100vh;
    overflow: auto;
    transition: background 0.35s ease, color 0.35s ease;
    line-height: 1.6;
}

/* ═══════════════════════════════════════
   Background Decor
   ═══════════════════════════════════════ */

body::before {
    content: '';
    position: fixed;
    inset: 0;
    background:
        radial-gradient(ellipse at 10% 20%, rgba(99, 102, 241, 0.10), transparent 50%),
        radial-gradient(ellipse at 90% 80%, rgba(139, 92, 246, 0.08), transparent 50%);
    pointer-events: none;
    z-index: 0;
}

[data-theme="dark"] body::before {
    background:
        radial-gradient(ellipse at 10% 20%, rgba(99, 102, 241, 0.15), transparent 50%),
        radial-gradient(ellipse at 90% 80%, rgba(139, 92, 246, 0.10), transparent 50%);
}

/* ═══════════════════════════════════════
   Sidebar
   ═══════════════════════════════════════ */

.sidebar {
    width: var(--sidebar-width);
    background: var(--glass-bg);
    display: flex;
    flex-direction: column;
    padding: 20px 16px;
    gap: 8px;
    flex-shrink: 0;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-right: 1px solid var(--glass-border);
    box-shadow: var(--glass-shadow);
    z-index: 10;
    height: 100vh;
    position: sticky;
    top: 0;
    overflow: hidden;
}

/* Logo */
.sidebar-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    margin-bottom: 4px;
    border-radius: var(--radius-lg);
    transition: background 0.2s;
    cursor: pointer;
    flex-shrink: 0;
}
.sidebar-header:hover {
    background: var(--primary-soft);
}
.sidebar-header .logo-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, var(--primary), var(--accent));
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.2rem;
    flex-shrink: 0;
    box-shadow: 0 4px 12px var(--primary-glow);
}
.sidebar-header .logo-title {
    font-size: 1.05rem;
    font-weight: 800;
    letter-spacing: 0.02em;
    color: var(--text-main);
}
.sidebar-header .logo-subtitle {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 1px;
}

/* 侧边栏搜索 */
.sidebar-search {
    position: relative;
    flex-shrink: 0;
    margin: 4px 0 8px;
}
.sidebar-search i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-dim);
    font-size: 13px;
    pointer-events: none;
}
.sidebar-search input {
    width: 100%;
    padding: 9px 12px 9px 34px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    background: var(--bg-input);
    color: var(--text-main);
    font-size: 13px;
    outline: none;
    transition: border-color 0.2s;
}
.sidebar-search input:focus {
    border-color: var(--primary);
}

/* 导航菜单容器（可滚动） */
.nav-menu-wrapper {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}
.nav-menu-wrapper::-webkit-scrollbar {
    width: 4px;
}
.nav-menu-wrapper::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

/* 分类组 */
.nav-group {
    margin-bottom: 4px;
}
.nav-group-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 14px;
    cursor: pointer;
    border-radius: var(--radius-md);
    transition: background 0.15s;
    user-select: none;
    font-size: 12px;
    font-weight: 700;
    color: var(--text-dim);
    letter-spacing: 0.04em;
    text-transform: uppercase;
}
.nav-group-header:hover {
    background: var(--primary-soft);
    color: var(--text-main);
}
.nav-group-header .group-arrow {
    font-size: 10px;
    transition: transform 0.2s ease;
    color: var(--text-dim);
}
.nav-group-header .group-arrow.open {
    transform: rotate(90deg);
}
.nav-group-items {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding-left: 4px;
    overflow: hidden;
    max-height: 0;
    opacity: 0;
    transition: max-height 0.3s ease, opacity 0.25s ease, margin 0.25s ease;
    margin-bottom: 0;
}
.nav-group-items.open {
    max-height: 600px;
    opacity: 1;
    margin-bottom: 6px;
}

/* 导航链接 */
.nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 14px;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: var(--radius-md);
    font-size: 13px;
    font-weight: 500;
    transition: all 0.18s ease;
    position: relative;
}
.nav-link i {
    width: 18px;
    text-align: center;
    font-size: 14px;
    flex-shrink: 0;
}
.nav-link:hover {
    background: var(--primary-soft);
    color: var(--primary);
}
.nav-link.active {
    background: var(--primary-soft);
    color: var(--primary);
    font-weight: 600;
}
.nav-link.active::before {
    content: '';
    position: absolute;
    left: -4px;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 20px;
    border-radius: 3px;
    background: var(--primary);
    box-shadow: 0 0 8px var(--primary-glow);
}

/* 导航底部固定 */
.nav-footer {
    flex-shrink: 0;
    border-top: 1px solid var(--border);
    padding-top: 8px;
    margin-top: 4px;
}

/* ═══════════════════════════════════════
   Main Content Layout
   ═══════════════════════════════════════ */

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    overflow: hidden;
    position: relative;
    z-index: 1;
}

/* Top Bar */
.top-bar {
    min-height: 64px;
    background: var(--glass-bg);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    gap: 16px;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    flex-shrink: 0;
    position: sticky;
    top: 0;
    z-index: 5;
}

.top-bar .search-box {
    position: relative;
    width: 100%;
    max-width: 380px;
}
.top-bar .search-box i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-dim);
    font-size: 14px;
    pointer-events: none;
}
.top-bar .search-box input {
    width: 100%;
    padding: 10px 14px 10px 40px;
    border-radius: var(--radius-full);
    border: 1px solid var(--border);
    background: var(--bg-input);
    color: var(--text-main);
    font-size: 13px;
    outline: none;
    transition: all 0.2s;
}
.top-bar .search-box input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-soft);
}

/* 主题切换按钮 */
.theme-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s;
    font-size: 15px;
}
.theme-toggle:hover {
    background: var(--primary-soft);
    color: var(--primary);
    border-color: transparent;
}

/* 用户头像 */
.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    flex-shrink: 0;
}

.content-area {
    flex: 1;
    padding: 32px;
    overflow-y: auto;
}

/* ═══════════════════════════════════════
   Components
   ═══════════════════════════════════════ */

/* ── Card ── */
.card {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    padding: 24px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border);
    transition: all 0.25s ease;
}
.card:hover {
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-soft);
    transform: translateY(-2px);
}

/* ── Button ── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 20px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: #fff;
    text-decoration: none;
    border: none;
    border-radius: var(--radius-full);
    cursor: pointer;
    font-weight: 600;
    font-size: 13px;
    letter-spacing: 0.02em;
    box-shadow: 0 4px 16px var(--primary-glow);
    transition: all 0.2s ease;
    white-space: nowrap;
}
.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px var(--primary-glow);
    filter: brightness(1.08);
}
.btn:active {
    transform: translateY(0);
    filter: brightness(0.96);
}

/* ── Badge / Tag ── */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 10px;
    border-radius: var(--radius-full);
    font-size: 11px;
    font-weight: 600;
    line-height: 1.5;
}
.badge-primary { background: var(--primary-soft); color: var(--primary); }
.badge-success { background: var(--success-soft); color: var(--success); }
.badge-warning { background: var(--warning-soft); color: var(--warning); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }

/* ── 输入框 ── */
input, textarea, select {
    width: 100%;
    padding: 11px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--bg-input);
    color: var(--text-main);
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}
input:focus, textarea:focus, select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-soft);
}

/* ── Section Title ── */
.section-title {
    font-size: 20px;
    font-weight: 700;
    margin: 0 0 18px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ── Spinner ── */
.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid var(--primary-soft);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    vertical-align: middle;
    margin-right: 6px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Toast ── */
.copied-toast {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 10px 20px;
    background: var(--success);
    color: #fff;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 13px;
    z-index: 9999;
    animation: fadeIn 0.2s ease;
    pointer-events: none;
    box-shadow: var(--shadow-lg);
}
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ═══════════════════════════════════════
   Responsive — Desktop First
   ═══════════════════════════════════════ */

/* Hamburger button - hidden on desktop */
.hamburger-btn {
    display: none;
    width: 38px;
    height: 38px;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-main);
    cursor: pointer;
    font-size: 16px;
    flex-shrink: 0;
    transition: all 0.2s;
}
.hamburger-btn:hover { background: var(--bg-input); }

/* Mobile sidebar overlay */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 99;
    background: rgba(0,0,0,0.3);
    backdrop-filter: blur(2px);
    opacity: 0;
    transition: opacity 0.25s ease;
    pointer-events: none;
}
.sidebar-overlay.show {
    opacity: 1;
    pointer-events: auto;
}

@media (max-width: 1024px) {
    .hamburger-btn { display: inline-flex; }

    .sidebar {
        position: fixed;
        left: -300px;
        top: 0;
        bottom: 0;
        z-index: 100;
        transition: left 0.3s ease;
        box-shadow: var(--shadow-xl);
        height: 100vh;
        overflow-y: auto;
    }
    .sidebar.open { left: 0; }
    .sidebar-overlay { display: block; }

    .main-content { margin-left: 0; }
    body.sidebar-open { overflow: hidden; }

    .top-bar { padding: 0 12px; min-height: 56px; }
    .top-bar .search-box { max-width: 200px; }
    .top-bar .search-box input { font-size: 12px; padding: 8px 10px 8px 32px; }

    .content-area { padding: 16px; }
}

@media (max-width: 640px) {
    .top-bar .search-box { display: none; }
    .top-bar { gap: 6px; }
    .top-bar > div:last-child { gap: 4px; }
    .top-bar .btn { padding: 6px 10px; font-size: 11px; }
    .top-bar a[href*="qq.com"] { display: none; }

    .content-area { padding: 12px; }
    .home-hero { padding: 24px 16px; }
    .home-hero h1 { font-size: 1.5rem; }
    .home-tool-grid { grid-template-columns: 1fr; }
    .home-section-title { font-size: 1.1rem; }

    .create-grid { grid-template-columns: 1fr; }

    .card { padding: 14px; }

    .admin-menu-item { font-size: 12px; padding: 6px 10px; }
}

/* Main content adjust */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    overflow: hidden;
    position: relative;
    z-index: 1;
}

/* Breadcrumb navigation */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 0 6px;
    font-size: 12px;
    flex-wrap: wrap;
    margin-bottom: 4px;
}
.breadcrumb-item {
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.15s;
    white-space: nowrap;
}
.breadcrumb-item:hover { color: var(--primary); }
.breadcrumb-sep { color: var(--text-dim); font-size: 14px; }
.breadcrumb-current {
    color: var(--text-main);
    font-weight: 600;
    white-space: nowrap;
}