/* seacoral.top 全局样式 */

/* 暗色模式 - 使用 data-theme 属性 */
[data-theme="dark"] body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
}

[data-theme="dark"] .bg-white { background-color: var(--bg-secondary) !important; }
[data-theme="dark"] .bg-gray-50 { background-color: var(--bg-primary) !important; }
[data-theme="dark"] .bg-gray-100 { background-color: var(--bg-secondary) !important; }
[data-theme="dark"] .text-gray-800 { color: var(--text-primary) !important; }
[data-theme="dark"] .text-gray-700 { color: var(--text-primary) !important; }
[data-theme="dark"] .text-gray-600 { color: var(--text-secondary) !important; }
[data-theme="dark"] .text-gray-500 { color: var(--text-muted) !important; }
[data-theme="dark"] .border-gray-200 { border-color: var(--border-color) !important; }
[data-theme="dark"] .border-gray-300 { border-color: var(--border-color) !important; }
[data-theme="dark"] input, [data-theme="dark"] textarea, [data-theme="dark"] select {
    background-color: var(--bg-input);
    color: var(--text-primary);
    border-color: var(--border-color);
}
[data-theme="dark"] .bg-blue-50 { background-color: var(--bg-secondary) !important; }

/* 动画 */
.fade-in {
    animation: fadeIn 0.3s ease-in;
}

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

/* 代码高亮 */
.markdown-body pre {
    background-color: #1e1e2e;
    color: #cdd6f4;
    padding: 1rem;
    border-radius: 0.5rem;
    overflow-x: auto;
}

.markdown-body code {
    background-color: #1e1e2e;
    color: #cdd6f4;
    padding: 0.125rem 0.375rem;
    border-radius: 0.25rem;
    font-size: 0.875em;
}

.markdown-body pre code {
    background: none;
    padding: 0;
}

.markdown-body h1, .markdown-body h2, .markdown-body h3 {
    border-bottom: 1px solid #e5e7eb;
    padding-bottom: 0.3em;
    margin-top: 1.5em;
}

[data-theme="dark"] .markdown-body h1, [data-theme="dark"] .markdown-body h2, [data-theme="dark"] .markdown-body h3 {
    border-bottom-color: #4a5568;
}

.markdown-body img {
    max-width: 100%;
    border-radius: 0.5rem;
}

.markdown-body blockquote {
    border-left: 4px solid #3b82f6;
    padding-left: 1rem;
    color: #6b7280;
}

.markdown-body table {
    border-collapse: collapse;
    width: 100%;
}

.markdown-body th, .markdown-body td {
    border: 1px solid #e5e7eb;
    padding: 0.5rem;
}

[data-theme="dark"] .markdown-body th, [data-theme="dark"] .markdown-body td {
    border-color: #4a5568;
}

/* 工具卡片悬浮效果 */
.tool-card {
    transition: all 0.2s ease;
}

.tool-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Writeup 卡片 */
.writeup-card {
    transition: all 0.2s ease;
}

.writeup-card:hover {
    border-color: #3b82f6;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.15);
}

/* 标签样式 */
.tag {
    display: inline-block;
    padding: 0.125rem 0.5rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
}

