/* XA Note Ultimate Refresh - Dynamic Edition */
/* Build: 2026-02-12-v1.2.7 | Cache-Busting: 1770872229123 */

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

:root {
    --primary-gradient: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
    --sidebar-bg-glass: rgba(255, 255, 255, 0.7);
    --item-hover-bg: rgba(99, 102, 241, 0.08);
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Outfit', -apple-system, sans-serif;
    background-color: #f8fafc;
}

/* --- 高级交互细节 --- */
::selection {
    background: rgba(99, 102, 241, 0.2);
    color: inherit;
}

*:focus-visible {
    outline: 2px solid rgba(99, 102, 241, 0.5) !important;
    outline-offset: 2px !important;
}

aside,
.w-64 {
    background-color: var(--sidebar-bg-glass) !important;
    backdrop-filter: blur(12px) !important;
    -webkit-backdrop-filter: blur(12px) !important;
    overflow: visible !important;
    border-right: 1px solid rgba(0, 0, 0, 0.05);
}

.note-item {
    margin: 8px 12px !important;
    border-radius: 12px !important;
    background: white !important;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1) !important;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1) !important;
    z-index: 1 !important;
    border-left: 4px solid transparent !important;
}

.note-item:hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1) !important;
}

/* --- 选中态样式 --- */
.note-item.active,
.note-item[class*="active"],
.note-item[class*="border-blue-"],
.note-item[class*="ring-"],
#root .note-item.bg-blue-50,
#root .note-item.border-blue-500 {
    background-color: #ffffff !important;
    background-image: none !important;
    border-left: 4px solid #3b82f6 !important;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.15) !important;
}

/* --- 超淡雅彩色变体 (Original Macaron Style) --- */
.note-variant-1 {
    background: linear-gradient(to right, #fcfdff 0%, #edf4ff 100%) !important;
    border-left-color: #3b82f61a !important;
}

.note-variant-2 {
    background: linear-gradient(to right, #fdfffe 0%, #effff6 100%) !important;
    border-left-color: #22c55e1a !important;
}

.note-variant-3 {
    background: linear-gradient(to right, #fefeff 0%, #f6f4ff 100%) !important;
    border-left-color: #8b5cf61a !important;
}

.note-variant-4 {
    background: linear-gradient(to right, #fffefe 0%, #fff4f8 100%) !important;
    border-left-color: #ec48991a !important;
}

.note-variant-5 {
    background: linear-gradient(to right, #fffefd 0%, #fffbf2 100%) !important;
    border-left-color: #f59e0b1a !important;
}

.note-variant-6 {
    background: linear-gradient(to right, #f0fdfa 0%, #f2ffff 100%) !important;
    border-left-color: #14b8a61a !important;
}

/* Modal & Portal Styling */
.custom-portal-modal,
.fixed.bottom-4.left-14,
[class*="fixed"][class*="bottom-"] {
    position: fixed !important;
    z-index: 9999999 !important;
    left: 10px !important;
    bottom: 60px !important;
    min-width: 180px !important;
    max-width: 220px !important;
    background: white !important;
    padding: 8px !important;
    border-radius: 10px !important;
    border: 1px solid rgba(0, 0, 0, 0.1) !important;
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.2) !important;
    font-size: 12px !important;
}

.custom-portal-modal * {
    margin-bottom: 2px !important;
    line-height: 1.2 !important;
}

/* Global Styling */
button {
    transition: all 0.2s ease !important;
}

button:active {
    transform: scale(0.95) !important;
}

/* --- 高级毛玻璃滚动条 --- */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.15);
    border-radius: 10px;
    transition: background 0.3s ease;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(99, 102, 241, 0.5);
}

/* Splash Screen 沉浸式加载体验 */
#loader-wrapper {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    /* 毛玻璃与雅致背景 */
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 99999;
}

#loader {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

#loader-wrapper.loaded {
    opacity: 0;
    visibility: hidden;
    transition: 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.loader-logo {
    animation: breathe 2.5s ease-in-out infinite alternate;
}

@keyframes breathe {
    0% {
        transform: scale(0.95);
        opacity: 0.8;
    }

    100% {
        transform: scale(1.05);
        opacity: 1;
        filter: drop-shadow(0 0 20px rgba(99, 102, 241, 0.4));
    }
}

.loader-text {
    margin-top: 20px;
    font-weight: 600;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    font-size: 1.25rem;
    letter-spacing: 1.5px;
    animation: fadeIn 1s ease-out;
}

.loader-progress {
    margin-top: 20px;
    width: 150px;
    height: 4px;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 4px;
    overflow: hidden;
}

.loader-progress-bar {
    width: 0%;
    height: 100%;
    background: var(--primary-gradient);
    animation: loading 2s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes loading {
    0% {
        width: 0%;
    }

    50% {
        width: 60%;
    }

    100% {
        width: 100%;
    }
}

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

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* --- 极简自适应代码框 (Minimal Adaptive Code Block v1.2.7) --- */
/* 安全的代码容器：限制最大宽度且超出部分提供滚动条，避免撑爆外层 flex 布局 */
.md-editor-code,
.md-editor-preview pre {
    max-width: 100% !important;
    overflow-x: auto !important;
}

/* --- Flexbox 布局固化 (Universal Layout Stability Fix) --- */
/* 核心逻辑：防止 Flex 子元素被其内部的长内容（如超长代码、表格或连续字符）撑开。
   min-width: 0 是破解 Flexbox 自动最小宽度限制的关键。 */

/* 1. 针对主内容区域的全局约束 */
main,
.flex-1,
.flex-auto {
    min-width: 0 !important;
}

/* 2. 针对特定层级的加固（解决 Desktop 带 TOC 情况下的按钮位移） */
main .hidden.md\:flex.w-full>.flex-1,
div#root .flex.flex-1.overflow-hidden {
    min-width: 0 !important;
    overflow-x: hidden !important;
    /* 确保容器自身不产生横滚，由内部组件滚动 */
}

/* 3. 针对内容展示区的滚动条自动托管 */
.editor-content-area,
.md-editor-preview,
article {
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: auto !important;
    min-width: 0 !important;
}

/* --- 现代极简自定义滚动条 (Modern Glass Scrollbar) [B4] --- */
/* WebKit (Chrome, Safari, Edge) */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.05);
    border-radius: 10px;
    border: 1px solid transparent;
    background-clip: content-box;
    transition: background 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 侧边栏专属：更纤细隐形 */
aside ::-webkit-scrollbar {
    width: 4px;
}

aside ::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.03);
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.15);
    background-clip: content-box;
}

/* Dark Mode 适配 */
.dark ::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
}

.dark ::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Firefox 兼容性支撑 */
* {
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 0, 0, 0.08) transparent;
}

.dark * {
    scrollbar-color: rgba(255, 255, 255, 0.1) transparent;
}