/* ===================================================
   Tools Hub - 个人工具宝库 样式表
   Design Style: Modern Glassmorphism & Vibrant Dark/Light Mode
   =================================================== */

:root {
    /* 色彩系统 - 深色主题 (默认) */
    --bg-main: #0b0f19;
    --bg-card: rgba(22, 30, 46, 0.7);
    --bg-card-hover: rgba(30, 41, 64, 0.85);
    --bg-input: rgba(15, 23, 42, 0.6);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-border-hover: rgba(99, 102, 241, 0.4);
    
    --text-main: #f8fafc;
    --text-sub: #94a3b8;
    --text-muted: #64748b;
    
    --accent: #6366f1;
    --accent-hover: #4f46e5;
    --accent-glow: rgba(99, 102, 241, 0.3);
    
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    
    --card-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
    --modal-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7);
    
    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --radius-full: 9999px;
    
    --transition-fast: 0.2s ease;
    --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="light"] {
    --bg-main: #f1f5f9;
    --bg-card: rgba(255, 255, 255, 0.8);
    --bg-card-hover: rgba(255, 255, 255, 0.95);
    --bg-input: rgba(255, 255, 255, 0.9);
    --glass-border: rgba(0, 0, 0, 0.06);
    --glass-border-hover: rgba(99, 102, 241, 0.4);
    
    --text-main: #0f172a;
    --text-sub: #475569;
    --text-muted: #94a3b8;
    
    --accent: #4f46e5;
    --accent-hover: #4338ca;
    --accent-glow: rgba(79, 70, 229, 0.25);
    
    --card-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.08);
    --modal-shadow: 0 20px 40px -15px rgba(0, 0, 0, 0.15);
}

/* 基础重置 */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', 'Noto Sans SC', system-ui, -apple-system, sans-serif;
    background-color: var(--bg-main);
    color: var(--text-main);
    min-height: 100vh;
    line-height: 1.6;
    overflow-x: hidden;
    position: relative;
    transition: background-color var(--transition-normal), color var(--transition-normal);
}

/* Ambient Ambient Blurs Background */
.bg-blur-1 {
    position: fixed;
    top: -10%;
    left: 15%;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.15) 0%, rgba(0, 0, 0, 0) 70%);
    border-radius: 50%;
    pointer-events: none;
    z-index: 0;
}

.bg-blur-2 {
    position: fixed;
    bottom: -10%;
    right: 15%;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(168, 85, 247, 0.12) 0%, rgba(0, 0, 0, 0) 70%);
    border-radius: 50%;
    pointer-events: none;
    z-index: 0;
}

/* 主容器 Layout */
.app-container {
    max-width: 1320px;
    margin: 0 auto;
    padding: 24px 20px 60px;
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* 顶栏 Header */
.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 16px 24px;
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    margin-bottom: 24px;
    box-shadow: var(--card-shadow);
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: max-content;
}

.brand-logo {
    width: 44px;
    height: 44px;
    min-width: 44px;
    max-width: 44px;
    min-height: 44px;
    max-height: 44px;
    flex-shrink: 0;
    background: linear-gradient(135deg, var(--accent), #a855f7);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: #fff;
    box-shadow: 0 4px 14px var(--accent-glow);
    overflow: hidden;
    position: relative;
}

.brand-logo-img,
.brand-logo img {
    width: 44px;
    height: 44px;
    max-width: 44px;
    max-height: 44px;
    min-width: 44px;
    min-height: 44px;
    object-fit: cover;
    border-radius: var(--radius-md);
    display: block;
    flex-shrink: 0;
}

.brand-text h1 {
    font-size: 1.25rem;
    font-weight: 700;
    line-height: 1.2;
    background: linear-gradient(90deg, var(--text-main), var(--text-sub));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.brand-subtitle {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* 搜索框 */
.header-search {
    flex: 1;
    max-width: 460px;
    position: relative;
    display: flex;
    align-items: center;
}

.search-icon {
    position: absolute;
    left: 14px;
    font-size: 1.1rem;
    color: var(--text-muted);
    pointer-events: none;
}

.header-search input {
    width: 100%;
    padding: 11px 40px 11px 42px;
    background: var(--bg-input);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-full);
    color: var(--text-main);
    font-size: 0.92rem;
    outline: none;
    transition: all var(--transition-fast);
}

.header-search input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 4px var(--accent-glow);
    background: var(--bg-card-hover);
}

.search-shortcut {
    position: absolute;
    right: 14px;
    font-size: 1rem;
    color: var(--text-muted);
    cursor: pointer;
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.header-search input:not(:placeholder-shown) + .search-shortcut {
    opacity: 1;
}

/* 操作按钮组 */
.header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: max-content;
}

/* 通用按钮 */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: var(--radius-full);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all var(--transition-fast);
    text-decoration: none;
    white-space: nowrap;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent), #4f46e5);
    color: #fff;
    box-shadow: 0 4px 14px var(--accent-glow);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px var(--accent-glow);
    opacity: 0.95;
}

