/* Lottie Gradient Editor - Styles */

* { box-sizing: border-box; }

/* ===== 响应式缩放 - 根据屏幕 CSS 宽度自动调整 ===== */

/* 基础设置（笔记本/小屏幕） */
html {
    font-size: 14px;
}

/* 大屏幕笔记本 / 外接显示器 */
@media (min-width: 1440px) {
    html { font-size: 15px; }
}

/* 1080p 显示器 */
@media (min-width: 1920px) {
    html { font-size: 16px; }
}

/* 4K 显示器（Windows 150% 缩放，CSS 宽度约 2560px） */
@media (min-width: 2400px) {
    html { font-size: 20px; }
}

/* 4K 显示器（100% 缩放，CSS 宽度约 3840px） */
@media (min-width: 3200px) {
    html { font-size: 26px; }
}

/* 5K+ 超高分显示器 */
@media (min-width: 4800px) {
    html { font-size: 32px; }
}

/* ===== 减少动画偏好 ===== */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ===== 安全区域支持 ===== */
.app-wrapper {
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
}

header {
    padding-top: env(safe-area-inset-top);
}

/* ===== 弹窗滚动控制 ===== */
.modal-content {
    overscroll-behavior: contain;
}

/* ===== 文本截断工具类 ===== */
.truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ===== 颜色选择器焦点状态 ===== */
input[type=color]:focus-visible {
    outline: none;
    box-shadow: 0 0 0 2px #3b82f6;
}

/* ===== 可随字体缩放的布局尺寸 ===== */

/* 内容区域最大宽度（替代固定 1600px） */
.content-max-w {
    max-width: 110rem;
    margin-left: auto;
    margin-right: auto;
}

/* 卡片高度 - 按比例分配右侧列高度 */
.gradient-list-panel { flex: 2; min-height: 0; }
.editor-panel { flex: 3; min-height: 0; }

/* 滚动容器高度 - 填满父卡片剩余空间 */
.gradient-list-content { flex: 1; min-height: 0; }
.editor-content { flex: 1; min-height: 0; }

/* Lottie 动画容器 - 固定 1:1 宽高比 */
.lottie-1x1 {
    aspect-ratio: 1 / 1;
    width: 100%;
}

/* 强制 Lottie 渲染的 SVG 填满容器，不受动画原始尺寸影响 */
.lottie-1x1 svg {
    width: 100% !important;
    height: 100% !important;
    display: block;
}

body { 
    font-family: 'Inter',system-ui,sans-serif;
    overflow-x: hidden;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

/* 应用包装器 */
.app-wrapper {
    width: 100%;
    max-width: 100vw;
}

::-webkit-scrollbar { width: 8px; height: 8px; }

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

::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }

.alpha-checkered {
    background-color: #fff;
    background-image:
        linear-gradient(45deg, #e2e8f0 25%, transparent 25%),
        linear-gradient(-45deg, #e2e8f0 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #e2e8f0 75%),
        linear-gradient(-45deg, transparent 75%, #e2e8f0 75%);
    background-size: 20px 20px;
    background-position: 0 0, 0 10px, 10px -10px, -10px 0;
}

.gradient-preview-bar {
    height: 40px;
    border-radius: 8px;
    border: 1px solid rgba(0,0,0,0.1);
}

input[type=range] {
    -webkit-appearance: none;
    height: 6px;
    background: #e2e8f0;
    border-radius: 3px;
}

input[type=range]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    background: #3b82f6;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

input[type=color] {
    -webkit-appearance: none;
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    padding: 0;
}

input[type=color]::-webkit-color-swatch-wrapper { padding: 0; }

input[type=color]::-webkit-color-swatch { border: none; border-radius: 8px; }

.glass {
    background: rgba(255,255,255,0.7);
    backdrop-filter: blur(10px);
}

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

.animate-fade-in { animation: fadeIn 0.3s ease-out; }

.gradient-item { 
    transition: transform 0.2s ease, background 0.2s ease;
    cursor: pointer;
}

.gradient-item:focus-visible {
    outline: none;
    box-shadow: inset 0 0 0 2px #3b82f6;
    border-radius: 0.5rem;
}

.gradient-item:hover { transform: translateX(4px); }

.gradient-item.selected {
    background: linear-gradient(90deg, rgba(59,130,246,0.1) 0%, rgba(59,130,246,0.05) 100%);
    border-left: 3px solid #3b82f6;
}

.btn-primary {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    transition: transform 0.2s, box-shadow 0.2s;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59,130,246,0.4);
}

.btn-primary:focus-visible {
    outline: none;
    box-shadow: 0 0 0 2px white, 0 0 0 4px #3b82f6;
}

.btn-secondary {
    background: #f1f5f9;
    transition: background 0.2s;
}

.btn-secondary:hover { background: #e2e8f0; }

.btn-secondary:focus-visible {
    outline: none;
    box-shadow: 0 0 0 2px white, 0 0 0 4px #94a3b8;
}

.card { transition: transform 0.3s, box-shadow 0.3s; }

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 20px 40px -10px rgba(0,0,0,0.1);
}

input[type=number] { -moz-appearance: textfield; }

input[type=number]::-webkit-outer-spin-button,
input[type=number]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.drop-zone {
    transition: border-color 0.3s, background 0.3s;
    border: 2px dashed transparent;
}

.drop-zone.drag-over {
    border-color: #3b82f6;
    background: rgba(59,130,246,0.05);
}
