/* 全局样式重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
}

/* 容器布局 */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* 头部样式 */
.header {
    text-align: center;
    margin-bottom: 40px;
    background: rgba(255, 255, 255, 0.95);
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
}

.header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    color: #2c3e50;
    margin-bottom: 10px;
    background: linear-gradient(45deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.subtitle {
    color: #7f8c8d;
    font-size: 1.1rem;
    font-weight: 300;
}

/* 主要内容区域 */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 30px;
}

/* 表单区块样式 */
.form-section {
    background: rgba(255, 255, 255, 0.95);
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
}

.form-section h2 {
    font-size: 1.5rem;
    color: #2c3e50;
    margin-bottom: 25px;
    padding-bottom: 10px;
    border-bottom: 3px solid #667eea;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group label {
    font-weight: 600;
    color: #34495e;
    margin-bottom: 8px;
    font-size: 0.9rem;
}

.form-group input,
.form-group textarea,
.form-group select {
    padding: 12px 15px;
    border: 2px solid #e1e8ed;
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s ease;
    font-family: inherit;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-group textarea {
    resize: vertical;
    min-height: 100px;
}

.form-group select {
    cursor: pointer;
}

.form-group small {
    margin-top: 5px;
    color: #7f8c8d;
    font-size: 0.8rem;
}

/* 表单布局 */
.full-width {
    grid-column: 1 / -1;
}

/* 技术栈分类展示 */
.tech-categories {
    margin-top: 15px;
}

.tech-category {
    margin-bottom: 20px;
}

.tech-category h4 {
    font-size: 0.9rem;
    color: #2c3e50;
    margin-bottom: 10px;
    font-weight: 600;
    display: flex;
    align-items: center;
}

.tech-category h4::before {
    content: '';
    width: 3px;
    height: 16px;
    background: linear-gradient(45deg, #667eea, #764ba2);
    margin-right: 8px;
    border-radius: 2px;
}

/* 核心功能容器 */
.core-features-container {
    border: 2px solid #e1e8ed;
    border-radius: 8px;
    padding: 15px;
    background: white;
}

.role-group {
    margin-bottom: 20px;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    overflow: hidden;
}

.role-header {
    background: linear-gradient(45deg, #667eea, #764ba2);
    color: white;
    padding: 12px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.role-title {
    font-size: 1rem;
    font-weight: 600;
}

.role-remove {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: none;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.role-remove:hover {
    background: rgba(255, 255, 255, 0.3);
}

.role-content {
    padding: 15px;
    background: white;
}

.features-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 10px;
    margin-bottom: 15px;
}

.feature-item {
    display: flex;
    align-items: flex-start;
    padding: 10px 12px;
    background: #f8f9fa;
    border: 1px solid #e1e8ed;
    border-radius: 6px;
    transition: all 0.2s ease;
    cursor: pointer;
    margin-bottom: 8px;
}

.feature-item:hover {
    background: #e9ecef;
    border-color: #667eea;
}

.feature-checkbox {
    margin-right: 8px;
    margin-top: 2px;
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.feature-content {
    flex: 1;
    min-width: 0;
}

.feature-text {
    font-size: 0.9rem;
    color: #2c3e50;
    font-weight: 500;
    margin-bottom: 4px;
    word-break: break-all;
}

.feature-desc {
    font-size: 0.8rem;
    color: #7f8c8d;
    line-height: 1.4;
    word-break: break-all;
}

.feature-desc-input {
    width: 100%;
    margin-top: 6px;
    padding: 6px 10px;
    border: 1px solid #e1e8ed;
    border-radius: 4px;
    font-size: 0.8rem;
    background: white;
    display: none;
    resize: vertical;
    min-height: 50px;
    line-height: 1.4;
    font-family: inherit;
}

.feature-desc-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.1);
}

.feature-remove {
    color: #dc3545;
    cursor: pointer;
    font-size: 1rem;
    font-weight: bold;
    padding: 2px 6px;
    border-radius: 4px;
    transition: all 0.2s ease;
    margin-left: 8px;
    opacity: 0;
}

.feature-item:hover .feature-remove {
    opacity: 1;
}

.feature-remove:hover {
    background: #dc3545;
    color: white;
}

.add-feature-container {
    display: flex;
    gap: 10px;
    align-items: center;
}

.add-feature-input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #e1e8ed;
    border-radius: 6px;
    font-size: 0.85rem;
    transition: all 0.3s ease;
    font-family: inherit;
    line-height: 1.4;
    resize: vertical;
    min-height: 60px;
    overflow-y: auto;
    width: 100%;
}

.add-feature-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.add-feature-btn {
    background: #f8f9fa;
    border: 1px solid #e1e8ed;
    color: #495057;
    padding: 8px 15px;
    border-radius: 6px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.add-feature-btn:hover {
    background: linear-gradient(45deg, #48c774, #3ec46d);
    color: white;
    border-color: #3ec46d;
}

.add-role-section {
    border-top: 2px dashed #e1e8ed;
    padding-top: 15px;
    margin-top: 15px;
}

.add-role-container {
    display: flex;
    gap: 10px;
    align-items: center;
}

#new-role-input {
    flex: 1;
    padding: 10px 15px;
    border: 2px dashed #667eea;
    border-radius: 6px;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    background: rgba(102, 126, 234, 0.05);
}

#new-role-input:focus {
    outline: none;
    border-color: #667eea;
    background: rgba(102, 126, 234, 0.1);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.add-role-btn {
    background: linear-gradient(45deg, #667eea, #764ba2);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.add-role-btn:hover {
    background: linear-gradient(45deg, #5a67d8, #667eea);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #7f8c8d;
    font-size: 0.9rem;
    border: 2px dashed #e1e8ed;
    border-radius: 8px;
    background: #f8f9fa;
}

.empty-state-icon {
    font-size: 2rem;
    margin-bottom: 10px;
    opacity: 0.5;
}

/* 开发阶段选择 */
.stages-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.stage-item {
    cursor: pointer;
}

.stage-item input[type="checkbox"] {
    display: none;
}

.stage-card {
    padding: 20px;
    border: 3px solid #e1e8ed;
    border-radius: 12px;
    text-align: center;
    transition: all 0.3s ease;
    background: white;
}

.stage-card h3 {
    color: #2c3e50;
    margin-bottom: 10px;
    font-size: 1.1rem;
}

.stage-card p {
    color: #7f8c8d;
    font-size: 0.9rem;
}

.stage-item input[type="checkbox"]:checked + .stage-card {
    border-color: #667eea;
    background: linear-gradient(45deg, rgba(102, 126, 234, 0.1), rgba(118, 75, 162, 0.1));
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.2);
}

.stage-item:hover .stage-card {
    border-color: #667eea;
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.15);
}

/* 标签输入组件 */
.tag-input-container {
    border: 2px solid #e1e8ed;
    border-radius: 8px;
    padding: 8px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    min-height: 50px;
    transition: all 0.3s ease;
    background: white;
}

.tag-input-container:focus-within {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.tags-display {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-right: 8px;
}

.tag {
    background: linear-gradient(45deg, #667eea, #764ba2);
    color: white;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
    animation: tagAppear 0.3s ease;
}

@keyframes tagAppear {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.tag-remove {
    cursor: pointer;
    font-size: 1.2rem;
    line-height: 1;
    opacity: 0.8;
    transition: opacity 0.2s ease;
}

.tag-remove:hover {
    opacity: 1;
}

#tech-stack-input,
#user-roles-input {
    border: none;
    outline: none;
    flex: 1;
    min-width: 120px;
    font-size: 1rem;
    font-family: inherit;
    background: transparent;
}

#tech-stack-input::placeholder,
#user-roles-input::placeholder {
    color: #bdc3c7;
}

/* 确保textarea元素能正确显示多行内容 */
textarea.add-feature-input,
textarea.feature-desc-input {
    white-space: pre-wrap;
    word-wrap: break-word;
}

/* 常见技术栈快捷选择 */
.common-tags {
    margin-top: 12px;
}

.common-tags-title {
    font-size: 0.9rem;
    color: #7f8c8d;
    margin-bottom: 8px;
    font-weight: 500;
}

.tech-quick-select {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tech-tag-btn {
    background: #f8f9fa;
    border: 1px solid #e1e8ed;
    padding: 6px 12px;
    border-radius: 15px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 500;
    color: #495057;
}

.tech-tag-btn:hover {
    background: #667eea;
    color: white;
    border-color: #667eea;
    transform: translateY(-1px);
}

.tech-tag-btn:active {
    transform: translateY(0);
}

/* 需求结果输入区域 */
.requirement-actions {
    display: flex;
    gap: 15px;
    margin-top: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

.requirement-actions .secondary-btn {
    min-width: 180px;
}

#requirement-result {
    min-height: 200px;
    resize: vertical;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 0.9rem;
    line-height: 1.5;
}

/* 操作按钮区域 */
.action-section {
    text-align: center;
    background: rgba(255, 255, 255, 0.95);
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.generate-btn {
    background: linear-gradient(45deg, #667eea, #764ba2);
    color: white;
    border: none;
    padding: 15px 40px;
    font-size: 1.1rem;
    font-weight: 600;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    margin-bottom: 20px;
}

.generate-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 35px rgba(102, 126, 234, 0.3);
}

.generate-btn:active {
    transform: translateY(0);
}

.generate-btn .loading-spinner {
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top: 3px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    display: inline-block;
    margin-left: 10px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.action-buttons {
    display: flex;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
}

.secondary-btn {
    background: white;
    color: #667eea;
    border: 2px solid #667eea;
    padding: 10px 25px;
    font-size: 1rem;
    font-weight: 500;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.secondary-btn:hover {
    background: #667eea;
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.2);
}

/* 结果展示区域 */
.result-section {
    background: rgba(255, 255, 255, 0.98);
    border-radius: 15px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    animation: slideUp 0.5s ease;
}

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

.result-section h2 {
    background: linear-gradient(45deg, #667eea, #764ba2);
    color: white;
    padding: 20px 30px;
    margin: 0;
    font-size: 1.3rem;
}

/* 结果导航标签 */
.result-tabs {
    background: #f8f9fa;
    border-bottom: 1px solid #e1e8ed;
    overflow-x: auto;
}

.tabs-container {
    display: flex;
    padding: 0 20px;
    min-width: max-content;
}

.tab-item {
    padding: 15px 25px;
    cursor: pointer;
    border: none;
    background: none;
    font-size: 0.95rem;
    font-weight: 500;
    color: #6c757d;
    white-space: nowrap;
    position: relative;
    transition: all 0.3s ease;
}

.tab-item:hover {
    color: #495057;
    background: rgba(102, 126, 234, 0.05);
}

.tab-item.active {
    color: #667eea;
    background: rgba(102, 126, 234, 0.1);
}

.tab-item.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(45deg, #667eea, #764ba2);
}

/* 结果内容区域 */
.result-content {
    padding: 30px;
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 2px solid #e1e8ed;
}

.result-header h3 {
    color: #2c3e50;
    font-size: 1.2rem;
    margin: 0;
}

.result-actions {
    display: flex;
    gap: 10px;
}

.copy-stage-btn {
    background: linear-gradient(45deg, #48c774, #3ec46d);
    color: white;
    border: none;
    padding: 8px 20px;
    font-size: 0.9rem;
    font-weight: 500;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.copy-stage-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 15px rgba(72, 199, 116, 0.3);
}

.prompt-content {
    background: #f8f9fa;
    border: 2px solid #e1e8ed;
    border-radius: 10px;
    padding: 25px;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 0.95rem;
    line-height: 1.6;
    white-space: pre-wrap;
    word-wrap: break-word;
    max-height: 500px;
    overflow-y: auto;
    position: relative;
}

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

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

.prompt-content::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

.prompt-content::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* 页脚样式 */
.footer {
    text-align: center;
    margin-top: 40px;
    padding: 20px;
    color: white;
    font-size: 0.9rem;
}

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

    .header h1 {
        font-size: 2rem;
    }

    .form-section {
        padding: 20px;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

  
    .action-buttons {
        flex-direction: column;
        align-items: center;
    }

    .secondary-btn {
        width: 200px;
    }

    .tabs-container {
        padding: 0 10px;
    }

    .result-header {
        flex-direction: column;
        gap: 15px;
        align-items: flex-start;
    }

    .result-content {
        padding: 20px;
    }
}

/* 加载状态 */
.loading {
    pointer-events: none;
    opacity: 0.6;
}

/* 复制成功提示 */
.copy-tooltip {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #48c774;
    color: white;
    padding: 12px 20px;
    border-radius: 8px;
    font-weight: 500;
    box-shadow: 0 4px 15px rgba(72, 199, 116, 0.3);
    opacity: 0;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    z-index: 1000;
}

.copy-tooltip.show {
    opacity: 1;
    transform: translateY(0);
}

/* 代码高亮样式 */
.prompt-content .keyword {
    color: #d73a49;
    font-weight: bold;
}

.prompt-content .string {
    color: #032f62;
}

.prompt-content .comment {
    color: #6a737d;
    font-style: italic;
}

.prompt-content .function {
    color: #6f42c1;
}

.prompt-content .variable {
    color: #e36209;
}