/**
 * index-upload.css - 首页上传弹窗样式
 * 包含上传弹窗的5个状态：
 * 1. 初始状态（示例图+上传按钮）
 * 2. 非正方形检测
 * 3. 非原图检测
 * 4. 识别成功自动上传中
 * 5. 四象九宫失败手动提交
 */

/* ============================================
   上传弹窗基础结构
   ============================================ */
#upload-modal {
    z-index: 10000;
}

#upload-modal .tips-overlay {
    padding: 6vh 5vw;
}

.upload-modal-content {
    width: 85.51vw;
    max-width: 85.51vw;
    max-height: calc(100vh - 80px);
    background: #FFFFFF;
    border-radius: 40px;
    border: 3px solid transparent;
    background: linear-gradient(#FFF, #FFF) padding-box,
                linear-gradient(180deg, #54FF9A 0%, #222222 100%) border-box;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 4.83vw 20px;
    box-sizing: border-box;
    position: fixed;
    bottom: 60px;
    left: 50%;
    transform: translateX(-50%);
    overflow: hidden;
}

/* ============================================
   状态通用元素
   ============================================ */
.upload-state {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.upload-modal-title {
    font-weight: 600;
    font-size: 4.83vw;
    line-height: 5.8vw;
    color: #222222;
    margin-top: 20px;
    text-align: center;
    font-family: system-ui, -apple-system, sans-serif;
}

.upload-modal-title-line {
    width: 60%;
    height: 0.72vw;
    min-height: 3px;
    border-radius: 0.48vw;
    margin-top: 1.21vw;
    background-color: #54FF9A;
}

/* ============================================
   状态1: 初始状态
   ============================================ */
.upload-example-images {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 4.83vw;
    margin-top: 4.83vw;
    width: 100%;
}

.upload-example-img {
    width: auto;
    height: 19.32vw;
    max-height: 80px;
    object-fit: contain;
    border-radius: 5px;
}

.upload-example-caption {
    font-weight: 500;
    font-size: 3.86vw;
    color: #000000;
    margin-top: 2.42vw;
    text-align: center;
    font-family: system-ui, -apple-system, sans-serif;
}

.upload-highlight {
    color: #870000;
}

.upload-description-box {
    width: 100%;
    margin: 4.83vw 0 0 0;
    border-radius: 1.21vw;
    padding: 4.83vw;
    box-sizing: border-box;
    background-color: #f8f8f8;
    overflow: hidden;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.upload-description-text {
    font-size: 3.86vw;
    line-height: 6.04vw;
    color: #222222;
    overflow-y: auto;
    max-height: 100%;
    padding-right: 1.21vw;
    font-family: system-ui, -apple-system, sans-serif;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}

.upload-description-text p {
    margin: 0 0 3.86vw 0;
}

.upload-description-text p:last-child {
    margin-bottom: 0;
}

.upload-description-text strong {
    font-weight: 500;
}

.upload-text-highlight {
    color: #5B1A89;
}

.upload-wechat-guide {
    width: 100%;
    height: auto;
    object-fit: contain;
    margin: 2.23vh 0 0 0;
}

.upload-foot-text {
    text-align: center;
    font-size: clamp(14px, 4vw, 18px);
    line-height: 1.5;
    color: #8B7355;
    margin-top: 2.23vh;
    margin-bottom: 2.23vh;
}

.upload-foot-text p {
    margin: 0;
}

.upload-foot-text p:last-child {
    font-weight: 600;
    color: #5A3701;
    white-space: nowrap;
}

/* 上传按钮 - 状态1 */
.upload-btn-upload {
    width: 100%;
    height: 12.08vw;
    max-height: 50px;
    border-radius: 24.15vw;
    border: none;
    font-weight: 600;
    font-size: 3.86vw;
    text-align: center;
    cursor: pointer;
    font-family: system-ui, -apple-system, sans-serif;
    flex-shrink: 0;
    margin-top: auto;
    background: #000000;
    color: #54FF9A;
}

.upload-btn-upload:active {
    opacity: 0.8;
    transform: scale(0.98);
}

/* ============================================
   状态2&3: 错误状态（非正方形/非原图）
   ============================================ */
.upload-preview-wrapper {
    position: relative;
    width: 200px;
    height: 200px;
    margin-top: 4.83vw;
    border-radius: 10px;
    overflow: hidden;
}

.upload-preview-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* 错误遮罩层 */
.upload-error-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
}

.upload-error-text {
    color: #ffffff;
    font-size: 16px;
    text-align: center;
    line-height: 1.5;
    font-weight: 500;
    white-space: pre-line;
}

/* 重新上传按钮 */
.upload-btn-retry {
    width: 100%;
    height: 12.08vw;
    max-height: 50px;
    border-radius: 24.15vw;
    border: none;
    font-weight: 600;
    font-size: 3.86vw;
    text-align: center;
    cursor: pointer;
    font-family: system-ui, -apple-system, sans-serif;
    flex-shrink: 0;
    margin-top: 4.83vw;
    background: #000000;
    color: #54FF9A;
}

.upload-btn-retry:active {
    opacity: 0.8;
    transform: scale(0.98);
}

/* ============================================
   状态4&5: 成功状态
   ============================================ */
.upload-success-wrapper {
    position: relative;
}

.upload-success-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
}

.upload-success-overlay-static {
    background: rgba(0, 0, 0, 0.2);
}

.upload-success-icon {
    width: 48px;
    height: 48px;
    margin-bottom: 10px;
}

.upload-success-text {
    color: #ffffff;
    font-size: 16px;
    font-weight: 500;
    text-align: center;
}

/* Loading 指示器 - 状态4 */
.upload-loading-indicator {
    margin-top: 4.83vw;
    display: flex;
    justify-content: center;
    align-items: center;
}

.upload-loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #54FF9A;
    border-radius: 50%;
    animation: upload-spin 1s linear infinite;
}

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

/* ============================================
   状态5: 四象九宫失败手动提交（特殊布局）
   ============================================ */
.upload-success-preview {
    width: 200px;
    height: 200px;
    margin-top: 77px;
    border-radius: 10px;
    overflow: hidden;
}

.upload-success-preview .upload-preview-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.upload-success-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 30px;
    gap: 10px;
}

