.input-section {
    margin-bottom: 30px;
}

.textarea-container {
    position: relative;
    display: block;
}

.input-section textarea {
    width: 100%;
    min-height: 120px;
    padding: 12px;
    padding-right: 35px; /* 为清空按钮留出空间 */
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
    resize: vertical;
    transition: border-color 0.3s;
    box-sizing: border-box;
}

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

/* 清空按钮样式 */
.clear-btn {
    position: absolute;
    bottom: 12px;
    right: 12px;
    width: 30px;
    height: 30px;
    background: rgba(255, 255, 255, 0.9);
    border: 0px;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    opacity: 0;
    visibility: hidden;
    z-index: 10;
}

.clear-btn:hover {
    background: rgba(255, 255, 255, 1);

}

.clear-btn:active {
    transform: scale(0.9);
}

.clear-btn img {
    color: #666;
    transition: color 0.2s ease;
    filter: none;
}

.clear-btn:hover img {
    color: #dc3545;
}

/* 当textarea有内容时显示清空按钮 */
.textarea-container.has-content .clear-btn {
    opacity: 0.7;
    visibility: visible;
}

/* 当textarea获得焦点时也显示清空按钮 */
.textarea-container:focus-within .clear-btn {
    opacity: 0.8;
    visibility: visible;
}

/* 悬停时完全显示 */
.clear-btn:hover {
    opacity: 1 !important;
}

/* 移动端优化 */
@media (max-width: 768px) {
    .clear-btn {
        width: 24px;
        height: 24px;
        bottom: 16px;
        right: 16px;
    }
    
    .input-section textarea {
        padding-right: 38px; /* 为移动端的清空按钮留出空间 */
    }
    
    .form-actions {
        flex-direction: row; /* 保持水平排列 */
        align-items: center;
    }
    
    .upload-btn {
        width: 100%;
        justify-content: center;
    }
    
    /* 图标按钮在移动端保持相同样式 */
    .upload-btn-icon {
        width: 50px;
        height: 50px;
        margin-right: 8px;
        background-size: 50px 50px;
    }
    
    .image-preview img {
        max-width: 150px;
        max-height: 120px;
    }
}

/* 触摸设备优化 */
@media (hover: none) and (pointer: coarse) {
    .clear-btn {
        opacity: 0.7;
        visibility: visible;
    }
    
    .textarea-container.has-content .clear-btn {
        opacity: 1;
    }
}

/* 图片预览容器 */
.image-preview-container {
    margin-top: 15px;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    padding: 12px;
    background: #f8f9fa;
}

/* 图片专用模式样式 */
.input-section.image-only-mode .image-preview-container {
    margin-top: 0;
    border: 2px solid #667eea;
    background: linear-gradient(135deg, #f8f9ff 0%, #f0f2ff 100%);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.1);
}

.input-section.image-only-mode .image-preview-title {
    color: #667eea;
    font-size: 1rem;
    font-weight: 700;
}

.input-section.image-only-mode .image-preview {
    justify-content: center;
}

.input-section.image-only-mode .image-preview img {
    max-width: 300px;
    max-height: 200px;
    border: 2px solid #fff;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.image-preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.image-preview-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: #495057;
}

.remove-image-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px 8px;
    border-radius: 6px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.85rem;
    color: #666;
}

.remove-image-btn:hover {
    background-color: rgba(220, 53, 69, 0.1);
    color: #dc3545;
}

.remove-btn-text {
    display: none;
}

/* 图片专用模式下显示清除按钮文本 */
.input-section.image-only-mode .remove-image-btn {
    background: rgba(220, 53, 69, 0.1);
    color: #dc3545;
    font-weight: 500;
    padding: 8px 12px;
}

.input-section.image-only-mode .remove-btn-text {
    display: inline;
}

.input-section.image-only-mode .remove-image-btn:hover {
    background: rgba(220, 53, 69, 0.2);
    transform: translateY(-1px);
}

.image-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.image-preview img {
    max-width: 200px;
    max-height: 150px;
    border-radius: 6px;
    border: 1px solid #dee2e6;
    object-fit: cover;
}

/* 表单操作按钮区域 */
.form-actions {
    display: flex;
    gap: 2px;
    margin-top: 15px;
}

.upload-btn {
    background: #28a745;
    color: white;
    border: none;
    padding: 12px 16px;
    font-size: 0.9rem;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 500;
    transition: background-color 0.2s, transform 0.2s;
    flex-shrink: 0;
}

.upload-btn:hover {
    background: #218838;
    transform: translateY(-1px);
}

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

/* 新的图标样式上传按钮 */
.upload-btn-icon {
    background: url('../img/upload.svg') no-repeat center center;
    background-size: 50px 50px;
    border: none;
    padding: 0;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
    border-radius: 6px;
    width: 50px;
    height: 50px;
}

.upload-btn-icon:hover {
    background-color: rgba(40, 167, 69, 0.1);
    transform: translateY(-1px);
}

.upload-btn-icon:active {
    transform: translateY(0);
    background-color: rgba(40, 167, 69, 0.2);
}

.input-section button[type="submit"] {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 12px 20px;
    font-size: 1rem;
    border-radius: 8px;
    cursor: pointer;
    flex: 1;
    font-weight: 600;
    transition: transform 0.2s, box-shadow 0.2s;
}

.input-section button[type="submit"]:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.3);
}

.input-section button[type="submit"]:active {
    transform: translateY(0);
}

.input-section button[type="submit"]:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.input-section button[type="submit"] .spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    margin-right: 8px;
    vertical-align: middle;
    background: url('../img/spinner.svg') no-repeat center center;
    background-size: contain;
    animation: spin 1s linear infinite;
}

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