.top-netdisk-btn {
    background: linear-gradient(135deg, var(--accent), #a855f7);
    color: #fff;
    font-weight: 600;
    box-shadow: 0 4px 16px rgba(99, 102, 241, 0.35);
}

.top-netdisk-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 22px rgba(168, 85, 247, 0.45);
}

.btn-secondary {
    background: var(--bg-input);
    color: var(--text-main);
    border-color: var(--glass-border);
}

.btn-secondary:hover {
    background: var(--bg-card-hover);
    border-color: var(--accent);
    color: var(--accent);
}

.btn-dark {
    background: #1e293b;
    color: #f8fafc;
    border-color: rgba(255, 255, 255, 0.1);
}

.btn-dark:hover {
    background: #0f172a;
}

.btn-icon {
    width: 42px;
    height: 42px;
    padding: 0;
    border-radius: 50%;
    background: var(--bg-input);
    color: var(--text-sub);
    border-color: var(--glass-border);
    font-size: 1.15rem;
}

.btn-icon:hover {
    color: var(--accent);
    border-color: var(--accent);
    background: var(--bg-card-hover);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.82rem;
    border-radius: var(--radius-sm);
}

/* 分类与筛选 Filter Section */
.filter-section {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.category-scroll {
    overflow-x: auto;
    padding-bottom: 4px;
    scrollbar-width: none; /* Firefox */
}

.category-scroll::-webkit-scrollbar {
    display: none;
}

.category-tabs {
    display: flex;
    align-items: center;
    gap: 8px;
}

.cat-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: var(--radius-full);
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--text-sub);
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
}

.cat-chip:hover {
    color: var(--text-main);
    border-color: var(--glass-border-hover);
    background: var(--bg-card-hover);
}

.cat-chip.active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
    box-shadow: 0 4px 12px var(--accent-glow);
    font-weight: 600;
}

.stats-badge {
    font-size: 0.85rem;
    color: var(--text-muted);
    background: var(--bg-card);
    padding: 6px 14px;
    border-radius: var(--radius-full);
    border: 1px solid var(--glass-border);
    white-space: nowrap;
}

/* 工具卡片网格 Main Tools Wrapper */
.tools-wrapper {
    flex: 1;
}

.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
    transition: all var(--transition-normal);
}

/* 单个工具卡片 Tool Card */
.tool-card {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    padding: 20px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: all var(--transition-normal);
    position: relative;
    overflow: hidden;
    box-shadow: var(--card-shadow);
}

.tool-card:hover {
    transform: translateY(-4px);
    border-color: var(--glass-border-hover);
    background: var(--bg-card-hover);
    box-shadow: 0 15px 35px -10px rgba(99, 102, 241, 0.2);
}

.tool-card-header {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    margin-bottom: 12px;
}

