/* static/css/text2img.css */
body {
    font-family: 'Comic Sans MS', 'Chalkboard', sans-serif;
    background: linear-gradient(to bottom, #ffefd5, #ffe4e1);
    color: #333;
    margin: 0;
    padding: 0;
}

.container {
    max-width: 1200px;
    margin: 20px auto;
    padding: 20px;
    background: #fff;
    border-radius: 15px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    width: 90%; /* 新增：限制容器最大宽度为90% */
}

.title {
    text-align: center;
    font-size: 2rem;
    color: #ff69b4;
    margin-bottom: 20px;
}

.description {
    font-size: 1rem;
    text-align: center;
    color: #666;
    margin-bottom: 20px;
    line-height: 1.5;
}

/* 按钮 */
.process-button {
    display: block;
    margin: 20px auto;
    padding: 12px 30px;
    background: #ff69b4;
    color: #fff;
    border: none;
    border-radius: 25px;
    font-size: 1.1rem;
    cursor: pointer;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s, box-shadow 0.2s;
    width: 80%;
    max-width: 300px;
}

.process-button:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 8px rgba(0, 0, 0, 0.2);
    background: #ff1493;
}

/* 状态消息 */
.status-message {
    text-align: center;
    margin-top: 20px;
    font-size: 1rem;
    padding: 10px;
    border-radius: 5px;
}

.status-error {
    background-color: #ffebee;
    color: #f44336;
}

.status-success {
    background-color: #e8f5e9;
    color: #4caf50;
}

/* 结果容器 */
.result-container {
    margin-top: 20px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 10px;
    border: 1px dashed #ddd;
}

/* 进度条区域 */
.progress-section {
    text-align: center;
}

.progress-bar-container {
    width: 100%;
    height: 20px;
    background-color: #f0f0f0;
    border-radius: 10px;
    margin: 20px 0;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    width: 0;
    background: linear-gradient(to right, #ff69b4, #ff1493);
    border-radius: 10px;
    transition: width 0.3s ease;
}

.progress-text {
    font-size: 1rem;
    color: #666;
    margin-bottom: 10px;
}

.progress-hint {
    font-size: 0.9rem;
    color: #888;
    line-height: 1.5;
}

.progress-hint a {
    color: #ff69b4;
    text-decoration: none;
}

.progress-hint a:hover {
    text-decoration: underline;
}

/* 输入区域 */
.input-section {
    margin-bottom: 20px;
    width: 100%;
    box-sizing: border-box; /* 新增：确保内边距不影响总宽度 */
}

#promptInput {
    width: 100%;
    height: 120px;
    padding: 15px;
    border: 2px solid #ffb6c1;
    border-radius: 10px;
    font-size: 1rem;
    resize: vertical;
    margin-bottom: 15px;
    box-sizing: border-box; /* 关键修复：确保内边距和边框包含在宽度内 */
    max-width: 100%; /* 新增：确保不超过父容器宽度 */
}

#promptInput:focus {
    outline: none;
    border-color: #ff69b4;
    box-shadow: 0 0 5px rgba(255, 105, 180, 0.5);
}

/* 分类区域 */
.category-section {
    margin-top: 20px;
    margin-bottom: 20px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 12px;
    padding: 20px;
    border: 1px solid #ffb6c1;
    box-shadow: 0 2px 8px rgba(255, 182, 193, 0.1);
}

/* ========== 一级分类：标签页 ========== */
.category-tabs-container {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #ffe4e1;
}

.category-tab {
    padding: 10px 20px;
    background: linear-gradient(135deg, #ffb6c1 0%, #ff91a4 100%);
    border-radius: 20px;
    cursor: pointer;
    color: white;
    font-size: 0.95rem;
    font-weight: 600;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
    user-select: none;
    box-shadow: 0 2px 4px rgba(255, 182, 193, 0.3);
    position: relative;
    overflow: hidden;
}

.category-tab::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.5s;
}

.category-tab:hover::before {
    left: 100%;
}

