/* ============================================
   AI工具箱 - 主样式表
   20010708.com
   ============================================ */

/* CSS 变量 - 浅色主题 */
:root {
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --primary-light: rgba(99, 102, 241, 0.1);
    --accent: #06b6d4;
    --accent-hover: #0891b2;
    --bg: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-card: #ffffff;
    --bg-glass: rgba(255, 255, 255, 0.7);
    --text: #0f172a;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --border: #e2e8f0;
    --border-light: #f1f5f9;
    --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-lg: 0 10px 40px rgba(0,0,0,0.12);
    --shadow-glow: 0 0 20px rgba(99, 102, 241, 0.15);
    --radius: 12px;
    --radius-lg: 20px;
    --radius-full: 9999px;
    --nav-bg: rgba(255,255,255,0.85);
    --gradient-hero: linear-gradient(135deg, #6366f1 0%, #06b6d4 50%, #8b5cf6 100%);
    --gradient-card: linear-gradient(135deg, var(--primary-light), transparent);
    --success: #10b981;
    --warning: #f59e0b;
    --error: #ef4444;
    --info: #3b82f6;
    --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'PingFang SC', 'Microsoft YaHei', sans-serif;
}

/* 深色主题 */
[data-theme="dark"] {
    --bg: #0f0f1a;
    --bg-secondary: #1a1a2e;
    --bg-card: #1e1e36;
    --bg-glass: rgba(30, 30, 54, 0.85);
    --text: #e2e8f0;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --border: #2d2d4a;
    --border-light: #1e1e36;
    --shadow: 0 1px 3px rgba(0,0,0,0.3);
    --shadow-lg: 0 10px 40px rgba(0,0,0,0.4);
    --shadow-glow: 0 0 20px rgba(99, 102, 241, 0.3);
    --nav-bg: rgba(15, 15, 26, 0.9);
    --gradient-card: linear-gradient(135deg, rgba(99, 102, 241, 0.08), transparent);
}

/* 全局重置 */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    transition: background .3s, color .3s;
    -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; transition: color .2s; }
a:hover { color: var(--primary-hover); }
img { max-width: 100%; height: auto; }

