/* ==========================================
   📋 Single Page Generator - 单页面AI庭院设计生成器
   ========================================== */

/* ==========================================
   🎨 主容器布局
   ========================================== */
.single-page-generator {
    display: flex;
    min-height: calc(100vh - 200px);
    gap: 1.5rem;
    max-width: 1400px;
    margin: 0 auto;
    padding: 1.5rem;
    background: #f8fafc;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

/* ==========================================
   📝 左侧输入面板
   ========================================== */
.input-panel {
    flex: 1;
    max-width: 500px;
    background: white;
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    height: fit-content;
    position: sticky;
    top: 2rem;
}

.panel-header {
    text-align: center;
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid #e5e7eb;
}

.panel-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 0.5rem;
}

.panel-header p {
    color: #6b7280;
    font-size: 0.95rem;
    line-height: 1.5;
}

/* ==========================================
   📸 上传区域
   ========================================== */
.upload-section {
    margin-bottom: 2rem;
}

.upload-section h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: 1rem;
}

.upload-container {
    position: relative;
}

.upload-dropzone {
    border: 2px dashed #d1d5db;
    border-radius: 8px;
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: #f9fafb;
}

.upload-dropzone:hover {
    border-color: #6366f1;
    background: #f8faff;
}

.upload-dropzone.drag-over {
    border-color: #6366f1;
    background: #f0f4ff;
    transform: scale(1.02);
}

.upload-icon {
    color: #9ca3af;
    margin-bottom: 1rem;
}

.upload-text p {
    margin: 0.5rem 0;
    color: #6b7280;
}

.upload-browse {
    color: #6366f1;
    font-weight: 500;
    text-decoration: underline;
}

.upload-requirements {
    font-size: 0.875rem;
    color: #9ca3af;
}

.file-input {
    display: none;
}

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

.upload-preview-image {
    max-width: 100%;
    max-height: 200px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    margin-bottom: 1rem;
}

.image-size-info {
    font-size: 0.875rem;
    color: #6b7280;
    margin-bottom: 1rem;
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

/* ==========================================
   🎨 风格选择区域
   ========================================== */
.style-section {
    margin-bottom: 2rem;
}

.style-section h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: 1.5rem;
}

.style-section h4 {
    font-size: 1rem;
    font-weight: 500;
    color: #4b5563;
    margin-bottom: 1rem;
}

/* 区域类型选择 - 下拉式 */
.area-type-dropdown {
    position: relative;
    margin-bottom: 1.5rem;
}

.area-type-dropdown-toggle {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    padding: 1rem;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    background: #fff;
    color: #374151;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: left;
}

.area-type-dropdown-toggle:hover {
    border-color: #6366f1;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.1);
}

.area-type-dropdown-toggle.active {
    border-color: #6366f1;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.2);
}

.area-type-dropdown-toggle img {
    width: 40px;
    height: 40px;
    border-radius: 6px;
    object-fit: cover;
    object-position: center;
    border: 1px solid #e5e7eb;
    flex-shrink: 0;
}

.area-type-dropdown-toggle span {
    flex: 1;
    font-size: 1rem;
    font-weight: 500;
}

.dropdown-arrow {
    flex-shrink: 0;
    transition: transform 0.3s ease;
    color: #6b7280;
}

.area-type-dropdown-toggle.active .dropdown-arrow {
    transform: rotate(180deg);
    color: #6366f1;
}

.area-type-dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: 2px solid #e5e7eb;
    border-top: none;
    border-radius: 0 0 8px 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    max-height: 400px;
    overflow-y: auto;
    display: none;
}

.area-type-dropdown-menu.show {
    display: block;
}

.area-type-option {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    border-bottom: 1px solid #f3f4f6;
}

.area-type-option:last-child {
    border-bottom: none;
}

.area-type-option:hover {
    background: #f8faff;
}

.area-type-option.selected {
    background: #f0f4ff;
    border-left: 4px solid #6366f1;
}

.area-type-option img {
    width: 60px;
    height: 60px;
    border-radius: 8px;
    object-fit: cover;
    object-position: center;
    border: 1px solid #e5e7eb;
    flex-shrink: 0;
}

.area-type-option .option-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.area-type-option .option-title {
    font-size: 1rem;
    font-weight: 600;
    color: #374151;
}

.area-type-option .option-description {
    font-size: 0.875rem;
    color: #6b7280;
    line-height: 1.4;
}

/* 动态选项区域 */
.dynamic-options-section {
    margin-bottom: 1.5rem;
}

.area-options-header {
    text-align: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #e5e7eb;
}

.area-options-header h4 {
    font-size: 1.1rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: 0.5rem;
}

.area-options-header p {
    color: #6b7280;
    font-size: 0.9rem;
    line-height: 1.4;
}

.area-options-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
}

/* 前院选项特殊布局 - 6个选项使用3x2布局 */
.area-options-grid[data-options-count="6"] {
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(2, 1fr);
}