.category-tab:hover {
    background: linear-gradient(135deg, #ff69b4 0%, #ff1493 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 105, 180, 0.4);
}

.category-tab.active {
    background: linear-gradient(135deg, #ff1493 0%, #d81b60 100%);
    box-shadow: 0 4px 12px rgba(255, 20, 147, 0.5);
    transform: translateY(-2px);
}

/* ========== 分类内容区域 ========== */
.category-content {
    max-height: 400px;
    overflow-y: auto;
    padding: 5px 0;
    scrollbar-width: thin;
    scrollbar-color: #ffb6c1 #f5f5f5;
}

.category-content::-webkit-scrollbar {
    width: 8px;
}

.category-content::-webkit-scrollbar-track {
    background: #f5f5f5;
    border-radius: 4px;
}

.category-content::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #ffb6c1, #ff69b4);
    border-radius: 4px;
}

.category-content::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, #ff69b4, #ff1493);
}

/* ========== 二级分类：子分类标题 ========== */
.subcategory-wrapper {
    width: 100%;
    margin-bottom: 16px;
    background: rgba(255, 182, 193, 0.05);
    border-radius: 10px;
    padding: 12px;
    border-left: 3px solid #ffb6c1;
    transition: all 0.3s ease;
}

.subcategory-wrapper:hover {
    background: rgba(255, 182, 193, 0.1);
    border-left-color: #ff69b4;
    box-shadow: 0 2px 6px rgba(255, 182, 193, 0.2);
}

.subcategory-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
    margin-bottom: 12px;
}

.subcategory-header:hover {
    transform: translateX(3px);
}

.subcategory-toggle {
    font-size: 12px;
    color: #ff69b4;
    transition: transform 0.3s ease;
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 182, 193, 0.2);
    border-radius: 50%;
}

.subcategory-wrapper.expanded .subcategory-toggle {
    transform: rotate(90deg);
    background: rgba(255, 105, 180, 0.3);
}

.subcategory-title {
    font-size: 1rem;
    color: #d23669;
    font-weight: 600;
    letter-spacing: 0.3px;
}

/* ========== 子分类内容区域 ========== */
.subcategory-content {
    display: none;
    padding-left: 28px;
    margin-top: 8px;
}

.subcategory-wrapper.expanded .subcategory-content {
    display: block;
}

