/* CSS变量定义 - 冷灰色极简科技风 */
:root {
    --bg-primary: #F8FAFC; /* 极浅冷灰 */
    --bg-secondary: #FFFFFF; /* 白 */
    --text-primary: #1E293B; /* 深炭灰 */
    --text-secondary: #64748B; /* 中冷灰 */
    --border-color: #E2E8F0; /* 浅冷灰 */
    --primary-color: #475569; /* 中性冷灰 */
    --accent-color: #334155; /* 深冷灰 */
    --disabled-color: #94A3B8; /* 浅冷灰 */
    --shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    --radius: 12px;
}



/* 自定义样式 */
body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    line-height: 1.5;
}

header {
    background-color: #ffffff;
    border-bottom: 1px solid #e5e5ea;
    transition: all 0.3s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    position: sticky;
    top: 0;
    z-index: 100;
}

header h1 {
    font-size: 24px;
    font-weight: 600;
    color: var(--text-primary);
}

header a, header button {
    font-size: 14px;
    color: var(--text-secondary);
    transition: all 0.2s ease;
}

header a:hover, header button:hover {
    color: var(--text-primary);
    text-decoration: none;
}



#upload-area {
    min-height: 300px;
    border: 2px dashed var(--border-color);
    background-color: var(--bg-secondary);
    border-radius: var(--radius);
    transition: all 0.3s ease;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 24px;
}

#upload-area:hover {
    border-color: var(--primary-color);
    box-shadow: 0 8px 24px rgba(77, 171, 247, 0.15);
    background-color: rgba(77, 171, 247, 0.02);
}

#upload-area.dragover {
    border-color: var(--primary-color);
    background-color: rgba(77, 171, 247, 0.05);
}

#upload-area h2 {
    font-size: 32px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

#upload-area p {
    font-size: 16px;
    color: var(--text-secondary);
    margin-bottom: 24px;
    max-width: 400px;
    text-align: center;
}

#upload-btn {
    background-color: var(--primary-color);
    color: white;
    font-size: 14px;
    font-weight: 500;
    padding: 12px 24px;
    border-radius: var(--radius);
    border: none;
    outline: none;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(77, 171, 247, 0.2);
    transition: all 0.3s ease;
}

#upload-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(77, 171, 247, 0.3);
    background-color: #3b99e0;
}

#upload-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(77, 171, 247, 0.2);
}









canvas {
    image-rendering: pixelated;
}

.content-section {
    background-color: var(--bg-secondary);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
    overflow: hidden;
    margin-bottom: 24px;
    padding: 24px;
}



#materials-list {
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 16px;
    background-color: var(--bg-secondary);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.material-item {
    display: flex;
    align-items: center;
    padding: 8px 0;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.material-item:hover {
    background-color: rgba(77, 171, 247, 0.05);
    padding-left: 8px;
}

.material-color {
    width: 24px;
    height: 24px;
    border-radius: 6px;
    margin-right: 12px;
    border: 1px solid var(--border-color);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.material-info {
    flex: 1;
    color: var(--text-primary);
    font-size: 14px;
}

.material-count {
    font-weight: 500;
    color: var(--primary-color);
    font-size: 14px;
}

footer {
    background-color: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    transition: all 0.3s ease;
    margin-top: 40px;
}



/* 响应式调整 */
@media (max-width: 1024px) {
    .lg\:col-span-1,
    .lg\:col-span-2 {
        grid-column: span 1 / span 1;
    }
    
    .md\:grid-cols-2 {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .grid-cols-2 {
        grid-template-columns: 1fr;
    }
    
    .grid-cols-4 {
        grid-template-columns: 1fr 1fr;
    }
    
    header h1 {
        font-size: 1.25rem;
    }
    
    #upload-area {
        padding: 2rem 1.5rem;
        min-height: 250px;
    }
    
    #upload-area h2 {
        font-size: 1.75rem;
    }
    
    section {
        margin-bottom: 1.5rem;
        padding: 1.5rem;
    }
    
    .container {
        padding: 0 1rem;
    }
    
    button {
        padding: 0.75rem 1rem;
        font-size: 0.875rem;
    }
    
    h3 {
        font-size: 1.125rem;
    }
    
    h1 {
        font-size: 24px;
    }
    
    h2 {
        font-size: 20px;
    }
    
    input[type="range"] {
        height: 6px;
    }
    
    input[type="range"]::-webkit-slider-thumb {
        width: 20px;
        height: 20px;
    }
    
    #materials-list {
        max-height: 40vh;
    }
    
    /* 模态框响应式 */
    #pattern-modal .bg-white {
        margin: 1rem;
        max-height: 90vh;
        border-radius: var(--radius);
    }
    
    #pattern-canvas {
        max-width: 100%;
        height: auto;
    }
    
    /* 预览区域响应式 */
    #original-image, #preview-canvas {
        max-height: 30vh;
    }
    
    /* 按钮间距 */
    .space-y-4 > * {
        margin-bottom: 1rem;
    }
    
    .space-y-4 > *:last-child {
        margin-bottom: 0;
    }
    
    /* 移动菜单样式 */
    #mobile-menu {
        transition: all 0.3s ease;
        box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
        position: sticky;
        top: 60px;
        z-index: 99;
    }
    
    #mobile-menu.show {
        display: block;
    }
    
    #mobile-menu.hidden {
        display: none;
    }
    
    #mobile-user-dropdown-menu {
        transition: all 0.3s ease;
    }
    
    #mobile-user-dropdown-menu.show {
        display: block;
    }
    
    #mobile-user-dropdown-menu.hidden {
        display: none;
    }
    
    /* 导出按钮响应式 */
    .grid-cols-1.md\:grid-cols-2 {
        grid-template-columns: 1fr;
    }
}