.tool-icon {
    width: 48px;
    height: 48px;
    min-width: 48px;
    border-radius: var(--radius-sm);
    background: var(--bg-input);
    border: 1px solid var(--glass-border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    box-shadow: inset 0 0 10px rgba(0,0,0,0.1);
}

.tool-info {
    flex: 1;
    overflow: hidden;
}

.tool-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tool-category-tag {
    display: inline-block;
    font-size: 0.72rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 4px;
    background: rgba(99, 102, 241, 0.12);
    color: var(--accent);
    text-transform: uppercase;
}

.tool-desc {
    font-size: 0.88rem;
    color: var(--text-sub);
    line-height: 1.5;
    margin-bottom: 16px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    height: 2.7rem;
}

.tool-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 18px;
}

.tag-badge {
    font-size: 0.75rem;
    padding: 3px 8px;
    border-radius: 4px;
    background: var(--bg-input);
    color: var(--text-muted);
    border: 1px solid var(--glass-border);
}

.tool-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 14px;
    border-top: 1px solid var(--glass-border);
    gap: 8px;
}

.action-group {
    display: flex;
    align-items: center;
    gap: 6px;
}

.link-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
    font-weight: 600;
    text-decoration: none;
    transition: all var(--transition-fast);
    background: var(--bg-input);
    color: var(--text-sub);
    border: 1px solid var(--glass-border);
}

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

.link-btn.github-link:hover {
    background: #24292e;
    color: #fff;
    border-color: #24292e;
}

.link-btn.netdisk-link {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.15), rgba(168, 85, 247, 0.15));
    color: var(--accent);
    border-color: var(--glass-border-hover);
}

.link-btn.netdisk-link:hover {
    background: linear-gradient(135deg, var(--accent), #a855f7);
    color: #fff;
}

.btn-detail-trigger {
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
    color: var(--text-muted);
    cursor: pointer;
    background: transparent;
    border: none;
    transition: color var(--transition-fast);
}

.btn-detail-trigger:hover {
    color: var(--accent);
}

/* 列表视图模式 List View */
.tools-grid.list-view {
    grid-template-columns: 1fr;
}

.tools-grid.list-view .tool-card {
    flex-direction: row;
    align-items: center;
    padding: 16px 20px;
}

.tools-grid.list-view .tool-card-header {
    margin-bottom: 0;
    width: 260px;
    min-width: 260px;
}

.tools-grid.list-view .tool-desc {
    margin-bottom: 0;
    height: auto;
    -webkit-line-clamp: 1;
    flex: 1;
    padding: 0 20px;
}

.tools-grid.list-view .tool-tags {
    margin-bottom: 0;
    width: 200px;
}

.tools-grid.list-view .tool-card-footer {
    padding-top: 0;
    border-top: none;
}

/* 空状态 Empty State */
.empty-state {
    text-align: center;
    padding: 80px 20px;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px dashed var(--glass-border);
    margin-top: 20px;
}

.empty-icon {
    font-size: 3.5rem;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.empty-state h3 {
    font-size: 1.2rem;
    color: var(--text-main);
    margin-bottom: 6px;
}

.empty-state p {
    color: var(--text-sub);
    font-size: 0.9rem;
    margin-bottom: 20px;
}

.hidden {
    display: none !important;
}

/* Modal 弹窗全局 */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeIn 0.25s ease;
}

.modal-content {
    background: var(--bg-card);
    border: 1px solid var(--glass-border-hover);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 580px;
    padding: 28px;
    position: relative;
    box-shadow: var(--modal-shadow);
    max-height: 90vh;
    overflow-y: auto;
    animation: scaleUp 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--bg-input);
    border: 1px solid var(--glass-border);
    color: var(--text-sub);
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.modal-close:hover {
    color: var(--danger);
    border-color: var(--danger);
}

.modal-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
    padding-right: 40px;
}

.modal-icon {
    font-size: 38px;
    width: 56px;
    height: 56px;
    background: var(--bg-input);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--glass-border);
}

.modal-header h2 {
    font-size: 1.35rem;
    font-weight: 700;
}

.detail-tags {
    display: flex;
    gap: 6px;
    margin-top: 6px;
}

.modal-body {
    display: flex;
    flex-direction: column;
    gap: 18px;
    margin-bottom: 24px;
}