/* 状态4: 识别成功上传中 - 指示器下边距 */
#upload-state-4 .upload-success-indicator {
    margin-bottom: 77px;
}

.upload-success-indicator .upload-success-icon {
    width: 20px;
    height: 20px;
    margin-bottom: 0;
}

.upload-success-indicator .upload-success-text {
    font-size: 20px;
    font-weight: 500;
    color: #222222;
    line-height: 20px;
}

/* 确认提交按钮 - 状态5 */
.upload-btn-submit {
    width: 100%;
    height: 12.08vw;
    max-height: 50px;
    border-radius: 24.15vw;
    border: none;
    font-weight: 600;
    font-size: 3.86vw;
    text-align: center;
    cursor: pointer;
    font-family: system-ui, -apple-system, sans-serif;
    flex-shrink: 0;
    margin-top: 77px;
    background: #54FF9A;
    color: #000000;
}

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

.upload-btn-submit:active:not(:disabled) {
    opacity: 0.8;
    transform: scale(0.98);
}

/* ============================================
   响应式适配
   ============================================ */
@media screen and (max-height: 600px) {
    .upload-modal-content {
        height: 90vh;
        max-height: 90vh;
    }
}

/* ============================================
   工具类 - 替代内联样式
   ============================================ */

/* 错误状态示例图样式 */
.upload-example-img-error {
    height: 19.32vw;
    max-height: 80px;
    width: auto;
    object-fit: contain;
    border-radius: 5px;
}

/* 错误预览框圆角 */
.upload-preview-wrapper-error {
    border-radius: 5px;
}

/* 错误遮罩层圆角 */
.upload-error-overlay-error {
    border-radius: 5px;
}

/* 错误文字细体 */
.upload-error-text-light {
    font-weight: 400;
}

/* 危险文字颜色 */
.upload-text-danger {
    color: #870000;
}

/* 底部提示文字 - 危险样式 */
.upload-foot-text-danger {
    font-weight: 400;
    color: #860000;
}

/* 隐藏状态 */
#upload-modal .hidden {
    display: none !important;
}
