/* stylelint-disable at-rule-empty-line-before,at-rule-name-space-after,at-rule-no-unknown */
/* stylelint-disable no-duplicate-selectors */
/* stylelint-disable */
/* stylelint-disable declaration-bang-space-before,no-duplicate-selectors,string-no-newline */
/* ====== 全局基础样式 - Tailwind 风格 ====== */
html,
body,
#root,
#app,
app {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
}

body {
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background-color: #fafafa;
  color: #1e293b;
}

canvas {
  display: block;
}

ul,
ol {
  list-style: none;
}

.action {
  cursor: pointer;
}



/* ====== 滚动条样式 - Tailwind 风格 ====== */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 6px;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 6px;
    border: 2px solid #f1f5f9;
    transition: background 0.2s ease;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

::-webkit-scrollbar-thumb:active {
    background: #64748b;
}

/* Firefox 滚动条样式 */
* {
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 #f1f5f9;
}

/* ====== HTML预览工具栏 - Tailwind 风格 ====== */
.html-preview-toolbar {
    position: absolute;
    top: 30px;
    right: 8px;
    z-index: 15;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px;
    background: rgba(255, 255, 255, 0.98);
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(226, 232, 240, 0.8);
}

/* HTML预览按钮样式 */
.html-preview-btn {
    background: linear-gradient(135deg, #0ea5e9 0%, #0284c7 100%);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 8px 14px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    outline: none;
    box-shadow: 0 2px 6px rgba(14, 165, 233, 0.25);
}

.html-preview-btn:hover {
    background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(14, 165, 233, 0.35);
}

.html-preview-btn:active {
    transform: translateY(0);
    box-shadow: 0 1px 4px rgba(14, 165, 233, 0.25);
}

.html-preview-btn:focus {
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.2);
}

/* 代码块容器样式优化 */
pre[class*="language-"] {
    position: relative;
}

/* 代码块工具栏样式 */
pre[class*="language-"] .toolbar {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px;
    background: rgba(255, 255, 255, 0.98);
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    backdrop-filter: blur(4px);
    border: 1px solid rgba(226, 232, 240, 0.6);
}

/* 响应式设计 */
@media (max-width: 768px) {
    .html-preview-btn {
        padding: 4px 8px;
        font-size: 11px;
    }
    
    .html-preview-toolbar {
        gap: 2px;
        padding: 2px;
    }
    
    /* 移动端时调整位置 */
    .html-preview-toolbar {
        top: 30px;
    }
}

@media (max-width: 480px) {
    .html-preview-toolbar {
        position: static;
        margin-top: 8px;
        margin-bottom: 8px;
        justify-content: center;
        background: rgba(255, 255, 255, 0.98);
    }
    
    pre[class*="language-"] .toolbar ~ .html-preview-toolbar {
        top: auto;
    }
}

/* 编程助手页面样式 */
.code-assistant-container {
    height: 100%;
}

.code-assistant-container .chat-messages::-webkit-scrollbar {
    width: 8px;
}

.code-assistant-container .chat-messages::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 4px;
}

.code-assistant-container .chat-messages::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
    transition: background 0.2s;
}

.code-assistant-container .chat-messages::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

.code-assistant-container .monaco-editor {
    border: 1px solid #d9d9d9;
    border-radius: 4px;
}

/* 打字机效果 */
@keyframes blink {
    0%, 50% {
        opacity: 1;
    }
    51%, 100% {
        opacity: 0;
    }
}

.typing-cursor::after {
    content: '|';
    animation: blink 1s infinite;
    margin-left: 2px;
}

/* ====== 登录页面样式 - Tailwind 风格 ====== */
/* 登录容器 */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(to bottom right, #f0f9ff, #e0f2fe, #faf5ff);
    padding: 1rem;
}