/* 学习笔记分类标签 */
.tag-frontend { background-color: #dbeafe; color: #1d4ed8; }
.tag-backend { background-color: #d1fae5; color: #059669; }
.tag-security { background-color: #fee2e2; color: #dc2626; }
.tag-algorithm { background-color: #ede9fe; color: #6d28d9; }
.tag-database { background-color: #fef3c7; color: #d97706; }
.tag-devops { background-color: #cffafe; color: #0891b2; }
.tag-ai { background-color: #fce7f3; color: #be185d; }
.tag-os { background-color: #e0e7ff; color: #4338ca; }
.tag-network { background-color: #ccfbf1; color: #0f766e; }
.tag-thoughts { background-color: #f3f4f6; color: #4b5563; }

[data-theme="dark"] .tag-frontend { background-color: #1e3a5f; color: #60a5fa; }
[data-theme="dark"] .tag-backend { background-color: #064e3b; color: #6ee7b7; }
[data-theme="dark"] .tag-security { background-color: #4c1d1d; color: #fca5a5; }
[data-theme="dark"] .tag-algorithm { background-color: #2e1065; color: #c4b5fd; }
[data-theme="dark"] .tag-database { background-color: #451a03; color: #fbbf24; }
[data-theme="dark"] .tag-devops { background-color: #164e63; color: #67e8f9; }
[data-theme="dark"] .tag-ai { background-color: #500724; color: #f9a8d4; }
[data-theme="dark"] .tag-os { background-color: #312e81; color: #a5b4fc; }
[data-theme="dark"] .tag-network { background-color: #134e4a; color: #5eead4; }
[data-theme="dark"] .tag-thoughts { background-color: #1f2937; color: #9ca3af; }

/* 兼容旧分类 */
.tag-web { background-color: #dbeafe; color: #1d4ed8; }
.tag-pwn { background-color: #fee2e2; color: #dc2626; }
.tag-crypto { background-color: #fef3c7; color: #d97706; }
.tag-reverse { background-color: #e0e7ff; color: #4338ca; }
.tag-misc { background-color: #f3f4f6; color: #4b5563; }

[data-theme="dark"] .tag-web { background-color: #1e3a5f; color: #60a5fa; }
[data-theme="dark"] .tag-pwn { background-color: #4c1d1d; color: #fca5a5; }
[data-theme="dark"] .tag-crypto { background-color: #451a03; color: #fbbf24; }
[data-theme="dark"] .tag-reverse { background-color: #312e81; color: #a5b4fc; }
[data-theme="dark"] .tag-misc { background-color: #1f2937; color: #9ca3af; }

/* 笔记分类侧边栏 */
.category-sidebar .cat-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.15s;
    font-size: 0.875rem;
    color: #6b7280;
}
.category-sidebar .cat-item:hover {
    background-color: #f3f4f6;
    color: #1f2937;
}
.category-sidebar .cat-item.active {
    background-color: #eff6ff;
    color: #2563eb;
    font-weight: 600;
}
[data-theme="dark"] .category-sidebar .cat-item { color: #9ca3af; }
[data-theme="dark"] .category-sidebar .cat-item:hover { background-color: #1f2937; color: #e5e7eb; }
[data-theme="dark"] .category-sidebar .cat-item.active { background-color: #1e3a5f; color: #60a5fa; }

/* 笔记卡片 */
.note-card {
    transition: all 0.2s ease;
    border: 1px solid #e5e7eb;
    background: white;
}
.note-card:hover {
    border-color: #93c5fd;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.1);
    transform: translateY(-1px);
}
[data-theme="dark"] .note-card { border-color: #374151; background: #1f2937; }
[data-theme="dark"] .note-card:hover { border-color: #3b82f6; }

/* 笔记标签chips */
.tag-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 10px;
    border-radius: 9999px;
    font-size: 0.75rem;
    background: #f3f4f6;
    color: #6b7280;
    border: 1px solid #e5e7eb;
}
[data-theme="dark"] .tag-chip { background: #1f2937; color: #9ca3af; border-color: #374151; }
.tag-chip .remove-tag {
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    opacity: 0.5;
}
.tag-chip .remove-tag:hover { opacity: 1; }

/* 分类图标选择器 */
.cat-picker-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 8px;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.15s;
    font-size: 0.8rem;
}
.cat-picker-item:hover { background: #f3f4f6; }
.cat-picker-item.selected { border-color: #3b82f6; background: #eff6ff; }
[data-theme="dark"] .cat-picker-item:hover { background: #1f2937; }
[data-theme="dark"] .cat-picker-item.selected { border-color: #3b82f6; background: #1e3a5f; }

/* 加载动画 */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(59, 130, 246, 0.3);
    border-radius: 50%;
    border-top-color: #3b82f6;
    animation: spin 0.8s ease-in-out infinite;
}

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

/* 编辑器 */
.editor-toolbar {
    display: flex;
    gap: 0.25rem;
    padding: 0.5rem;
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
    border-bottom: none;
    border-radius: 0.5rem 0.5rem 0 0;
}

[data-theme="dark"] .editor-toolbar {
    background: #1a1a2e;
    border-color: #4a5568;
}

.editor-toolbar button {
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.875rem;
    color: #4b5563;
}

.editor-toolbar button:hover {
    background-color: #e5e7eb;
}

[data-theme="dark"] .editor-toolbar button {
    color: #d0d0d0;
}

[data-theme="dark"] .editor-toolbar button:hover {
    background-color: #2d3748;
}
