* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    margin: 0;
    padding: 0;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.page-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px 15px;
}

.form-container {
    width: 100%;
    max-width: 420px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    position: relative;
}

.form-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    text-align: center;
    position: relative;
    border-radius: 16px 16px 0 0;
}

.form-header.no-cover {
    padding: 30px 20px;
}

.form-header-content {
    padding: 20px 20px 30px 20px;
    position: relative;
    z-index: 2;
}

.form-cover-image {
    width: 100%;
    height: auto;
    object-fit: cover;
    border-radius: 16px 16px 0 0;
    display: block;
}

.form-header.has-cover {
    background: linear-gradient(to bottom, rgba(0,0,0,0.3) 0%, rgba(102, 126, 234, 0.8) 100%);
    padding: 0;
}

.form-header h2 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.form-header p {
    margin: 8px 0 0 0;
    opacity: 0.9;
    font-size: 0.9rem;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

.form-content {
    padding: 25px 20px 30px;
}

.form-group {
    margin-bottom: 20px;
}

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

.required-star {
    color: #e74c3c;
    margin-left: 2px;
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="date"],
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e9ecef;
    border-radius: 10px;
    font-size: 1rem;
    background: #fff;
    transition: all 0.3s ease;
    -webkit-appearance: none;
    appearance: none;
}

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

.form-group select {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 12px center;
    background-repeat: no-repeat;
    background-size: 16px;
    padding-right: 40px;
}

.form-group input[type="file"] {
    width: 100%;
    padding: 12px 16px;
    border: 2px dashed #d1d5db;
    border-radius: 10px;
    background: #f9fafb;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.form-group input[type="file"]:hover {
    border-color: #667eea;
    background: #f0f4ff;
}

/* 多图上传样式 */
.multi-file-upload {
    width: 100%;
}

.multi-file-input {
    width: 100%;
    padding: 12px 16px;
    border: 2px dashed #d1d5db;
    border-radius: 10px;
    background: #f9fafb;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.multi-file-input:hover {
    border-color: #667eea;
    background: #f0f4ff;
}

.file-upload-hint {
    font-size: 0.8rem;
    color: #6b7280;
    margin-top: 5px;
    text-align: center;
    transition: all 0.3s ease;
}

.file-upload-hint.has-files {
    color: #667eea;
    font-weight: 500;
}

.file-preview {
    margin-top: 12px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 8px;
}

.preview-item {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    background: #f3f4f6;
    aspect-ratio: 1;
}

.preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.preview-item .remove-btn {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 18px;
    height: 18px;
    background: rgba(239, 68, 68, 0.8);
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.preview-item .remove-btn:hover {
    background: rgba(239, 68, 68, 1);
    transform: scale(1.1);
}

/* 单图上传预览样式 */
.single-image-upload {
    position: relative;
}

.single-image-preview {
    margin-top: 12px;
    display: inline-block;
}

.single-image-preview .preview-container {
    position: relative;
    width: 90px;
    height: 90px;
    border-radius: 8px;
    overflow: hidden;
    background: #f3f4f6;
}

.single-image-preview .preview-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.single-image-preview .remove-preview {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 18px;
    height: 18px;
    background: rgba(239, 68, 68, 0.8);
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.single-image-preview .remove-preview:hover {
    background: rgba(239, 68, 68, 1);
    transform: scale(1.1);
}

.options-container {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 8px;
}

.options-container label.option-item{
    margin-bottom: 0;
}

.option-item {
    display: flex;
    align-items: center;
    font-weight: normal;
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 8px;
    background: #f8f9fa;
    border: 2px solid transparent;
    transition: all 0.3s ease;
    font-size: 0.9rem;
    min-width: 0;
    flex: 1;
    min-width: 120px;
}

.option-item:hover {
    background: #e9ecef;
}

.option-item.selected {
    background: #667eea;
    color: #fff;
    border-color: #667eea;
}

.option-item input[type="radio"],
.option-item input[type="checkbox"] {
    margin-right: 8px;
    margin-left: 0;
    transform: scale(1.2);
}

.validation-tip {
    display: block;
    margin-top: 5px;
    color: #6b7280;
    font-size: 0.8rem;
}

.form-actions {
    margin-top: 30px;
}

.submit-btn {
    width: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border: none;
    padding: 16px 0;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.3);
}

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

.submit-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* 模态框样式 */
.modal-mask {
    display: none;
    position: fixed;
    left: 0;
    top: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    backdrop-filter: blur(5px);
}

.modal-box {
    display: none;
    position: fixed;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    background: #fff;
    padding: 30px 25px 20px;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    z-index: 10000;
    min-width: 280px;
    max-width: 90vw;
    text-align: center;
}

.modal-message {
    font-size: 1rem;
    margin-bottom: 20px;
    color: #333;
    line-height: 1.5;
}

.modal-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    padding: 10px 30px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.modal-btn:hover {
    transform: translateY(-1px);
}

/* 响应式设计 */
@media (max-width: 480px) {
    .page-wrapper {
        padding: 0;
        align-items: flex-start;
        padding-top: 0;
    }
    
    .form-container {
        max-width: 100%;
        border-radius: 0;
    }

    .form-cover-image{
        border-radius: 0;
    }
    
    .form-header {
        padding: 25px 15px;
    }
    
    .form-header h2 {
        font-size: 1.3rem;
    }
    
    .form-content {
        padding: 20px 15px 25px;
    }
    
    .form-group {
        margin-bottom: 18px;
    }
    
    .options-container {
        gap: 8px;
    }
    
    .option-item {
        min-width: 100px;
        padding: 10px;
        font-size: 0.85rem;
    }
    
    .modal-box {
        min-width: 260px;
        padding: 25px 20px 18px;
    }
}

@media (max-width: 360px) {
    .form-header h2 {
        font-size: 1.2rem;
    }
    
    .option-item {
        flex: 1 1 100%;
        min-width: 100%;
    }
}

/* 加载动画 */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
}

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