/* 登录卡片 */
.login-card {
    background: white;
    border-radius: 1.5rem;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    padding: 3rem;
    width: 100%;
    max-width: 480px;
    border: 1px solid rgba(226, 232, 240, 0.8);
    animation: slideIn 0.4s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 头部 */
.login-header {
    text-align: center;
    margin-bottom: 2.5rem;
}

.login-logo {
    width: 72px;
    height: 72px;
    margin: 0 auto 1.25rem;
    filter: drop-shadow(0 2px 8px rgba(14, 165, 233, 0.15));
}

.login-title {
    font-size: 2rem;
    font-weight: 700;
    background: linear-gradient(135deg, #0ea5e9 0%, #a855f7 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin: 0 0 0.5rem 0;
}

.login-subtitle {
    font-size: 0.875rem;
    color: #64748b;
    font-weight: 500;
    margin: 0;
}

/* 表单 */
.login-form {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

/* 警告框 */
.alert {
    padding: 1rem;
    border-radius: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.875rem;
}

.alert-error {
    background-color: #fef2f2;
    border: 1px solid #fecaca;
    color: #dc2626;
    box-shadow: 0 1px 2px rgba(220, 38, 38, 0.05);
}

.alert-icon {
    width: 1.25rem;
    height: 1.25rem;
    flex-shrink: 0;
}

/* 表单组 */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: #374151;
}

.label-icon {
    width: 1rem;
    height: 1rem;
    color: #6b7280;
}

/* 输入框 */
.form-input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid #e2e8f0;
    border-radius: 0.75rem;
    font-size: 0.875rem;
    transition: all 0.2s ease;
    outline: none;
    background-color: #fafafa;
}

.form-input:hover {
    border-color: #cbd5e1;
    background-color: #ffffff;
}

.form-input:focus {
    border-color: #0ea5e9;
    background-color: #ffffff;
    box-shadow: 0 0 0 4px rgba(14, 165, 233, 0.1);
}

.form-input:disabled {
    background-color: #f3f4f6;
    cursor: not-allowed;
    opacity: 0.6;
}

.form-input::placeholder {
    color: #9ca3af;
}

/* 密码框容器 */
.password-wrapper {
    position: relative;
}

.password-wrapper .form-input {
    padding-right: 2.75rem;
}

.password-toggle {
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    padding: 0.25rem;
    cursor: pointer;
    color: #6b7280;
    transition: color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.password-toggle:hover {
    color: #374151;
}

.password-toggle:focus {
    outline: none;
    color: #667eea;
}

/* 登录按钮 */
.btn-login {
    width: 100%;
    padding: 0.875rem 1.5rem;
    background: linear-gradient(135deg, #0ea5e9 0%, #0284c7 100%);
    color: white;
    border: none;
    border-radius: 0.75rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
    box-shadow: 0 4px 12px rgba(14, 165, 233, 0.25);
}

.btn-login:hover:not(:disabled) {
    background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(14, 165, 233, 0.35);
}

.btn-login:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(14, 165, 233, 0.25);
}

.btn-login:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* 加载动画 */
.loading-spinner {
    width: 1rem;
    height: 1rem;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* 提示信息 */
.login-tips {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid #e2e8f0;
}

.tips-grid {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.tip-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
}

.tip-label {
    color: #6b7280;
    font-weight: 500;
}

.tip-code {
    background: linear-gradient(135deg, #f0f9ff 0%, #faf5ff 100%);
    padding: 0.375rem 0.625rem;
    border-radius: 0.5rem;
    font-family: 'SF Mono', 'Monaco', 'Cascadia Code', 'Roboto Mono', 'Courier New', monospace;
    font-size: 0.813rem;
    color: #0ea5e9;
    font-weight: 600;
    border: 1px solid #bae6fd;
}

/* 登录页面响应式设计 */
@media (max-width: 640px) {
    .login-card {
        padding: 2rem;
        border-radius: 1.25rem;
    }

    .login-title {
        font-size: 1.75rem;
    }

    .login-logo {
        width: 64px;
        height: 64px;
    }
    
    .login-header {
        margin-bottom: 2rem;
    }
}
/* 
====== 会话历史列表优化样式 ====== */

/* 会话列表项淡入动画 */
@keyframes sessionFadeIn {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 会话列表项样式 */
.session-item {
    animation: sessionFadeIn 0.2s ease-out;
    will-change: transform, opacity;
}

/* 会话列表项悬停效果优化 */
.session-item:hover {
    transform: translateX(4px);
}

/* 会话列表项激活状态 */
.session-item.active {
    animation: sessionFadeIn 0.15s ease-out;
}

/* 加载动画优化 */
@keyframes smoothSpin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

.animate-spin {
    animation: smoothSpin 1s linear infinite;
}

/* 会话列表滚动性能优化 */
.session-list-container {
    contain: layout style paint;
    will-change: scroll-position;
}

/* 会话列表项性能优化 */
.session-list-item {
    contain: layout style;
    will-change: transform;
}

/* 过渡效果优化 */
.transition-optimized {
    transition: transform 0.15s cubic-bezier(0.4, 0, 0.2, 1),
                opacity 0.15s cubic-bezier(0.4, 0, 0.2, 1),
                background-color 0.15s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 会话切换加载遮罩 */
.session-loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(2px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    animation: fadeIn 0.1s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* 骨架屏加载动画 */
@keyframes shimmer {
    0% {
        background-position: -468px 0;
    }
    100% {
        background-position: 468px 0;
    }
}

.skeleton-loading {
    animation: shimmer 1.2s ease-in-out infinite;
    background: linear-gradient(
        to right,
        #f0f0f0 0%,
        #e0e0e0 20%,
        #f0f0f0 40%,
        #f0f0f0 100%
    );
    background-size: 800px 104px;
}

/* 虚拟滚动优化 */
.virtual-scroll-container {
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    will-change: scroll-position;
}

/* GPU 加速优化 */
.gpu-accelerated {
    transform: translateZ(0);
    backface-visibility: hidden;
    perspective: 1000px;
}

/* 减少重绘和回流 */
.optimize-repaint {
    contain: layout style paint;
    content-visibility: auto;
}

/* 响应式优化 */
@media (max-width: 1024px) {
    .session-item:hover {
        transform: none;
    }
}

/* 移动端触摸优化 */
@media (hover: none) and (pointer: coarse) {
    .session-item {
        -webkit-tap-highlight-color: transparent;
        touch-action: manipulation;
    }
    
    .session-item:active {
        transform: scale(0.98);
    }
}

/* 高性能滚动 */
.smooth-scroll {
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

/* 防止布局抖动 */
.prevent-layout-shift {
    min-height: 44px;
    contain: layout;
}