.detail-section h4 {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.detail-section p {
    font-size: 0.95rem;
    color: var(--text-sub);
    line-height: 1.6;
}

.detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    background: var(--bg-input);
    padding: 14px;
    border-radius: var(--radius-md);
    border: 1px solid var(--glass-border);
}

.detail-item {
    display: flex;
    flex-direction: column;
}

.detail-item .label {
    font-size: 0.78rem;
    color: var(--text-muted);
}

.detail-item .value {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-main);
}

.pwd-box {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-input);
    padding: 10px 14px;
    border-radius: var(--radius-md);
    border: 1px dashed var(--accent);
}

.pwd-box code {
    font-family: monospace;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--accent);
    letter-spacing: 1px;
}

.modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    padding-top: 16px;
    border-top: 1px solid var(--glass-border);
}

/* 生成器 Form Modal */
.creator-card {
    max-width: 680px;
}

.creator-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-sub);
}

.form-group input, .form-group textarea {
    padding: 10px 14px;
    background: var(--bg-input);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    color: var(--text-main);
    font-size: 0.88rem;
    outline: none;
    font-family: inherit;
}

.form-group input:focus, .form-group textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.creator-preview {
    background: var(--bg-main);
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--glass-border);
}

.creator-preview label {
    font-size: 0.78rem;
    color: var(--text-muted);
    display: block;
    margin-bottom: 6px;
}

.creator-preview pre {
    max-height: 120px;
    overflow-y: auto;
    font-family: monospace;
    font-size: 0.82rem;
    color: var(--success);
    white-space: pre-wrap;
}

/* 拖拽上传全屏遮罩 */
.drag-drop-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(11, 15, 25, 0.85);
    backdrop-filter: blur(10px);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.drag-drop-box {
    text-align: center;
    border: 3px dashed var(--accent);
    border-radius: var(--radius-lg);
    padding: 60px 40px;
    background: var(--bg-card);
    box-shadow: var(--modal-shadow);
}

.drag-drop-box i {
    font-size: 4rem;
    color: var(--accent);
    margin-bottom: 16px;
}

/* 页脚 Footer */
.app-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 30px;
    margin-top: auto;
    border-top: 1px solid var(--glass-border);
    font-size: 0.85rem;
    color: var(--text-muted);
    flex-wrap: wrap;
    gap: 12px;
}

.footer-links {
    display: flex;
    gap: 16px;
}

.footer-links a {
    color: var(--text-sub);
    text-decoration: none;
    transition: color var(--transition-fast);
}

.footer-links a:hover {
    color: var(--accent);
}

/* Toast 提示框 */
.toast-container {
    position: fixed;
    bottom: 30px;
    right: 30px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 3000;
}

.toast {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    background: var(--bg-card);
    border: 1px solid var(--accent);
    border-radius: var(--radius-md);
    color: var(--text-main);
    font-size: 0.9rem;
    font-weight: 500;
    box-shadow: 0 10px 25px rgba(0,0,0,0.3);
    backdrop-filter: blur(16px);
    animation: slideInRight 0.3s ease, fadeOut 0.3s ease 2.7s forwards;
}

.toast.success i { color: var(--success); }
.toast.info i { color: var(--accent); }
.toast.warning i { color: var(--warning); }

/* 关键帧动画 Keyframes */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes scaleUp {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

@keyframes slideInRight {
    from { opacity: 0; transform: translateX(50px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes fadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

/* 响应式断点 Mobile Responsive */
@media (max-width: 868px) {
    .app-header {
        flex-direction: column;
        align-items: stretch;
    }

    .header-search {
        max-width: 100%;
    }

    .header-actions {
        justify-content: flex-end;
    }

    .tools-grid.list-view .tool-card {
        flex-direction: column;
        align-items: stretch;
    }

    .tools-grid.list-view .tool-card-header {
        width: 100%;
    }

    .tools-grid.list-view .tool-desc {
        padding: 10px 0;
    }

    .tools-grid.list-view .tool-tags {
        width: 100%;
        margin-bottom: 10px;
    }

    .form-row {
        grid-template-columns: 1fr;
    }
}