/* 超小屏幕设备 */
@media (max-width: 480px) {
    header h1 {
        font-size: 1.1rem;
    }
    
    #upload-area {
        padding: 1.5rem 1rem;
        min-height: 200px;
    }
    
    #upload-area h2 {
        font-size: 1.5rem;
    }
    
    #upload-area p {
        font-size: 0.875rem;
    }
    
    section {
        padding: 1.25rem;
    }
    
    button {
        padding: 0.625rem 0.875rem;
        font-size: 0.8125rem;
    }
    
    h3 {
        font-size: 1rem;
    }
    
    h1 {
        font-size: 20px;
    }
    
    h2 {
        font-size: 18px;
    }
    
    .grid-cols-4 {
        grid-template-columns: 1fr;
    }
    
    /* 滑块标签调整 */
    label {
        font-size: 0.875rem;
    }
    
    /* 材料清单调整 */
    .material-item {
        font-size: 0.875rem;
    }
    
    .material-color {
        width: 20px;
        height: 20px;
    }
    
    /* 预览区域调整 */
    #original-image, #preview-canvas {
        max-height: 25vh;
    }
    
    /* 模板选择按钮调整 */
    .template-btn {
        padding: 8px 12px;
        font-size: 12px;
    }
}

/* 动画效果 */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

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

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-5px);
    }
}

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

/* Loading 动画 */
.loading {
    animation: pulse 1.5s ease-in-out infinite;
}

.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* 加载遮罩 */
.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    border-radius: var(--radius);
}

section {
    animation: fadeIn 0.5s ease-out;
    animation-fill-mode: both;
}

/* 滚动渐入动画 */
.fade-in {
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.6s ease-out;
}

.fade-in.visible {
    opacity: 1;
    transform: translateY(0);
}

/* 按钮动画 */
button {
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
    font-weight: 500;
    border: none;
    outline: none;
}

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

button:active {
    transform: translateY(0);
}

/* 按钮点击波纹效果 */
button::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

button:active::after {
    width: 300px;
    height: 300px;
}

/* 模板选择按钮样式 - 冷灰色极简科技风 */
.template-btn {
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.template-btn.active {
    background-color: var(--accent-color) !important;
    color: #ffffff !important;
    border-color: var(--accent-color) !important;
    font-weight: 600 !important;
}

.template-btn.active:hover {
    background-color: #273444 !important;
    color: #ffffff !important;
    box-shadow: 0 6px 16px rgba(51, 65, 85, 0.4) !important;
}

/* 确保模板按钮文本颜色在激活状态下为白色 */
.template-btn.active span {
    color: #ffffff !important;
}

.template-btn.active:hover span {
    color: #ffffff !important;
}



/* 上传区域动画 */
#upload-area:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}

/* 图片加载动画 */
#original-image, #preview-canvas {
    transition: all 0.5s ease;
}

/* 参数调节滑块动画 */
input[type="range"] {
    transition: all 0.3s ease;
}

/* 材料项动画 */
.material-item {
    transition: all 0.3s ease;
}

.material-item:hover {
    background-color: rgba(0, 113, 227, 0.05);
    padding-left: 8px;
}

/* 模态框动画 */
#pattern-modal {
    animation: fadeIn 0.3s ease-out;
}

#pattern-modal .bg-white {
    animation: slideIn 0.3s ease-out;
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    border-radius: var(--radius);
}

/* 卡片悬停效果 */
section:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}

/* 滚动条样式 */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* 按钮样式 - 冷灰色极简科技风 */
button {
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    border-radius: var(--radius);
    font-size: 14px;
    line-height: 1.5;
    font-weight: 500;
    border: none;
    outline: none;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    background-color: var(--accent-color);
    color: #ffffff;
    box-shadow: 0 2px 4px rgba(51, 65, 85, 0.2);
}

button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(51, 65, 85, 0.3);
    background-color: #273444;
}

button:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(51, 65, 85, 0.2);
}