/* ===== 导航栏 ===== */
.navbar {
    position: fixed; top: 0; left: 0; right: 0; z-index: 1000;
    background: var(--nav-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    transition: all .3s;
}
.navbar.scrolled { box-shadow: var(--shadow); }
.nav-inner {
    max-width: 1280px; margin: 0 auto;
    display: flex; align-items: center;
    padding: 0 24px; height: 64px; gap: 24px;
}
.nav-logo {
    display: flex; align-items: center; gap: 10px;
    font-size: 20px; font-weight: 800; color: var(--text);
    letter-spacing: -0.5px;
}
.nav-logo .logo-icon {
    width: 36px; height: 36px; border-radius: 10px;
    background: var(--gradient-hero);
    display: flex; align-items: center; justify-content: center;
    color: white; font-size: 18px;
}
.nav-links { display: flex; gap: 4px; margin-left: auto; }
.nav-links a {
    padding: 8px 16px; border-radius: var(--radius);
    color: var(--text-secondary); font-size: 14px; font-weight: 500;
    transition: all .2s; position: relative;
}
.nav-links a:hover, .nav-links a.active {
    color: var(--text); background: var(--primary-light);
}
.nav-links a.active::after {
    content: ''; position: absolute; bottom: 2px; left: 50%;
    transform: translateX(-50%);
    width: 20px; height: 3px; border-radius: 2px;
    background: var(--primary);
}
.nav-actions { display: flex; align-items: center; gap: 8px; }
.theme-toggle {
    width: 36px; height: 36px; border-radius: 50%;
    border: 1px solid var(--border); background: transparent;
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    color: var(--text-secondary); font-size: 16px; transition: all .2s;
}
.theme-toggle:hover { background: var(--primary-light); color: var(--primary); border-color: var(--primary); }
.mobile-menu-btn { display: none; width: 36px; height: 36px; border: none; background: transparent; cursor: pointer; color: var(--text); font-size: 24px; }

/* ===== 用户头像/按钮 ===== */
.btn {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 10px 20px; border-radius: var(--radius-full);
    font-size: 14px; font-weight: 600; border: none;
    cursor: pointer; transition: all .2s; white-space: nowrap;
}
.btn-primary {
    background: var(--primary); color: white;
    box-shadow: 0 2px 10px rgba(99, 102, 241, 0.3);
}
.btn-primary:hover { background: var(--primary-hover); transform: translateY(-1px); box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4); }
.btn-outline {
    background: transparent; border: 1.5px solid var(--border);
    color: var(--text-secondary);
}
.btn-outline:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }
.btn-accent { background: var(--accent); color: white; }
.btn-accent:hover { background: var(--accent-hover); transform: translateY(-1px); }
.btn-sm { padding: 6px 14px; font-size: 13px; }
.btn-lg { padding: 14px 28px; font-size: 16px; }
.user-avatar {
    width: 36px; height: 36px; border-radius: 50%;
    background: var(--gradient-hero);
    display: flex; align-items: center; justify-content: center;
    color: white; font-size: 14px; font-weight: 700;
    cursor: pointer; position: relative;
}
.user-dropdown {
    position: absolute; top: 48px; right: 0; min-width: 200px;
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius); box-shadow: var(--shadow-lg);
    padding: 8px; display: none; z-index: 100;
}
.user-dropdown.show { display: block; }
.user-dropdown .user-info { padding: 12px; border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.user-dropdown .user-info .name { font-weight: 600; font-size: 14px; }
.user-dropdown .user-info .credits { font-size: 12px; color: var(--text-secondary); }
.user-dropdown a {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 12px; border-radius: 8px;
    color: var(--text-secondary); font-size: 14px;
}
.user-dropdown a:hover { background: var(--primary-light); color: var(--primary); }
.user-dropdown .logout { color: var(--error); }
.user-dropdown .logout:hover { background: rgba(239,68,68,0.1); color: var(--error); }

/* ===== Hero 区域 ===== */
.hero {
    padding: 140px 24px 80px; text-align: center;
    background: var(--bg);
    position: relative; overflow: hidden;
}
.hero::before {
    content: ''; position: absolute; top: -50%; left: -50%;
    width: 200%; height: 200%;
    background: radial-gradient(ellipse at 50% 40%, rgba(99,102,241,0.06) 0%, transparent 60%);
    pointer-events: none;
}
.hero h1 {
    font-size: clamp(2rem, 5vw, 3.5rem);
    font-weight: 800; letter-spacing: -1px;
    margin-bottom: 16px; position: relative;
}
.hero h1 .gradient-text {
    background: var(--gradient-hero);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    background-clip: text;
}
.hero p {
    font-size: clamp(1rem, 2vw, 1.2rem);
    color: var(--text-secondary);
    max-width: 600px; margin: 0 auto 32px;
}
.hero-search {
    max-width: 560px; margin: 0 auto;
    position: relative;
}
.hero-search input {
    width: 100%; padding: 16px 20px 16px 52px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-full);
    background: var(--bg-card);
    color: var(--text); font-size: 16px;
    outline: none; transition: all .3s;
}
.hero-search input:focus {
    border-color: var(--primary);
    box-shadow: var(--shadow-glow);
}
.hero-search .search-icon {
    position: absolute; left: 20px; top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted); font-size: 18px;
}

/* ===== 分类导航 ===== */
.categories {
    padding: 0 24px; max-width: 1280px; margin: 0 auto;
}
.categories-scroll {
    display: flex; gap: 8px; overflow-x: auto;
    padding: 8px 0; scrollbar-width: none;
    -ms-overflow-style: none;
}
.categories-scroll::-webkit-scrollbar { display: none; }
.cat-tag {
    display: flex; align-items: center; gap: 6px;
    padding: 8px 18px; border-radius: var(--radius-full);
    border: 1.5px solid var(--border);
    background: var(--bg-card); color: var(--text-secondary);
    font-size: 14px; font-weight: 500; cursor: pointer;
    white-space: nowrap; transition: all .2s;
    user-select: none;
}
.cat-tag:hover { border-color: var(--primary); color: var(--primary); }
.cat-tag.active {
    background: var(--primary); color: white; border-color: var(--primary);
}