.area-option {
    position: relative;
    cursor: pointer;
    border: 2px solid #e5e7eb;
    border-radius: 6px;
    padding: 0.5rem;
    transition: all 0.3s ease;
    background: #fff;
}

.area-option:hover {
    border-color: #6366f1;
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(99, 102, 241, 0.12);
}

.area-option input[type="radio"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.area-option input[type="radio"]:checked + .option-content {
    color: #6366f1;
}

.area-option input[type="radio"]:checked ~ .option-content::after {
    content: '✓';
    position: absolute;
    top: 0.25rem;
    right: 0.25rem;
    background: #6366f1;
    color: white;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: bold;
    z-index: 2;
}

.area-option:has(input[type="radio"]:checked) {
    border-color: #6366f1;
    background: #f8faff;
    box-shadow: 0 2px 6px rgba(99, 102, 241, 0.15);
}

.area-option .option-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
    position: relative;
}

.area-option .option-content img {
    width: 100%;
    height: 60px;
    border-radius: 4px;
    object-fit: cover;
    object-position: center;
    border: 1px solid #e5e7eb;
    transition: border-color 0.3s ease;
    background-color: #f8f9fa;
}

.area-option:has(input[type="radio"]:checked) .option-content img {
    border-color: #6366f1;
}

.area-option .option-content span {
    font-weight: 500;
    color: #374151;
    text-align: center;
    transition: color 0.3s ease;
    font-size: 0.75rem;
    line-height: 1.2;
}

