/* 拼豆图案生成器样式 */

:root {
    --primary-pink: #F472B6;
    --primary-purple: #8B5CF6;
    --primary-gradient: linear-gradient(135deg, #F472B6, #EC4899, #8B5CF6);
    --bg-warm: #FDF2F8;
    --bg-light: #FAFAFA;
    --text-primary: #1F2937;
    --text-secondary: #6B7280;
    --border-color: #E5E7EB;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-pink: 0 8px 24px rgba(244, 114, 182, 0.35);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    font-family: 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background: linear-gradient(180deg, var(--bg-warm) 0%, #FFFFFF 50%, var(--bg-light) 100%);
    min-height: 100vh;
}

/* 顶部装饰条 */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--primary-gradient);
    z-index: 1000;
}

.container {
    max-width: 960px;
    margin: 0 auto;
    padding: 1.5rem 1rem 2.5rem;
}

/* 页面标题 */
.header {
    text-align: center;
    margin-bottom: 2rem;
}

.page-title {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    font-size: 2.25rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 0.75rem;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.page-title svg {
    flex-shrink: 0;
}

.page-subtitle {
    margin: 0;
    font-size: 1.05rem;
    color: var(--text-secondary);
    font-weight: 400;
}

/* 卡片样式 */
.card {
    background: #ffffff;
    border-radius: 1rem;
    padding: 1.75rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-md);
    border: 1px solid rgba(244, 114, 182, 0.1);
    position: relative;
    overflow: hidden;
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--primary-gradient);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.card:hover::before {
    opacity: 1;
}

.main-card {
    background: linear-gradient(135deg, #FFFFFF 0%, #FDF2F8 100%);
}

.section-title {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 1.25rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid transparent;
    border-image: linear-gradient(90deg, #F472B6 0%, transparent 100%) 1;
}

.section-title svg {
    color: var(--primary-pink);
}

/* 上传区域 */
.upload-area {
    border: 2px dashed #F9A8D4;
    border-radius: 1rem;
    padding: 2.5rem 1.5rem;
    text-align: center;
    background: linear-gradient(135deg, #FDF2F8 0%, #FCE7F3 50%, #FBCFE8 100%);
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.upload-area::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 20% 80%, rgba(244, 114, 182, 0.1) 0%, transparent 50%),
                radial-gradient(circle at 80% 20%, rgba(139, 92, 246, 0.1) 0%, transparent 50%);
    pointer-events: none;
}

.upload-area:hover {
    border-color: var(--primary-pink);
    box-shadow: 0 0 0 4px rgba(244, 114, 182, 0.15);
    transform: translateY(-2px);
}

.upload-area.dragover {
    border-color: var(--primary-purple);
    background: linear-gradient(135deg, #F3E8FF 0%, #EDE9FE 50%, #DDD6FE 100%);
    box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.2);
}

.upload-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    position: relative;
    z-index: 1;
}

.upload-icon {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-md);
    animation: float 3s ease-in-out infinite;
}

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

.upload-text {
    text-align: center;
}

.upload-main-text {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 0.25rem;
}

.upload-subtext {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin: 0;
}

.file-info {
    font-size: 0.875rem;
    color: var(--primary-purple);
    font-weight: 500;
    margin-top: 0.5rem;
}

/* 提示框 */
.tip-box {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    margin-top: 1.25rem;
    padding: 1rem 1.25rem;
    background: linear-gradient(135deg, #FEF3C7 0%, #FDE68A 100%);
    border-radius: 0.75rem;
    border-left: 4px solid #F59E0B;
    font-size: 0.875rem;
    color: #92400E;
}

.tip-box svg {
    flex-shrink: 0;
    color: #F59E0B;
    margin-top: 0.1rem;
}

/* 按钮样式 */
.btn {
    padding: 0.65rem 1.5rem;
    border-radius: 9999px;
    border: none;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.25s ease;
    text-decoration: none;
}

.btn-primary {
    background: var(--primary-gradient);
    color: #ffffff;
    box-shadow: var(--shadow-pink);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 28px rgba(244, 114, 182, 0.45);
}

.btn-primary:active {
    transform: translateY(0);
    box-shadow: 0 4px 12px rgba(244, 114, 182, 0.35);
}

.btn-secondary {
    background: #F3F4F6;
    color: #374151;
    border: 1px solid #D1D5DB;
}

.btn-secondary:hover {
    background: #E5E7EB;
    border-color: #9CA3AF;
}

.btn-large {
    padding: 0.85rem 2rem;
    font-size: 1rem;
}

.btn-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    justify-content: center;
}

.main-actions {
    margin-top: 1.75rem;
}

.download-actions {
    margin-top: 1.5rem;
}

/* 参数选项 */
.options-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.25rem;
}

