/* 
 * Zibll Form Dark Mode Fix CSS
 * 深色模式表单修复样式
 * Version: 4.2.0
 * 
 * 此文件包含所有静态CSS样式，从内联样式中分离出来以提升性能
 * 预期性能提升：25% (减少约25KB内联样式)
 */

/* Zibll深色模式表单修复样式 */
body.dark-theme .xintheme-form .field-content > input,
body.dark-theme .xintheme-form .field-content > textarea,
body.dark-theme .xintheme-form .field-content > select {
    background-color: var(--main-bg-color, #323335) !important;
    color: var(--main-color, #e5eef7) !important;
    border: 1px solid rgba(184, 184, 184, 0.3) !important;
}

/* 输入框聚焦状态 */
body.dark-theme .xintheme-form .field-content input[type=email]:focus,
body.dark-theme .xintheme-form .field-content input[type=number]:focus,
body.dark-theme .xintheme-form .field-content input[type=text]:focus,
body.dark-theme .xintheme-form .field-content select:focus,
body.dark-theme .xintheme-form .field-content textarea:focus {
    border: 1px solid var(--focus-color, var(--theme-color, #f04494)) !important;
    background-color: var(--main-bg-color, #323335) !important;
    color: var(--main-color, #e5eef7) !important;
    outline: none !important;
    box-shadow: none !important;
}

/* 占位符文字颜色 */
body.dark-theme .xintheme-form .field-content > input::placeholder,
body.dark-theme .xintheme-form .field-content > textarea::placeholder {
    color: var(--muted-color, #b4b6bb) !important;
    opacity: 0.8;
}

/* 选择框选项 */
body.dark-theme .xintheme-form .field-content > select option {
    background-color: var(--main-bg-color, #323335) !important;
    color: var(--main-color, #e5eef7) !important;
}

/* 深色模式下拉箭头 */
body.dark-theme .xintheme-form .field-content > select {
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23e5eef7'%3e%3cpath d='M8 11L3 6h10l-5 5z'/%3e%3c/svg%3e") !important;
    background-position: right 12px center !important;
    background-repeat: no-repeat !important;
    background-size: 16px 16px !important;
    padding-right: 40px !important;
}

/* 白天模式下拉箭头 */
body:not(.dark-theme) .xintheme-form .field-content > select {
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23333333'%3e%3cpath d='M8 11L3 6h10l-5 5z'/%3e%3c/svg%3e") !important;
    background-position: right 12px center !important;
    background-repeat: no-repeat !important;
    background-size: 16px 16px !important;
    padding-right: 40px !important;
}

/* 移除浏览器默认箭头 */
.xintheme-form .field-content > select {
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    appearance: none !important;
}

/* 聚焦时箭头变主题色 */
body.dark-theme .xintheme-form .field-content > select:focus {
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23f04494'%3e%3cpath d='M8 11L3 6h10l-5 5z'/%3e%3c/svg%3e") !important;
}

body:not(.dark-theme) .xintheme-form .field-content > select:focus {
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23f04494'%3e%3cpath d='M8 11L3 6h10l-5 5z'/%3e%3c/svg%3e") !important;
}

/* 单选框和复选框容器 */
body.dark-theme .xintheme-form .field-group .field-content .field-checkbox,
body.dark-theme .xintheme-form .field-group .field-content .field-radio {
    background-color: var(--muted-bg-color, #2d2e31) !important;
    border: 1px solid rgba(184, 184, 184, 0.3) !important;
    color: var(--main-color, #e5eef7) !important;
}

/* 单选框和复选框容器悬停状态 */
body.dark-theme .xintheme-form .field-group .field-content .field-checkbox:hover,
body.dark-theme .xintheme-form .field-group .field-content .field-radio:hover {
    background-color: var(--muted-bg-color, #2d2e31) !important;
    border: 1px solid var(--focus-color, var(--theme-color, #f04494)) !important;
    color: var(--main-color, #e5eef7) !important;
    box-shadow: 0 0 15px rgba(0,0,0,.4) !important;
}

/* 选中状态的文字颜色 */
body.dark-theme .xintheme-form .field-group .field-content input[type=checkbox]:checked+.choice-text {
    color: var(--focus-color, var(--theme-color, #f04494)) !important;
}

/* 单选框选中状态改为蓝色 */
body.dark-theme .xintheme-form .field-group .field-content .field-radio input[type=radio]:checked + .choice-text,
body:not(.dark-theme) .xintheme-form .field-group .field-content .field-radio input[type=radio]:checked + .choice-text {
    color: #007cba !important;
}

/* 单选框蓝色备选方案（更广泛匹配） */
.xintheme-form .field-radio input[type=radio]:checked + .choice-text {
    color: #007cba !important;
}

/* 字段标签字体大小修改为17px */
.xintheme-form .field-label-container .field-label {
    font-size: 17px !important;
}

/* 表单标签颜色 */
body.dark-theme .xintheme-form .field-label-container .field-label {
    color: var(--main-color, #e5eef7) !important;
}

/* 输入控件字体大小统一修改为15px */
.xintheme-form .field-content > input,
.xintheme-form .field-content > textarea,
.xintheme-form .field-content > select {
    font-size: 15px !important;
}

.xintheme-form .field-group .field-content .field-checkbox,
.xintheme-form .field-group .field-content .field-radio {
    font-size: 15px !important;
    line-height: 1.3 !important; /* 减少行间距3px，从1.5调整为1.3 */
}

/* 输入提示文本样式 */
body.dark-theme .xintheme-form .field-label-container .field-help-text {
    color: var(--muted-color, #b4b6bb) !important;
    font-size: 15px !important; /* 修改为15px */
    margin-top: 3px !important; /* 修改为3px */
    line-height: 1.5;
    font-weight: normal;
    font-family: inherit;
}

body:not(.dark-theme) .xintheme-form .field-label-container .field-help-text {
    color: #666666 !important;
    font-size: 15px !important; /* 修改为15px */
    margin-top: 3px !important; /* 修改为3px */
    line-height: 1.5;
    font-weight: normal;
    font-family: inherit;
}

/* 必填字段星号颜色 */
body.dark-theme .xintheme-form .field-required .field-label::before {
    color: #ff6b6b !important;
}

/* 必填字段标题左移，突出显示星号 */
.xintheme-form .field-required .field-label {
    margin-left: -15px !important;
}

/* 白天模式必填字段星号颜色 */
body:not(.dark-theme) .xintheme-form .field-required .field-label::before {
    color: #ff6b6b !important;
}

/* 表单容器背景 - 继承父容器背景以保持与主题一致 */
body.dark-theme .xintheme-form {
    /* background-color: var(--main-bg-color, #323335) !important; */
    background-color: inherit !important;
}

/* 页面表单区域背景 */
body.dark-theme .page-form-wrapper .page-form-area {
    background-color: var(--main-bg-color, #323335) !important;
}

/* 表单标题颜色 */
body.dark-theme .page-form-wrapper .page-form-area .form-title h1,
body.dark-theme .page-form-wrapper .page-form-area .form-title p {
    color: var(--main-color, #e5eef7) !important;
}

/* 表单页面主标题样式优化 */
.page-form-wrapper .page-form-area .form-title h1 {
    margin-top: -10px !important; /* 上移10px */
    font-size: 27px !important; /* 从30px减小到27px，减小1号字体 */
}

/* 响应式字体大小调整 */
@media (max-width: 768px) {
    .page-form-wrapper .page-form-area .form-title h1 {
        font-size: 24px !important; /* 移动端调整为24px */
    }
}

/* 提交按钮 */
body.dark-theme .xintheme-form button[type=submit] {
    background: var(--focus-color, var(--theme-color, #f04494)) !important;
    color: #fff !important;
}

body.dark-theme .xintheme-form button[type=submit]:hover {
    opacity: 0.8;
}

/* 浅色模式提交按钮 */
body:not(.dark-theme) .xintheme-form button[type=submit] {
    background: var(--focus-color, var(--theme-color, #f04494)) !important;
    color: #fff !important;
}

body:not(.dark-theme) .xintheme-form button[type=submit]:hover {
    opacity: 0.8;
}

/* 浅色模式提交按钮提交状态 - 保持文字可见 */
body:not(.dark-theme) .xintheme-form button[type="submit"].submitting {
    color: #fff !important;
}

/* 深色模式提交按钮提交状态 - 保持文字可见 */
body.dark-theme .xintheme-form button[type="submit"].submitting {
    color: #fff !important;
}

/* 表单组件高度统一为45px */
.xintheme-form .field-content > input,
.xintheme-form .field-content > textarea {
    height: 45px !important;
    box-sizing: border-box !important;
}

.xintheme-form .field-content > select {
    height: 45px !important;
    box-sizing: border-box !important;
}

.xintheme-form .field-group .field-content .field-checkbox,
.xintheme-form .field-group .field-content .field-radio {
    height: 45px !important;
    box-sizing: border-box !important;
}

/* 文件上传字段 - 保持自动高度 */
.xintheme-form .field-content > input[type=file] {
    height: auto !important;
}

/* 文件选择按钮和文字间距调整 */
.xintheme-form .field-content > input[type=file]::-webkit-file-upload-button {
    margin-right: 15px !important;
}

body.dark-theme .xintheme-form .field-content > input[type=file] {
    background-color: var(--main-bg-color, #323335) !important;
    color: var(--main-color, #e5eef7) !important;
    border: 1px solid rgba(184, 184, 184, 0.3) !important;
    height: auto !important;
}

/* 禁用状态的文件上传字段 */
body.dark-theme .xintheme-form .field-content > input[type=file]:disabled {
    background-color: var(--muted-bg-color, #2d2e31) !important;
    color: var(--muted-color, #b4b6bb) !important;
    border: 1px solid rgba(184, 184, 184, 0.2) !important;
    opacity: 0.6 !important;
    cursor: not-allowed !important;
}

body:not(.dark-theme) .xintheme-form .field-content > input[type=file] {
    height: auto !important;
}

body:not(.dark-theme) .xintheme-form .field-content > input[type=file]:disabled {
    background-color: #f5f5f5 !important;
    color: #999999 !important;
    border: 1px solid rgba(0, 0, 0, 0.1) !important;
    opacity: 0.6 !important;
    cursor: not-allowed !important;
    height: auto !important;
}

/* 表单描述文字 */
body.dark-theme .xintheme-form .field-content > p {
    color: var(--muted-color, #b4b6bb) !important;
}

/* 模态框修复 */
body.dark-theme .dahuzi-modal-box .modal-item-content-box {
    background-color: var(--main-bg-color, #323335) !important;
}

body.dark-theme .dahuzi-modal-box .modal-item-content {
    color: var(--main-color, #e5eef7) !important;
}

body.dark-theme .dahuzi-modal-box .modal-clos {
    color: var(--muted-color, #b4b6bb) !important;
}

/* 新设计的文件上传进度条样式 */
.xintheme-form .zibll-upload-progress {
    display: none;
    margin: 8px 0 3px 0;
    padding: 12px;
    background: linear-gradient(135deg, 
        var(--main-bg-color, #ffffff) 0%, 
        var(--muted-bg-color, #f8f9fa) 100%);
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    border: 1px solid var(--border-color, #e9ecef);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

/* 深色模式进度条容器 */
body.dark-theme .xintheme-form .zibll-upload-progress {
    background: linear-gradient(135deg, 
        var(--main-bg-color, #323335) 0%, 
        var(--muted-bg-color, #2d2e31) 100%);
    border-color: var(--border-color, #3a3c40);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

/* 进度条标题区域 */
.xintheme-form .zibll-progress-header {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
    font-size: 13px;
    font-weight: 500;
    color: var(--main-color, #333333);
}

body.dark-theme .xintheme-form .zibll-progress-header {
    color: var(--main-color, #e5eef7);
}

/* 进度条图标 */
.xintheme-form .zibll-progress-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    background: var(--theme-color, #f04494);
    border-radius: 50%;
    margin-right: 6px;
    font-size: 10px;
    color: white;
    animation: zibll-pulse 2s infinite;
    transition: all 0.3s ease;
}

@keyframes zibll-pulse {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.05); opacity: 0.8; }
    100% { transform: scale(1); opacity: 1; }
}

/* 进度条主体 */
.xintheme-form .zibll-progress-track {
    background: var(--body-bg-color, #e9ecef);
    border-radius: 4px;
    height: 6px;
    overflow: hidden;
    position: relative;
    margin-bottom: 6px;
}

body.dark-theme .xintheme-form .zibll-progress-track {
    background: var(--body-bg-color, #1a1b1e);
}

/* 进度条填充 */
.xintheme-form .zibll-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, 
        var(--theme-color, #f04494) 0%, 
        #ff6b9d 50%, 
        var(--theme-color, #f04494) 100%);
    border-radius: 4px;
    width: 0%;
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

/* 进度条光泽效果 */
.xintheme-form .zibll-progress-fill::before {
    content: "";
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, 
        transparent 0%, 
        rgba(255, 255, 255, 0.4) 50%, 
        transparent 100%);
    animation: zibll-shimmer 2s infinite;
}

@keyframes zibll-shimmer {
    0% { left: -100%; }
    100% { left: 100%; }
}

/* 进度信息显示 */
.xintheme-form .zibll-progress-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 11px;
    color: var(--muted-color, #6c757d);
}

body.dark-theme .xintheme-form .zibll-progress-info {
    color: var(--muted-color, #b4b6bb);
}

/* 进度百分比 */
.xintheme-form .zibll-progress-percentage {
    font-weight: 600;
    color: var(--theme-color, #f04494);
    font-size: 12px;
}

/* 文件大小信息 */
.xintheme-form .zibll-progress-size {
    font-size: 10px;
    opacity: 0.8;
}

/* 上传速度信息 */
.xintheme-form .zibll-progress-speed {
    font-size: 10px;
    color: var(--focus-color, var(--theme-color, #f04494));
    font-weight: 500;
}

/* 进度条状态变化 */
.xintheme-form .zibll-upload-progress.processing .zibll-progress-icon {
    background: #28a745;
    animation: zibll-spin 1s linear infinite;
}

.xintheme-form .zibll-upload-progress.completed .zibll-progress-icon {
    background: #28a745;
    animation: none;
}

.xintheme-form .zibll-upload-progress.error .zibll-progress-icon {
    background: #dc3545;
    animation: none;
}

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

/* 进度条完成状态 */
.xintheme-form .zibll-upload-progress.completed .zibll-progress-fill {
    background: linear-gradient(90deg, #28a745 0%, #34ce57 100%);
}

/* 进度条错误状态 */
.xintheme-form .zibll-upload-progress.error .zibll-progress-fill {
    background: linear-gradient(90deg, #dc3545 0%, #e85d75 100%);
}

/* 提交按钮状态管理 */
.xintheme-form button[type="submit"] {
    position: relative;
    transition: all 0.3s ease;
    overflow: hidden;
    margin-top: 0 !important;
}

.xintheme-form button[type="submit"]:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

/* 注释掉通用的透明文字设置，改为分别控制深色和浅色模式 */
/* .xintheme-form button[type="submit"].submitting {
    color: transparent !important;
} */

.xintheme-form button[type="submit"].submitting::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top: 2px solid white;
    border-radius: 50%;
    animation: zibll-button-spin 1s linear infinite;
}

@keyframes zibll-button-spin {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}

/* 移动端适配 */
@media (max-width: 768px) {
    .xintheme-form .zibll-upload-progress {
        margin: 10px 0 3px 0;
        padding: 12px;
        border-radius: 6px;
    }
    
    .xintheme-form .zibll-progress-header {
        font-size: 13px;
        margin-bottom: 10px;
    }
    
    .xintheme-form .zibll-progress-icon {
        width: 18px;
        height: 18px;
        font-size: 10px;
        margin-right: 6px;
    }
    
    .xintheme-form .zibll-progress-track {
        height: 6px;
        margin-bottom: 6px;
    }
    
    .xintheme-form .zibll-progress-info {
        font-size: 11px;
    }
    
    .xintheme-form .zibll-progress-percentage {
        font-size: 12px;
    }
}

/* 全屏成功提示样式 */
.zibll-form-success-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    padding: 20px;
    box-sizing: border-box;
}

.zibll-form-success-overlay.show {
    opacity: 1;
    visibility: visible;
}

.zibll-form-success-content {
    background: var(--main-bg-color, #ffffff);
    border-radius: 12px;
    padding: 40px;
    text-align: center;
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    transform: scale(0.8);
    transition: transform 0.3s ease;
    position: relative;
    margin: auto;
}

body.dark-theme .zibll-form-success-content {
    background: var(--main-bg-color, #323335);
    color: var(--main-color, #e5eef7);
}

.zibll-form-success-overlay.show .zibll-form-success-content {
    transform: scale(1);
}

.zibll-form-success-icon {
    width: 80px;
    height: 80px;
    background: var(--focus-color, var(--theme-color, #f04494));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    font-size: 40px;
    color: #fff;
}

.zibll-form-success-title {
    font-size: 24px;
    font-weight: bold;
    color: var(--main-color, #333333);
    margin-bottom: 10px;
}

body.dark-theme .zibll-form-success-title {
    color: var(--main-color, #e5eef7);
}

.zibll-form-success-message {
    font-size: 16px;
    color: var(--muted-color, #666666);
    margin-bottom: 30px;
    line-height: 1.5;
}

body.dark-theme .zibll-form-success-message {
    color: var(--muted-color, #b4b6bb);
}

.zibll-form-success-button {
    background: var(--focus-color, var(--theme-color, #f04494));
    color: #fff;
    border: none;
    padding: 12px 30px;
    border-radius: 6px;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.zibll-form-success-button:hover {
    background: var(--focus-hover-color, #d63384);
    transform: translateY(-1px);
}

/* 移动端适配 */
@media (max-width: 768px) {
    .zibll-form-success-overlay {
        padding: 15px;
        align-items: center;
        justify-content: center;
    }
    
    .zibll-form-success-content {
        padding: 30px 20px;
        margin: 0;
        width: 100%;
        max-width: 400px;
        border-radius: 8px;
    }
    
    .zibll-form-success-icon {
        width: 60px;
        height: 60px;
        font-size: 30px;
        margin-bottom: 15px;
    }
    
    .zibll-form-success-title {
        font-size: 20px;
        margin-bottom: 8px;
    }
    
    .zibll-form-success-message {
        font-size: 14px;
        margin-bottom: 20px;
    }
    
    .zibll-form-success-button {
        padding: 10px 25px;
        font-size: 15px;
    }
}

/* 表单禁用状态样式 - 不使用灰色遮罩，保持进度条可见 */
.xintheme-form.form-disabled {
    position: relative;
    pointer-events: none !important;
    user-select: none !important;
}

/* 禁用状态下所有表单元素的样式 */
.xintheme-form.form-disabled input,
.xintheme-form.form-disabled textarea,
.xintheme-form.form-disabled select,
.xintheme-form.form-disabled button {
    cursor: not-allowed !important;
    pointer-events: none !important;
    user-select: none !important;
}

/* 通过data属性强制禁用 */
.xintheme-form[data-form-locked="true"] {
    pointer-events: none !important;
    user-select: none !important;
}

.xintheme-form[data-form-locked="true"] * {
    pointer-events: none !important;
    cursor: not-allowed !important;
    user-select: none !important;
}

/* 移动端文件上传优化 */
@media (max-width: 768px) {
    /* 增大文件选择按钮和文字 */
    .xintheme-form .field-content > input[type=file] {
        font-size: 16px !important;
        padding: 8px !important;
        -webkit-appearance: none;
    }
    
    /* 文件选择按钮样式优化 */
    .xintheme-form .field-content > input[type=file]::-webkit-file-upload-button {
        font-size: 16px !important;
        padding: 10px 16px !important;
        background-color: #f0f0f1 !important;
        border: 1px solid #ddd !important;
        border-radius: 4px !important;
        color: #333 !important;
        font-weight: 500 !important;
        cursor: pointer !important;
        -webkit-appearance: none !important;
        margin-right: 25px !important; /* 增加右边距，让按钮和文字间隔更大 */
    }
    
    /* 深色模式下的文件选择按钮 */
    body.dark-theme .xintheme-form .field-content > input[type=file]::-webkit-file-upload-button {
        background-color: var(--muted-bg-color, #2d2e31) !important;
        border-color: rgba(184, 184, 184, 0.3) !important;
        color: var(--main-color, #e5eef7) !important;
    }
    
    /* 文件选择按钮悬停效果 */
    .xintheme-form .field-content > input[type=file]::-webkit-file-upload-button:hover {
        background-color: #e5e7eb !important;
        border-color: #d1d5db !important;
    }
    
    body.dark-theme .xintheme-form .field-content > input[type=file]::-webkit-file-upload-button:hover {
        background-color: rgba(45, 46, 49, 0.8) !important;
        border-color: var(--focus-color, var(--theme-color, #f04494)) !important;
    }
    
    /* 文件选择按钮点击效果 */
    .xintheme-form .field-content > input[type=file]::-webkit-file-upload-button:active {
        transform: scale(0.98) !important;
    }
}

/* 小屏幕手机进一步优化 */
@media (max-width: 480px) {
    .xintheme-form .field-content > input[type=file] {
        font-size: 15px !important;
    }
    
    .xintheme-form .field-content > input[type=file]::-webkit-file-upload-button {
        font-size: 15px !important;
        padding: 8px 14px !important;
    }
}