/**
 * AI报价组件样式 - 仿照Zoho表单设计
 * 基于Facebook风格的简洁设计
 */

/* ========== 悬浮按钮 ========== */
.quote-floating-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 999;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    color: #1c1e21;
    padding: 18px 22px;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.6);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    min-width: 180px;
}

.quote-floating-btn:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15), 0 4px 12px rgba(0, 0, 0, 0.1);
}

.quote-btn-content h3 {
    margin: 0 0 6px 0;
    font-size: 20px;
    font-weight: 700;
    background: linear-gradient(135deg, #ff7e5f 0%, #feb47b 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.quote-btn-content p {
    margin: 0 0 14px 0;
    font-size: 12px;
    line-height: 1.6;
    color: #606770;
}

.quote-open-btn {
    width: 100%;
    padding: 10px 20px;
    background: linear-gradient(135deg, #e85d40 0%, #f5a052 100%);
    border: none;
    color: white;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(232, 93, 64, 0.35);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
}

.quote-open-btn:hover {
    background: linear-gradient(135deg, #d94d30 0%, #e89042 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(232, 93, 64, 0.45);
}

/* ========== 弹窗遮罩 ========== */
.quote-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10000;
    display: none;
    align-items: flex-start;
    justify-content: center;
    padding: 20px;
    overflow-y: auto;
    background: rgba(0, 0, 0, 0.5);
}

.quote-modal.active {
    display: flex;
}

/* ========== 弹窗内容 ========== */
.quote-modal-content {
    position: relative;
    background: #ffffff;
    border-radius: 8px;
    max-width: 780px;
    width: 100%;
    padding: 30px 35px 40px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1), 0 8px 16px rgba(0, 0, 0, 0.1);
    animation: slideUp 0.3s ease-out;
    margin: auto;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.quote-close-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 36px;
    height: 36px;
    background: #f5f6f7;
    border: none;
    border-radius: 50%;
    font-size: 20px;
    color: #606770;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.quote-close-btn:hover {
    background: #e4e6ea;
    color: #1c1e21;
}

.quote-modal-title {
    margin: 0 0 8px 0;
    font-size: 1.8em;
    font-weight: 600;
    color: #1c1e21;
    text-align: center;
}

.quote-modal-subtitle {
    margin: 0 0 30px 0;
    font-size: 0.85em;
    color: #606770;
    text-align: center;
    line-height: 1.5;
}

/* ========== 表单样式 ========== */
.quote-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group label:first-child {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    font-size: 0.9em;
    color: #4b4f56;
}

.form-group label.required:first-child::after {
    content: '*';
    color: #fa383e;
    margin-left: 2px;
}

/* 文本域 */
.form-group textarea {
    width: 100%;
    min-height: 90px;
    padding: 9px 12px;
    border: 1px solid #ccd0d5;
    border-radius: 6px;
    font-size: 0.95em;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: #f5f6f7;
    resize: vertical;
    transition: all 0.2s ease-in-out;
    box-sizing: border-box;
}

.form-group textarea:focus {
    outline: none;
    border-color: #1877f2;
    background-color: #ffffff;
    box-shadow: 0 0 0 2px rgba(24, 119, 242, 0.2);
}

.char-count {
    font-size: 0.8em;
    color: #606770;
    text-align: right;
    margin-top: 3px;
}

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

.checkbox-group label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-size: 0.9em;
    color: #1c1e21;
    line-height: 20px;
}

.checkbox-group input[type="checkbox"] {
    -webkit-appearance: none;
    appearance: none;
    border-radius: 3px;
    border: 1.2px solid #ccd0d5;
    transition: all 0.2s ease;
    position: relative;
    width: 20px;
    height: 20px;
    margin: 0 8px 0 0;
    padding: 0;
    cursor: pointer;
    flex-shrink: 0;
    background: white;
}

.checkbox-group input[type="checkbox"]:checked {
    background-color: #1877f2;
    border-color: #1877f2;
}