/* ===== 工具网格 ===== */
.tools-section {
    max-width: 1280px; margin: 0 auto; padding: 40px 24px;
}
.section-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 24px;
}
.section-header h2 { font-size: 24px; font-weight: 700; }
.section-header .count { color: var(--text-muted); font-size: 14px; }
.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}
.tool-card {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 24px;
    transition: all .3s; cursor: pointer;
    position: relative; overflow: hidden;
}
.tool-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary);
}
.tool-card .tool-icon {
    width: 48px; height: 48px; border-radius: 12px;
    background: var(--gradient-card);
    display: flex; align-items: center; justify-content: center;
    font-size: 24px; margin-bottom: 16px;
}
.tool-card .tool-name {
    font-size: 16px; font-weight: 600; margin-bottom: 8px;
}
.tool-card .tool-desc {
    font-size: 13px; color: var(--text-secondary);
    line-height: 1.5;
}
.tool-card .tool-badge {
    position: absolute; top: 16px; right: 16px;
    padding: 2px 10px; border-radius: var(--radius-full);
    font-size: 11px; font-weight: 600;
}
.tool-card .tool-badge.vip {
    background: linear-gradient(135deg, #f59e0b, #eab308);
    color: white;
}
.tool-card .tool-badge.free {
    background: var(--primary-light);
    color: var(--primary);
}
.tool-card .tool-footer {
    display: flex; align-items: center; justify-content: space-between;
    margin-top: 16px; padding-top: 16px;
    border-top: 1px solid var(--border-light);
    font-size: 12px; color: var(--text-muted);
}

/* ===== 工具使用面板 ===== */
.tool-panel {
    max-width: 800px; margin: 0 auto; padding: 24px;
}
.tool-panel.hidden { display: none; }
.tool-panel .back-btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 8px 16px; border-radius: var(--radius);
    border: 1px solid var(--border); background: transparent;
    color: var(--text-secondary); cursor: pointer;
    font-size: 14px; margin-bottom: 24px;
    transition: all .2s;
}
.tool-panel .back-btn:hover { border-color: var(--primary); color: var(--primary); }
.tool-panel .tool-title {
    font-size: 28px; font-weight: 700; margin-bottom: 8px;
}
.tool-panel .tool-desc { color: var(--text-secondary); margin-bottom: 24px; }
.tool-form { display: flex; flex-direction: column; gap: 16px; }
.tool-form textarea {
    width: 100%; padding: 16px; border-radius: var(--radius);
    border: 1.5px solid var(--border); background: var(--bg-secondary);
    color: var(--text); font-size: 15px; min-height: 150px;
    resize: vertical; outline: none; transition: border-color .2s;
    font-family: var(--font);
}
.tool-form textarea:focus { border-color: var(--primary); }
.tool-form .form-actions {
    display: flex; gap: 12px; align-items: center;
}
.tool-result {
    margin-top: 24px; padding: 20px; border-radius: var(--radius);
    background: var(--bg-secondary); border: 1px solid var(--border);
    white-space: pre-wrap; line-height: 1.7;
    display: none;
}
.tool-result.show { display: block; }
.tool-result .result-actions {
    display: flex; gap: 8px; margin-top: 16px;
}
.result-loading {
    display: flex; align-items: center; gap: 12px;
    padding: 24px; color: var(--text-secondary);
}
.spinner {
    width: 20px; height: 20px;
    border: 2.5px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%; animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== 模态框 ===== */
.modal-overlay {
    position: fixed; inset: 0; z-index: 2000;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(4px);
    display: none; align-items: center; justify-content: center;
    padding: 24px;
}
.modal-overlay.show { display: flex; }
.modal {
    background: var(--bg-card); border-radius: var(--radius-lg);
    padding: 32px; width: 100%; max-width: 440px;
    box-shadow: var(--shadow-lg); animation: modalIn .3s ease;
    position: relative;
}
@keyframes modalIn {
    from { opacity: 0; transform: scale(0.95) translateY(10px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}
.modal-close {
    position: absolute; top: 16px; right: 16px;
    width: 32px; height: 32px; border-radius: 50%;
    border: none; background: var(--bg-secondary);
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    color: var(--text-muted); font-size: 18px; transition: all .2s;
}
.modal-close:hover { background: var(--primary-light); color: var(--primary); }
.modal h2 { font-size: 24px; font-weight: 700; margin-bottom: 8px; }
.modal p { color: var(--text-secondary); font-size: 14px; margin-bottom: 24px; }
.modal .form-group { margin-bottom: 16px; }
.modal .form-group label {
    display: block; font-size: 14px; font-weight: 500;
    margin-bottom: 6px; color: var(--text);
}
.modal .form-group input {
    width: 100%; padding: 12px 16px;
    border: 1.5px solid var(--border); border-radius: var(--radius);
    background: var(--bg-secondary); color: var(--text);
    font-size: 15px; outline: none; transition: border-color .2s;
}
.modal .form-group input:focus { border-color: var(--primary); }
.modal .form-submit { width: 100%; justify-content: center; }
.modal .form-footer {
    text-align: center; margin-top: 16px;
    font-size: 14px; color: var(--text-secondary);
}
.modal .form-footer a { color: var(--primary); cursor: pointer; }

/* ===== Toast 通知 ===== */
.toast-container {
    position: fixed; top: 80px; right: 24px; z-index: 9999;
    display: flex; flex-direction: column; gap: 8px;
}
.toast {
    padding: 14px 20px; border-radius: var(--radius);
    background: var(--bg-card); border: 1px solid var(--border);
    box-shadow: var(--shadow-lg); font-size: 14px;
    display: flex; align-items: center; gap: 10px;
    animation: toastIn .3s ease; min-width: 280px;
}
.toast.success { border-left: 3px solid var(--success); }
.toast.error { border-left: 3px solid var(--error); }
.toast.warning { border-left: 3px solid var(--warning); }
.toast.info { border-left: 3px solid var(--info); }
@keyframes toastIn { from { opacity: 0; transform: translateX(100px); } to { opacity: 1; transform: translateX(0); } }
.toast-out { animation: toastOut .3s ease forwards; }
@keyframes toastOut { to { opacity: 0; transform: translateX(100px); } }

/* ===== 用户中心 ===== */
.profile-section {
    max-width: 800px; margin: 100px auto 40px; padding: 0 24px;
}
.profile-card {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius-lg); padding: 32px;
    display: flex; gap: 24px; align-items: center;
}
.profile-card .avatar-lg {
    width: 80px; height: 80px; border-radius: 50%;
    background: var(--gradient-hero);
    display: flex; align-items: center; justify-content: center;
    color: white; font-size: 32px; font-weight: 700;
}
.profile-card .info { flex: 1; }
.profile-card .info h3 { font-size: 20px; font-weight: 700; }
.profile-card .info .role {
    font-size: 13px; color: var(--text-muted); margin-bottom: 12px;
}
.stats-grid {
    display: grid; grid-template-columns: repeat(3, 1fr);
    gap: 12px; max-width: 800px; margin: 24px auto 0;
    padding: 0 24px;
}
.stat-card {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 20px; text-align: center;
}
.stat-card .num {
    font-size: 28px; font-weight: 800; color: var(--primary);
}
.stat-card .label { font-size: 13px; color: var(--text-secondary); margin-top: 4px; }

/* ===== 后台管理 ===== */
.admin-layout {
    display: grid; grid-template-columns: 240px 1fr;
    min-height: 100vh; margin-top: 64px;
}
.admin-sidebar {
    background: var(--bg-secondary); border-right: 1px solid var(--border);
    padding: 24px 12px;
}
.admin-sidebar a {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 14px; border-radius: 10px;
    color: var(--text-secondary); font-size: 14px; font-weight: 500;
    margin-bottom: 2px;
}
.admin-sidebar a:hover, .admin-sidebar a.active {
    background: var(--primary-light); color: var(--primary);
}
.admin-main { padding: 32px; }
.admin-main h1 { font-size: 28px; font-weight: 700; margin-bottom: 24px; }
.admin-card {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 24px; margin-bottom: 20px;
}
.admin-card h3 {
    font-size: 16px; font-weight: 600; margin-bottom: 16px;
    padding-bottom: 12px; border-bottom: 1px solid var(--border);
}
.admin-form .form-row {
    display: grid; grid-template-columns: 1fr 2fr; gap: 12px;
    margin-bottom: 14px; align-items: center;
}
.admin-form .form-row label { font-size: 14px; font-weight: 500; }
.admin-form input, .admin-form select, .admin-form textarea {
    width: 100%; padding: 10px 14px;
    border: 1.5px solid var(--border); border-radius: 8px;
    background: var(--bg-secondary); color: var(--text);
    font-size: 14px; outline: none;
}
.admin-form input:focus { border-color: var(--primary); }
.admin-table { width: 100%; border-collapse: collapse; }
.admin-table th {
    text-align: left; padding: 12px; font-size: 13px;
    color: var(--text-secondary); font-weight: 600;
    border-bottom: 2px solid var(--border);
}
.admin-table td { padding: 12px; border-bottom: 1px solid var(--border-light); font-size: 14px; }
.admin-table tr:hover td { background: var(--bg-secondary); }

/* ===== Playground 创意区 ===== */
.playground-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px; max-width: 1280px; margin: 100px auto 40px; padding: 0 24px;
}
.playground-item {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 24px 16px;
    text-align: center; cursor: pointer; transition: all .3s;
}
.playground-item:hover {
    transform: translateY(-3px); box-shadow: var(--shadow-lg);
    border-color: var(--accent);
}
.playground-item .emoji { font-size: 36px; margin-bottom: 12px; }
.playground-item .name { font-size: 15px; font-weight: 600; }
.playground-item .desc { font-size: 12px; color: var(--text-secondary); margin-top: 4px; }

/* ===== 页脚 ===== */
.footer {
    padding: 60px 24px 30px;
    border-top: 1px solid var(--border);
    text-align: center;
}
.footer .links { display: flex; justify-content: center; gap: 24px; margin-bottom: 20px; }
.footer .links a { color: var(--text-secondary); font-size: 14px; }
.footer .links a:hover { color: var(--primary); }
.footer .copyright { color: var(--text-muted); font-size: 13px; }

/* ===== 响应式 ===== */
@media (max-width: 900px) {
    .nav-links { display: none; }
    .nav-links.open {
        display: flex; flex-direction: column;
        position: absolute; top: 64px; left: 0; right: 0;
        background: var(--bg-card); border-bottom: 1px solid var(--border);
        padding: 12px; box-shadow: var(--shadow-lg);
    }
    .mobile-menu-btn { display: flex; align-items: center; justify-content: center; }
    .tools-grid { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
    .admin-layout { grid-template-columns: 1fr; }
    .admin-sidebar { display: none; }
    .admin-sidebar.open { display: block; position: fixed; z-index: 100; width: 260px; height: 100%; }
    .profile-card { flex-direction: column; text-align: center; }
    .stats-grid { grid-template-columns: repeat(3, 1fr); }
    .admin-form .form-row { grid-template-columns: 1fr; }
    .hero { padding: 100px 16px 60px; }
}

@media (max-width: 480px) {
    .tools-grid { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: 1fr; }
    .modal { padding: 24px 16px; }
}

/* ===== 工具类 ===== */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-4 { gap: 16px; }
.gap-6 { gap: 24px; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.mb-4 { margin-bottom: 16px; }
.text-center { text-align: center; }
.text-muted { color: var(--text-secondary); }
.text-sm { font-size: 14px; }
.font-bold { font-weight: 700; }
.hidden { display: none !important; }
.w-full { width: 100%; }
.max-w-800 { max-width: 800px; margin-left: auto; margin-right: auto; }
