/* ============================================
   DTL 表单构建器 - 前端表单样式
   ============================================ */

.dtl-form-container {
    max-width: 800px;
    margin: 0 auto;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans SC", sans-serif;
    color: #333;
    line-height: 1.6;
}

.dtl-form {
    width: 100%;
}

/* 表单行（两列布局） */
.dtl-form-row {
    display: flex;
    gap: 20px;
    margin-bottom: 0;
}

.dtl-form-row .dtl-form-group {
    flex: 1;
    min-width: 0;
}

/* 表单组 */
.dtl-form-group {
    margin-bottom: 20px;
}

/* 标签 */
.dtl-form-label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
}

.dtl-form-req {
    color: #e74c3c;
    margin-left: 2px;
}

/* 输入框通用样式 */
.dtl-form-input,
.dtl-form-select,
.dtl-textarea {
    width: 100%;
    padding: 10px 14px;
    font-size: 14px;
    line-height: 1.5;
    color: #333;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    transition: all 0.3s ease;
    box-sizing: border-box;
    outline: none;
    font-family: inherit;
}

.dtl-form-input:focus,
.dtl-form-select:focus,
.dtl-textarea:focus {
    border-color: #2271b1;
    box-shadow: 0 0 0 3px rgba(34, 113, 177, 0.15);
}

.dtl-form-input::placeholder,
.dtl-textarea::placeholder {
    color: #aaa;
}

/* 下拉选择框 */
.dtl-form-select {
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23666' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
    cursor: pointer;
}

/* 多行文本框 */
.dtl-textarea {
    min-height: 120px;
    resize: vertical;
}

/* 提示文字 */
.dtl-form-hint {
    font-size: 12px;
    color: #999;
    margin-top: 6px;
}

/* ============================================
   单选按钮组
   ============================================ */
.dtl-form-radio-group {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.dtl-form-radio-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: #f8f9fa;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 14px;
    user-select: none;
}

.dtl-form-radio-item:hover {
    border-color: #2271b1;
    background: #f0f7fc;
}

.dtl-form-radio-item input[type="radio"] {
    display: none;
}

.dtl-form-radio-dot {
    width: 18px;
    height: 18px;
    border: 2px solid #ccc;
    border-radius: 50%;
    position: relative;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.dtl-form-radio-item.dtl-radio-checked {
    border-color: #2271b1;
    background: #e8f4fd;
}

.dtl-form-radio-item.dtl-radio-checked .dtl-form-radio-dot {
    border-color: #2271b1;
}

.dtl-form-radio-item.dtl-radio-checked .dtl-form-radio-dot::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 8px;
    height: 8px;
    background: #2271b1;
    border-radius: 50%;
}

/* ============================================
   复选框组
   ============================================ */
.dtl-form-checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.dtl-form-checkbox-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: #f8f9fa;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 14px;
    user-select: none;
}

.dtl-form-checkbox-item:hover {
    border-color: #2271b1;
    background: #f0f7fc;
}

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

.dtl-form-checkbox-box {
    width: 18px;
    height: 18px;
    border: 2px solid #ccc;
    border-radius: 4px;
    position: relative;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.dtl-form-checkbox-item.dtl-checkbox-checked {
    border-color: #2271b1;
    background: #e8f4fd;
}

.dtl-form-checkbox-item.dtl-checkbox-checked .dtl-form-checkbox-box {
    background: #2271b1;
    border-color: #2271b1;
}

.dtl-form-checkbox-item.dtl-checkbox-checked .dtl-form-checkbox-box::after {
    content: '';
    position: absolute;
    top: 1px;
    left: 5px;
    width: 5px;
    height: 9px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

/* ============================================
   文件上传
   ============================================ */
.dtl-form-upload-area {
    border: 2px dashed #ddd;
    border-radius: 12px;
    padding: 30px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: #fafafa;
}

.dtl-form-upload-area:hover {
    border-color: #2271b1;
    background: #f0f7fc;
}

.dtl-form-upload-icon {
    font-size: 36px;
    color: #bbb;
    margin-bottom: 10px;
}

.dtl-form-upload-text {
    font-size: 14px;
    color: #666;
}

.dtl-form-upload-text span {
    color: #2271b1;
    font-weight: 600;
    text-decoration: underline;
}

.dtl-form-upload-hint {
    font-size: 12px;
    color: #999;
    margin-top: 8px;
}

/* 上传预览 */
.dtl-form-upload-preview {
    display: none;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    margin-top: 10px;
}

.dtl-form-upload-preview.visible {
    display: flex;
}

.dtl-form-upload-file-icon {
    font-size: 24px;
    color: #2271b1;
}

.dtl-form-upload-file-info {
    flex: 1;
}

.dtl-form-upload-file-name {
    font-size: 14px;
    font-weight: 600;
    color: #333;
}

.dtl-form-upload-file-size {
    font-size: 12px;
    color: #999;
}

.dtl-form-upload-remove {
    background: none;
    border: none;
    color: #999;
    cursor: pointer;
    font-size: 16px;
    padding: 4px;
    transition: color 0.2s;
}

.dtl-form-upload-remove:hover {
    color: #e74c3c;
}

/* ============================================
   响应式
   ============================================ */
@media (max-width: 600px) {
    .dtl-form-row {
        flex-direction: column;
        gap: 0;
    }

    .dtl-form-radio-group,
    .dtl-form-checkbox-group {
        flex-direction: column;
    }

    .dtl-form-radio-item,
    .dtl-form-checkbox-item {
        width: 100%;
    }
}