/* 表单验证错误状态 */
.form-group.error input,
.form-group.error select {
    border-color: #e74c3c;
    box-shadow: 0 0 0 3px rgba(231, 76, 60, 0.1);
}

.error-message {
    color: #e74c3c;
    font-size: 0.8rem;
    margin-top: 5px;
}

/* 内容页面模式样式 */
.content-page-container {
    width: 100%;
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
}

.page-content {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    padding: 32px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

/* 嵌入表单样式 */
.embedded-form {
    margin: 20px 0;
    padding: 25px;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.embedded-form .form-header {
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #e9ecef;
}

.embedded-form .form-header h3 {
    color: #333;
    margin: 0 0 8px 0;
    font-size: 1.3rem;
    font-weight: 600;
}

.embedded-form .form-header p {
    color: #6c757d;
    margin: 0;
    font-size: 0.95rem;
}

/* 修复p标签包裹表单的间距问题 */
.page-content p:has(.embedded-form),
.page-content p:empty {
    margin: 0;
    padding: 0;
    line-height: 0;
}

/* 如果p标签只包含表单，移除所有间距 */
.page-content p:has(.embedded-form) {
    margin: 0 !important;
    padding: 0 !important;
    line-height: 1.8;
}

.page-content h1, .page-content h2, .page-content h3 {
    color: #2d3748;
    margin-bottom: 16px;
}

.page-content p {
    margin-bottom: 16px;
    color: #4a5568;
}

.page-content ul, .page-content ol {
    margin-bottom: 16px;
    padding-left: 24px;
}

.page-content a {
    color: #667eea;
    text-decoration: none;
}

.page-content a:hover {
    text-decoration: underline;
}

.page-content img{
    max-width: 100%;
    height: auto;
}

/* 嵌入表单样式 */
.embedded-form {
    background: #ffffff;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    padding: 24px;
    margin: 24px 0;
}

.embedded-form .form-header {
    text-align: center;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid #e2e8f0;
    background: unset;
}

.embedded-form .form-header h3 {
    color: #2d3748;
    margin: 0 0 8px 0;
    font-size: 1.4rem;
}

.embedded-form .form-header p {
    color: #718096;
    margin: 0;
    font-size: 0.95rem;
}

/* 嵌入表单的表单字段样式 - 与主表单完全一致 */
.embedded-form .form-group {
    margin-bottom: 20px;
}

.embedded-form .form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
    font-size: 0.9rem;
}

.embedded-form .required-star {
    color: #e74c3c;
    margin-left: 2px;
}

.embedded-form .form-group input[type="text"],
.embedded-form .form-group input[type="email"],
.embedded-form .form-group input[type="date"],
.embedded-form .form-group select,
.embedded-form .form-group textarea {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e9ecef;
    border-radius: 10px;
    font-size: 1rem;
    background: #fff;
    transition: all 0.3s ease;
    -webkit-appearance: none;
    appearance: none;
}

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

.embedded-form .form-group select {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 12px center;
    background-repeat: no-repeat;
    background-size: 16px;
    padding-right: 40px;
}

.embedded-form .form-group input[type="file"] {
    width: 100%;
    padding: 12px 16px;
    border: 2px dashed #d1d5db;
    border-radius: 10px;
    background: #f9fafb;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.embedded-form .form-group input[type="file"]:hover {
    border-color: #667eea;
    background: #f0f4ff;
}

/* 嵌入表单的多图上传样式 - 与主表单完全一致 */
.embedded-form .multi-file-upload {
    width: 100%;
}

.embedded-form .multi-file-input {
    width: 100%;
    padding: 12px 16px;
    border: 2px dashed #d1d5db;
    border-radius: 10px;
    background: #f9fafb;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.embedded-form .multi-file-input:hover {
    border-color: #667eea;
    background: #f0f4ff;
}

.embedded-form .file-upload-hint {
    font-size: 0.8rem;
    color: #6b7280;
    margin-top: 5px;
    text-align: center;
    transition: all 0.3s ease;
}

.embedded-form .file-upload-hint.has-files {
    color: #667eea;
    font-weight: 500;
}

.embedded-form .file-preview {
    margin-top: 12px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 8px;
}

.embedded-form .preview-item {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    background: #f3f4f6;
    aspect-ratio: 1;
}

.embedded-form .preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.embedded-form .preview-item .remove-btn {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 18px;
    height: 18px;
    background: rgba(239, 68, 68, 0.8);
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.embedded-form .preview-item .remove-btn:hover {
    background: rgba(239, 68, 68, 1);
    transform: scale(1.1);
}

/* 嵌入式表单单图上传预览样式 */
.embedded-form .single-image-upload {
    position: relative;
}

.embedded-form .single-image-preview {
    margin-top: 12px;
    display: inline-block;
}

.embedded-form .single-image-preview .preview-container {
    position: relative;
    width: 90px;
    height: 90px;
    border-radius: 8px;
    overflow: hidden;
    background: #f3f4f6;
}

.embedded-form .single-image-preview .preview-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.embedded-form .single-image-preview .remove-preview {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 18px;
    height: 18px;
    background: rgba(239, 68, 68, 0.8);
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.embedded-form .single-image-preview .remove-preview:hover {
    background: rgba(239, 68, 68, 1);
    transform: scale(1.1);
}

.embedded-form .options-container {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 8px;
}

.embedded-form .options-container label.option-item{
    margin-bottom: 0;
}

.embedded-form .option-item {
    display: flex;
    align-items: center;
    font-weight: normal;
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 8px;
    background: #f8f9fa;
    border: 2px solid transparent;
    transition: all 0.3s ease;
    font-size: 0.9rem;
    min-width: 0;
    flex: 1;
    min-width: 120px;
}

.embedded-form .option-item:hover {
    background: #e9ecef;
}

.embedded-form .option-item.selected {
    background: #667eea;
    color: #fff;
    border-color: #667eea;
}

.embedded-form .option-item input[type="radio"],
.embedded-form .option-item input[type="checkbox"] {
    margin-right: 8px;
    margin-left: 0;
    transform: scale(1.2);
}

.embedded-form .validation-tip {
    display: block;
    margin-top: 5px;
    color: #6b7280;
    font-size: 0.8rem;
}

.embedded-form .form-actions {
    margin-top: 30px;
    text-align: center;
}

.embedded-form .submit-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 16px 40px;
    font-size: 1.1rem;
    font-weight: 600;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s;
    text-transform: uppercase;
    letter-spacing: 1px;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
    width: 100%;
    max-width: 300px;
    margin: 0 auto;
    display: block;
}

.embedded-form .submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.6);
}

.embedded-form .submit-btn:active {
    transform: translateY(0);
}

@media (max-width: 768px) {
    .content-page-container {
        padding: 0;
    }
    
    .page-content {
        padding: 10px;
        border-radius:0;
    }
    
    .embedded-form {
        padding: 16px;
        margin: 16px 0;
    }
}