.checkbox-group input[type="checkbox"]:checked::before {
    content: '';
    position: absolute;
    left: 6px;
    top: 2px;
    width: 6px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

/* "其他"选项 */
.other-option {
    flex-basis: 100%;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
}

.other-input {
    flex: 1;
    margin-left: 8px;
    padding: 6px 10px;
    border: 1px solid #ccd0d5;
    border-radius: 6px;
    font-size: 0.9em;
    background-color: #f5f6f7;
    transition: all 0.2s ease-in-out;
    min-width: 200px;
}

.other-input:focus {
    border-color: #1877f2;
    background-color: #ffffff;
    outline: none;
    box-shadow: 0 0 0 2px rgba(24, 119, 242, 0.2);
}

.other-input:disabled {
    background: #f5f6f7;
    cursor: not-allowed;
    opacity: 0.6;
}

/* 单选框组 */
.radio-group {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 15px;
}

.radio-group label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-size: 0.9em;
    color: #1c1e21;
    line-height: 20px;
}

.radio-group input[type="radio"] {
    margin-right: 8px;
    cursor: pointer;
    width: 18px;
    height: 18px;
    accent-color: #1877f2;
}

/* 文件上传区域 */
.file-upload-section {
    margin-top: 8px;
}

.file-upload-wrapper {
    position: relative;
    border: 2px dashed #ccd0d5;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    background-color: #f5f6f7;
    transition: all 0.3s ease;
    cursor: pointer;
}

.file-upload-wrapper:hover {
    border-color: #1877f2;
    background-color: #f0f2f5;
}

.file-upload-wrapper.drag-over {
    border-color: #1877f2;
    background-color: #e7f3ff;
}

.file-upload-input {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    opacity: 0;
    cursor: pointer;
}

.file-upload-icon {
    font-size: 32px;
    margin-bottom: 8px;
}

.file-upload-text {
    font-size: 14px;
    color: #606770;
    margin-bottom: 4px;
}

.file-upload-hint {
    font-size: 12px;
    color: #8a8d91;
}

/* 已上传文件列表 */
.uploaded-files-list {
    margin-top: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.uploaded-file-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: white;
    border: 1px solid #e4e6eb;
    border-radius: 6px;
    font-size: 13px;
}

.file-icon {
    font-size: 20px;
    flex-shrink: 0;
}

.file-info {
    flex: 1;
    overflow: hidden;
}

.file-name {
    color: #1c1e21;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-size {
    color: #606770;
    font-size: 11px;
    margin-top: 2px;
}

.file-remove-btn {
    background: #f5f6f7;
    border: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    cursor: pointer;
    color: #606770;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.file-remove-btn:hover {
    background: #e4e6ea;
    color: #1c1e21;
}

.file-upload-progress {
    margin-top: 4px;
    height: 3px;
    background: #e4e6eb;
    border-radius: 2px;
    overflow: hidden;
}

.file-upload-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #1877f2 0%, #42b883 100%);
    transition: width 0.3s ease;
}

/* 联系方式 */
.contact-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.contact-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.contact-item input[type="checkbox"] {
    -webkit-appearance: none;
    appearance: none;
    border-radius: 3px;
    border: 1.2px solid #ccd0d5;
    transition: all 0.2s ease;
    position: relative;
    width: 20px;
    height: 20px;
    margin: 0;
    padding: 0;
    cursor: pointer;
    flex-shrink: 0;
    background: white;
}

.contact-item input[type="checkbox"]:checked {
    background-color: #1877f2;
    border-color: #1877f2;
}