/* 设计风格选择 */
.style-options {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.style-option {
    position: relative;
    cursor: pointer;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    padding: 0.75rem;
    transition: all 0.3s ease;
    background: #fff;
    overflow: hidden;
}

.style-option:hover {
    border-color: #6366f1;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.15);
}

.style-option input[type="radio"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.style-option input[type="radio"]:checked + .option-content {
    color: #6366f1;
}

.style-option input[type="radio"]:checked ~ .option-content::after {
    content: '✓';
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: #6366f1;
    color: white;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: bold;
    z-index: 2;
}

.style-option:has(input[type="radio"]:checked) {
    border-color: #6366f1;
    background: #f8faff;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.2);
}

.style-option .option-content img {
    width: 100%;
    height: 80px;
    border-radius: 6px;
    object-fit: cover;
    border: 1px solid #e5e7eb;
    transition: border-color 0.3s ease;
    margin-bottom: 0.5rem;
}

.style-option:has(input[type="radio"]:checked) .option-content img {
    border-color: #6366f1;
}

.style-option .option-content span {
    font-weight: 500;
    color: #374151;
    text-align: center;
    transition: color 0.3s ease;
    font-size: 0.8rem;
}

/* 自定义输入 */
.custom-input-section {
    margin-bottom: 1.5rem;
}

.custom-input-section textarea {
    width: 100%;
    min-height: 80px;
    padding: 0.75rem;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 0.875rem;
    font-family: inherit;
    resize: vertical;
    transition: border-color 0.3s ease;
    background: #fff;
}

.custom-input-section textarea:focus {
    outline: none;
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.custom-input-section textarea::placeholder {
    color: #9ca3af;
}

/* ==========================================
   🎯 生成按钮区域
   ========================================== */
.generate-section {
    text-align: center;
    padding-top: 1.5rem;
    border-top: 1px solid #e5e7eb;
}

.btn-large {
    padding: 1rem 2rem;
    font-size: 1.1rem;
    font-weight: 600;
    border-radius: 8px;
    transition: all 0.3s ease;
    cursor: pointer;
    border: none;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    min-width: 200px;
}

.btn-primary {
    background: #6366f1;
    color: white;
    border: 2px solid #6366f1;
}

.btn-primary:hover:not(:disabled) {
    background: #4f46e5;
    border-color: #4f46e5;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.btn-primary:disabled {
    background: #9ca3af;
    border-color: #9ca3af;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-outline {
    background: transparent;
    color: #6b7280;
    border: 2px solid #e5e7eb;
}

.btn-outline:hover {
    background: #f9fafb;
    border-color: #d1d5db;
    color: #374151;
}

.btn-loading {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.spinner {
    animation: spin 1s linear infinite;
}

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

/* ==========================================
   🖼️ 右侧结果面板
   ========================================== */
.result-panel {
    flex: 1;
    background: white;
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    height: fit-content;
    position: sticky;
    top: 2rem;
}

.result-container {
    min-height: 400px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

/* 占位符状态 */
.result-placeholder {
    text-align: center;
    color: #6b7280;
}

.placeholder-icon {
    color: #d1d5db;
    margin-bottom: 1rem;
}

.placeholder-icon.error {
    color: #ef4444;
}

.result-placeholder h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: 0.5rem;
}

.result-placeholder p {
    color: #6b7280;
    line-height: 1.5;
}

/* 结果内容 */
.result-content {
    width: 100%;
}

.result-image-container {
    text-align: center;
    margin-bottom: 1.5rem;
    width: 100%;
}

.result-image {
    max-width: 100%;
    max-height: 400px;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.result-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
    flex-wrap: wrap;
}

.result-actions .btn {
    padding: 0.75rem 1.5rem;
    font-size: 0.9rem;
    border-radius: 6px;
    transition: all 0.3s ease;
    cursor: pointer;
    border: none;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 120px;
}

/* ==========================================
   📱 响应式设计
   ========================================== */
@media (max-width: 1200px) {
    .area-type-dropdown-toggle {
        padding: 0.875rem;
    }
    
    .area-type-dropdown-toggle img {
        width: 36px;
        height: 36px;
    }
    
    .area-type-option img {
        width: 50px;
        height: 50px;
    }
    
    .area-options-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .area-options-grid[data-options-count="6"] {
        grid-template-columns: repeat(2, 1fr);
        grid-template-rows: repeat(3, 1fr);
    }
}

@media (max-width: 1024px) {
    .single-page-generator {
        flex-direction: column;
        gap: 1rem;
        padding: 1.25rem;
    }
    
    .input-panel,
    .result-panel {
        position: static;
        max-width: none;
    }
    
    .area-type-dropdown-toggle {
        padding: 0.75rem;
    }
    
    .area-type-dropdown-toggle img {
        width: 32px;
        height: 32px;
    }
    
    .area-type-option {
        padding: 0.875rem;
        gap: 0.75rem;
    }
    
    .area-type-option img {
        width: 45px;
        height: 45px;
    }
    
    .area-options-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .area-options-grid[data-options-count="6"] {
        grid-template-columns: repeat(2, 1fr);
        grid-template-rows: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .single-page-generator {
        padding: 1rem;
        margin: 0.75rem;
    }
    
    .input-panel,
    .result-panel {
        padding: 1.5rem;
    }
    
    .area-type-tabs {
        flex-direction: column;
        gap: 0.25rem;
    }
    
    .area-type-tab {
        flex: none;
        width: 100%;
        justify-content: flex-start;
        border-radius: 6px;
    }
    
    .area-options-grid {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }
    
    .area-options-grid[data-options-count="6"] {
        grid-template-columns: 1fr;
        grid-template-rows: none;
    }
    
    .area-type-option,
    .area-option {
        padding: 0.5rem;
    }
    
    .option-content {
        flex-direction: row;
        text-align: left;
    }
    
    .option-content img {
        width: 40px;
        height: 40px;
        margin-right: 0.75rem;
        margin-bottom: 0;
    }
    
    .function-option .option-content,
    .style-option .option-content {
        flex-direction: column;
        text-align: center;
    }
    
    .function-option .option-content img,
    .style-option .option-content img {
        margin-right: 0;
        margin-bottom: 0.5rem;
    }
    
    .result-actions {
        flex-direction: column;
        align-items: center;
    }
    
    .result-actions .btn {
        width: 100%;
        max-width: 200px;
    }
}

@media (max-width: 480px) {
    .single-page-generator {
        margin: 0.5rem;
        padding: 0.75rem;
    }
    
    .input-panel,
    .result-panel {
        padding: 1rem;
    }
    
    .panel-header h2 {
        font-size: 1.25rem;
    }
    
    .upload-dropzone {
        padding: 1.5rem;
    }
    
    .btn-large {
        min-width: 150px;
        padding: 0.875rem 1.5rem;
        font-size: 1rem;
    }
}

/* ==========================================
   ✨ 动画效果
   ========================================== */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.single-page-generator {
    animation: fadeInUp 0.6s ease-out;
}

.input-panel,
.result-panel {
    animation: fadeInUp 0.4s ease-out;
}

.area-type-option,
.style-option {
    animation: fadeInUp 0.3s ease-out;
}

.area-type-option:nth-child(1) { animation-delay: 0.1s; }
.area-type-option:nth-child(2) { animation-delay: 0.2s; }
.area-type-option:nth-child(3) { animation-delay: 0.3s; }
.area-type-option:nth-child(4) { animation-delay: 0.4s; }

.style-option:nth-child(1) { animation-delay: 0.1s; }
.style-option:nth-child(2) { animation-delay: 0.15s; }
.style-option:nth-child(3) { animation-delay: 0.2s; }
.style-option:nth-child(4) { animation-delay: 0.25s; }
.style-option:nth-child(5) { animation-delay: 0.3s; }
.style-option:nth-child(6) { animation-delay: 0.35s; }

/* ==========================================
   🎨 隐藏类
   ========================================== */
.hidden {
    display: none !important;
}

/* ==========================================
   🎯 状态指示器
   ========================================== */
.drag-over {
    border-color: #6366f1 !important;
    background: #f0f4ff !important;
    transform: scale(1.02);
}

.disabled {
    opacity: 0.6;
    cursor: not-allowed !important;
}

/* ==========================================
   🎨 加载动画
   ========================================== */
.loading-pulse {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: .5;
    }
}