/* ========== 三级分类：标签组 ========== */
.tag-group {
    margin-bottom: 12px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.tag-group-label {
    font-size: 0.85rem;
    color: #c2185b;
    font-weight: 500;
    margin-right: 4px;
    padding: 4px 8px;
    background: rgba(255, 182, 193, 0.15);
    border-radius: 8px;
    white-space: nowrap;
}

/* ========== 最终选项：可点击标签 ========== */
.category-option {
    display: inline-block;
    padding: 8px 16px;
    background: linear-gradient(135deg, #ffb6c1 0%, #ff91a4 100%);
    border-radius: 18px;
    cursor: pointer;
    color: white;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    user-select: none;
    white-space: nowrap;
    margin: 6px;
    box-shadow: 0 2px 4px rgba(255, 182, 193, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.category-option:hover {
    background: linear-gradient(135deg, #ff69b4 0%, #ff1493 100%);
    transform: translateY(-2px) scale(1.03);
    box-shadow: 0 4px 10px rgba(255, 105, 180, 0.4);
    border-color: rgba(255, 255, 255, 0.5);
}

.category-option:active {
    transform: translateY(0) scale(0.98);
}

.category-option.clicked {
    animation: optionPulse 0.3s ease;
}

@keyframes optionPulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
    100% {
        transform: scale(1);
    }
}

/* 已添加的标签样式 */
.category-option.added {
    background: linear-gradient(135deg, #ff1493 0%, #d81b60 100%);
    box-shadow: 0 2px 8px rgba(255, 20, 147, 0.4);
    border: 2px solid rgba(255, 255, 255, 0.6);
    position: relative;
}

.category-option.added::after {
    content: '✓';
    position: absolute;
    top: -6px;
    right: -6px;
    width: 18px;
    height: 18px;
    background: #4caf50;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    box-shadow: 0 2px 4px rgba(76, 175, 80, 0.4);
}

.category-option.added:hover {
    background: linear-gradient(135deg, #d81b60 0%, #c2185b 100%);
    box-shadow: 0 4px 12px rgba(255, 20, 147, 0.5);
}

/* 结果图片区域 */
.result-image-container {
    text-align: center;
}

.preview-container {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin-top: 20px;
}

.result-image-wrapper {
    position: relative;
    border: 1px solid #eee;
    border-radius: 10px;
    padding: 10px;
    background: white;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.result-image-wrapper img {
    width: 100%;
    border-radius: 5px;
    display: block;
    cursor: pointer;
    transition: transform 0.3s;
}

.result-image-wrapper img:hover {
    transform: scale(1.02);
}

.download-btn {
    display: block;
    width: 100%;
    margin-top: 10px;
    padding: 8px 0;
    background: linear-gradient(to right, #ff69b4, #ff1493);
    color: white;
    text-align: center;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s;
}

.download-btn:hover {
    background: linear-gradient(to right, #ff1493, #ff69b4);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(255, 105, 180, 0.3);
}

/* 返回按钮 */
.back-button {
    background: none;
    border: none;
    color: #ff69b4;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 10px;
    margin-bottom: 10px;
    transition: all 0.3s;
}

.back-button:hover {
    color: #ff1493;
    transform: translateX(-3px);
}

/* 图片模态框 */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    overflow: auto;
}

.modal-content {
    margin: auto;
    display: block;
    max-width: 90%;
    max-height: 90%;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.close {
    position: absolute;
    top: 15px;
    right: 35px;
    color: #f1f1f1;
    font-size: 40px;
    font-weight: bold;
    transition: 0.3s;
    cursor: pointer;
}

.close:hover {
    color: #ff69b4;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .container {
        width: 95%; /* 在小屏幕上增加宽度占比 */
        padding: 15px;
    }
    
    .preview-container {
        grid-template-columns: 1fr;
    }
    
    .modal-content {
        max-width: 95%;
    }
    
    .close {
        top: 10px;
        right: 20px;
        font-size: 30px;
    }
    
    .title {
        font-size: 1.5rem;
    }
    
    #promptInput {
        padding: 10px;
    }
}

/* 按钮容器 */
.button-container {
    text-align: right;
    margin-bottom: 20px;
}

.process-button:disabled {
    background: #ccc !important;
    transform: none !important;
    box-shadow: none !important;
    cursor: not-allowed !important;
}

.estimated-time {
    color: #ff6b00;
    font-weight: bold;
    font-size: 1.1em;
}



.close-btn {
    position: absolute;
    top: 10px;
    right: 20px;
    font-size: 24px;
    cursor: pointer;
    color: #666;
}

.close-btn:hover {
    color: #ff1493;
}

.btn {
    display: inline-block;
    padding: 10px 20px;
    background: linear-gradient(to right, #ff69b4, #ff1493);
    color: white;
    text-decoration: none;
    border-radius: 25px;
    margin-top: 15px;
    transition: all 0.3s;
}

.btn:hover {
    background: linear-gradient(to right, #ff1493, #ff69b4);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(255, 105, 180, 0.3);
}

/* 移动端让标签更紧凑展示 */

/* 移动设备优化 */
@media (max-width: 768px) {
    .input-section {
        margin-bottom: 10px;
    }
    
    #promptInput {
        height: 100px;
        margin-bottom: 10px;
    }
    
    .category-section {
        padding: 15px;
        margin-top: 15px;
        margin-bottom: 15px;
    }
    
    .category-tabs-container {
        gap: 8px;
        margin-bottom: 15px;
        padding-bottom: 12px;
    }
    
    .category-tab {
        padding: 8px 16px;
        font-size: 0.85rem;
    }
    
    .category-content {
        max-height: 350px;
    }
    
    .subcategory-wrapper {
        padding: 10px;
        margin-bottom: 12px;
    }
    
    .subcategory-title {
        font-size: 0.9rem;
    }
    
    .category-option {
        padding: 6px 12px;
        font-size: 0.8rem;
        margin: 4px;
    }
    
    .subcategory-content {
        padding-left: 20px;
    }
    
    .tag-group {
        gap: 6px;
        margin-bottom: 10px;
    }
    
    .tag-group-label {
        font-size: 0.8rem;
        padding: 3px 6px;
    }
    
    /* 固定按钮位置 */
    .button-container {
        position: sticky;
        bottom: 10px;
        background: white;
        padding: 10px 0;
        z-index: 100;
    }
    
    .process-button {
        width: 100%;
        max-width: none;
        margin: 0 auto;
    }
}