.contact-item input[type="checkbox"]:checked::before {
    content: '';
    position: absolute;
    left: 6px;
    top: 2px;
    width: 6px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.contact-item > span {
    font-size: 0.9em;
    color: #1c1e21;
    white-space: nowrap;
}

.contact-input {
    flex: 1;
    max-width: 350px;
    padding: 9px 12px;
    border: 1px solid #ccd0d5;
    border-radius: 6px;
    font-size: 0.95em;
    background-color: #f5f6f7;
    transition: all 0.2s ease-in-out;
}

.contact-input:focus {
    outline: none;
    border-color: #1877f2;
    background-color: #ffffff;
    box-shadow: 0 0 0 2px rgba(24, 119, 242, 0.2);
}

/* 提交按钮 */
.quote-submit-btn {
    margin-top: 15px;
    padding: 10px 24px;
    background-color: #1877f2;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 1.05em;
    font-weight: 600;
    cursor: pointer;
    display: block;
    width: auto;
    margin-left: auto;
    margin-right: auto;
    transition: background-color 0.2s ease-in-out;
}

.quote-submit-btn:hover:not(:disabled) {
    background-color: #166fe5;
}

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

.btn-loading {
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* 结果显示 */
.quote-result {
    margin-top: 20px;
    padding: 20px;
    background: #e8f4fd;
    border: 1px solid #bee5eb;
    border-radius: 6px;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.quote-result.success {
    background: #d4edda;
    border-color: #c3e6cb;
}

.quote-result.error {
    background: #f8d7da;
    border-color: #f5c6cb;
}

.quote-result h3 {
    margin: 0 0 12px 0;
    font-size: 16px;
    font-weight: 600;
    color: #1c1e21;
}

.success-icon,
.error-icon {
    width: 50px;
    height: 50px;
    margin: 0 auto 12px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    font-weight: bold;
}

.success-icon {
    background: #42b883;
    color: white;
}

.error-icon {
    background: #fa383e;
    color: white;
}

.success-message,
.error-message {
    font-size: 15px;
    font-weight: 600;
    text-align: center;
    margin-bottom: 15px;
    color: #1c1e21;
}

.estimate-box {
    background: white;
    padding: 18px;
    border-radius: 6px;
    margin: 15px 0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.estimate-box h4 {
    margin: 0 0 10px 0;
    font-size: 0.8em;
    color: #606770;
    text-transform: uppercase;
    font-weight: 600;
}

.estimate-price {
    font-size: 28px;
    font-weight: bold;
    color: #1877f2;
    margin: 0 0 8px 0;
}

.estimate-note {
    font-size: 0.85em;
    color: #606770;
    margin: 0;
}

.contact-info {
    text-align: center;
    font-size: 0.85em;
    color: #606770;
    margin-top: 12px;
}

.error-detail {
    text-align: center;
    font-size: 0.8em;
    color: #606770;
    margin-top: 8px;
}

/* ========== 响应式设计 ========== */
@media (max-width: 768px) {
    .quote-floating-btn {
        bottom: 20px;
        right: 15px;
        min-width: 140px;
        padding: 14px 18px;
        border-radius: 14px;
    }

    .quote-btn-content h3 {
        font-size: 18px;
    }

    .quote-btn-content p {
        font-size: 11px;
        margin-bottom: 12px;
    }

    .quote-open-btn {
        padding: 9px 16px;
        font-size: 13px;
    }

    .quote-modal {
        padding: 8px;
    }

    .quote-modal-content {
        padding: 20px 18px 28px;
        box-shadow: none;
        border-radius: 0;
        min-height: 100vh;
        box-sizing: border-box;
    }

    .quote-modal-title {
        font-size: 1.5em;
        margin-bottom: 6px;
    }

    .quote-modal-subtitle {
        font-size: 0.9em;
        margin-bottom: 24px;
    }

    .form-group textarea,
    .contact-input,
    .other-input {
        padding: 12px 14px;
        font-size: 16px; /* 防止iOS缩放 */
        min-height: 44px;
    }

    .form-group textarea {
        min-height: 100px;
    }

    .checkbox-group,
    .radio-group {
        gap: 12px 10px;
    }

    .checkbox-group input[type="checkbox"],
    .contact-item input[type="checkbox"] {
        width: 22px;
        height: 22px;
    }

    .radio-group input[type="radio"] {
        width: 20px;
        height: 20px;
    }

    .contact-item {
        flex-wrap: wrap;
    }

    .contact-item > span {
        flex-basis: 100%;
        margin-left: 28px;
    }

    .contact-input {
        flex-basis: 100%;
        max-width: 100%;
        margin-left: 28px;
    }

    .quote-submit-btn {
        padding: 14px 24px;
        font-size: 1.1em;
        width: 100%;
        margin: 20px 0 0;
    }
}

/* 超小屏幕 */
@media (max-width: 480px) {
    .quote-modal-content {
        padding: 16px 14px 24px;
    }

    .quote-modal-title {
        font-size: 1.3em;
    }

    .quote-modal-subtitle {
        font-size: 0.85em;
    }

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

/* 滚动条美化 */
.quote-modal-content::-webkit-scrollbar {
    width: 8px;
}

.quote-modal-content::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.quote-modal-content::-webkit-scrollbar-thumb {
    background: #ccd0d5;
    border-radius: 10px;
}

.quote-modal-content::-webkit-scrollbar-thumb:hover {
    background: #b0b3b8;
}