.option-group {
    background: linear-gradient(135deg, #F9FAFB 0%, #F3F4F6 100%);
    border-radius: 0.875rem;
    padding: 1rem 1.25rem;
    border: 1px solid var(--border-color);
}

.option-label {
    font-size: 0.875rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: 0.75rem;
}

.option-items {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.option-chip {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.35rem 0.85rem;
    border-radius: 9999px;
    border: 1px solid #E5E7EB;
    background: #ffffff;
    font-size: 0.825rem;
    color: #4B5563;
    cursor: pointer;
    transition: all 0.2s ease;
}

.option-chip input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.option-chip:hover {
    border-color: var(--primary-pink);
    background: #FDF2F8;
    color: var(--primary-pink);
}

.option-chip:has(input:checked) {
    background: var(--primary-gradient);
    border-color: transparent;
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(244, 114, 182, 0.3);
}

/* 复选框行 */
.options-row {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    margin-top: 1.25rem;
    padding-top: 1.25rem;
    border-top: 1px dashed #E5E7EB;
}

.option-group-inline {
    display: flex;
    align-items: center;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--text-secondary);
    transition: color 0.2s;
}

.checkbox-label:hover {
    color: var(--text-primary);
}

.checkbox-label input {
    display: none;
}

.checkbox-box {
    width: 20px;
    height: 20px;
    border-radius: 6px;
    border: 2px solid #D1D5DB;
    background: #ffffff;
    position: relative;
    transition: all 0.2s ease;
}

.checkbox-label input:checked + .checkbox-box {
    background: var(--primary-gradient);
    border-color: transparent;
}

.checkbox-label input:checked + .checkbox-box::after {
    content: '';
    position: absolute;
    left: 6px;
    top: 2px;
    width: 5px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

/* 预览区域 */
.preview-container {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.preview-wrapper {
    background: #ffffff;
    border: 2px solid #E5E7EB;
    border-radius: 0.75rem;
    padding: 1rem;
    overflow: auto;
    max-height: 500px;
    display: flex;
    justify-content: center;
    align-items: flex-start;
}

#previewCanvas {
    max-width: 100%;
    height: auto;
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
}

.preview-info {
    display: flex;
    justify-content: center;
    gap: 2rem;
    flex-wrap: wrap;
}

.info-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
}

.info-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.info-value {
    font-size: 1.25rem;
    font-weight: 700;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* 颜色统计 */
.color-stats {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid #E5E7EB;
}

.stats-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 1rem;
}

.color-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.color-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 0.75rem;
    background: #F9FAFB;
    border-radius: 9999px;
    border: 1px solid #E5E7EB;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.color-swatch {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 2px solid rgba(0, 0, 0, 0.1);
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1);
}

.color-count {
    font-weight: 600;
    color: var(--text-primary);
}

/* 使用说明 */
.guide-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.guide-item {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
}

.guide-number {
    flex-shrink: 0;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--primary-gradient);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 700;
}

.guide-text {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.7;
}

.guide-text strong {
    color: var(--text-primary);
}

/* 调色板说明 */
.palette-info {
    display: grid;
    gap: 0.75rem;
}

.palette-item {
    font-size: 0.9rem;
    color: var(--text-secondary);
    padding: 0.75rem 1rem;
    background: #F9FAFB;
    border-radius: 0.5rem;
    border-left: 3px solid var(--primary-pink);
}

.palette-item strong {
    color: var(--text-primary);
}

/* 消息样式 */
.message {
    margin-top: 1rem;
    padding: 0.875rem 1rem;
    border-radius: 0.75rem;
    border-left: 4px solid;
    font-size: 0.875rem;
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    animation: slideIn 0.25s ease-out;
}

.message svg {
    flex-shrink: 0;
}

.message-error {
    background: linear-gradient(135deg, #FEF2F2 0%, #FEE2E2 100%);
    border-left-color: #EF4444;
    color: #B91C1C;
}

.message-success {
    background: linear-gradient(135deg, #F0FDF4 0%, #DCFCE7 100%);
    border-left-color: #22C55E;
    color: #15803D;
}

.message-info {
    background: linear-gradient(135deg, #EFF6FF 0%, #DBEAFE 100%);
    border-left-color: #3B82F6;
    color: #1D4ED8;
}

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

/* 响应式设计 */
@media (max-width: 768px) {
    .container {
        padding: 1.25rem 0.875rem 2rem;
    }

    .page-title {
        font-size: 1.75rem;
    }

    .card {
        padding: 1.25rem;
        border-radius: 0.875rem;
    }

    .upload-area {
        padding: 2rem 1rem;
    }

    .upload-icon {
        width: 60px;
        height: 60px;
    }

    .options-row {
        gap: 1rem;
    }

    .preview-info {
        gap: 1.25rem;
    }

    .btn-large {
        padding: 0.75rem 1.5rem;
        font-size: 0.95rem;
    }
}

@media (max-width: 480px) {
    .page-title {
        font-size: 1.5rem;
        flex-direction: column;
        gap: 0.5rem;
    }

    .option-chip {
        padding: 0.3rem 0.65rem;
        font-size: 0.8rem;
    }

    .options-row {
        flex-direction: column;
        gap: 0.75rem;
    }
}