/* 次要按钮样式 */
button.secondary {
    background-color: transparent;
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    box-shadow: none;
}

button.secondary:hover {
    background-color: var(--bg-primary);
    border-color: var(--primary-color);
    box-shadow: 0 2px 4px rgba(71, 85, 105, 0.1);
}

/* 现代按钮样式 - 基于 CodePen 效果 */
.btn-modern {
    position: relative;
    padding: 12px 24px;
    font-size: 14px;
    font-weight: 500;
    color: #ffffff;
    background: var(--accent-color);
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    overflow: hidden;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(51, 65, 85, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-modern::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.6s ease;
}

.btn-modern:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 16px rgba(51, 65, 85, 0.4);
    background: #273444;
}

.btn-modern:hover::before {
    left: 100%;
}

.btn-modern:active {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(51, 65, 85, 0.3);
}

/* 现代次要按钮样式 */
.btn-modern.secondary {
    background: transparent;
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.btn-modern.secondary:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
    box-shadow: 0 4px 12px rgba(71, 85, 105, 0.2);
    background: transparent;
}

.btn-modern.secondary::before {
    background: linear-gradient(90deg, transparent, rgba(71, 85, 105, 0.1), transparent);
}

/* 按钮点击波纹效果 */
button::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

button:active::after {
    width: 300px;
    height: 300px;
}

/* 导出按钮样式 - 现代简约专业风 */
#export-png, #export-pdf, #generate-pattern, #copy-materials, #save-work {
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    font-weight: 500;
    width: 100%;
    padding: 14px;
    font-size: 14px;
    margin-bottom: 12px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background-color: var(--primary-color);
    color: #ffffff;
    border: none;
    box-shadow: 0 2px 4px rgba(77, 171, 247, 0.2);
}

#export-png:hover, #export-pdf:hover, #generate-pattern:hover, #copy-materials:hover, #save-work:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(77, 171, 247, 0.3);
    background-color: #3b99e0;
}



/* 滑块样式 */
input[type="range"] {
    -webkit-appearance: none;
    height: 6px;
    background: var(--border-color);
    border-radius: 3px;
    outline: none;
    transition: all 0.3s ease;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    background: var(--primary-color);
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(77, 171, 247, 0.3);
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.1);
    background: #3b99e0;
    box-shadow: 0 3px 8px rgba(77, 171, 247, 0.4);
}

input[type="range"]:hover {
    background: #e0e7f0;
}

/* 模态框样式 */
#pattern-modal {
    animation: fadeIn 0.3s ease-out;
}

#pattern-modal .bg-white {
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    transition: all 0.3s ease;
    border-radius: var(--radius);
}

/* 放大浏览模态框样式 */
#zoom-modal {
    animation: fadeIn 0.3s ease-out;
}

#zoom-modal .bg-white {
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    transition: all 0.3s ease;
    border-radius: var(--radius);
    max-width: 90vw;
    max-height: 90vh;
}

/* 输入框样式 */
select {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.75rem;
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 14px;
    transition: all 0.2s ease;
}

select:hover {
    border-color: var(--accent-color);
}

select:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.1);
}

/* 标题样式 */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.2;
    color: var(--text-primary);
    margin-bottom: 16px;
}

h1 {
    font-size: 28px;
}

h2 {
    font-size: 24px;
}

h3 {
    font-size: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
}

h4 {
    font-size: 16px;
}

/* 链接样式 */
a {
    color: var(--primary-color);
    text-decoration: none;
    transition: all 0.2s ease;
}

a:hover {
    text-decoration: underline;
    color: #3b99e0;
}

/* 图标样式 */
.fa {
    color: var(--text-secondary);
    transition: all 0.2s ease;
    font-size: 16px;
}

section:hover .fa {
    color: var(--primary-color);
}

button .fa {
    color: inherit;
    margin-right: 8px;
}

/* 预览区域样式 */
#original-image, #preview-canvas {
    border-radius: var(--radius);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
}

#original-image:hover, #preview-canvas:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

/* 上传按钮样式 */
#upload-btn {
    background-color: var(--primary-color);
    color: white;
    font-size: 14px;
    font-weight: 500;
    padding: 12px 24px;
    border-radius: var(--radius);
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    border: none;
    outline: none;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(77, 171, 247, 0.2);
}

#upload-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(77, 171, 247, 0.3);
    background-color: #3b99e0;
}

#upload-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(77, 171, 247, 0.2);
}





/* 主题切换按钮样式 - Design Me Agency 风格 */
#theme-toggle, #theme-toggle-mobile {
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    border-radius: 36px;
    padding: 8px 16px;
    border: 1px solid #333333;
    background-color: transparent;
    color: #333333;
}

#theme-toggle:hover, #theme-toggle-mobile:hover {
    background-color: rgba(51, 51, 51, 0.05);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

