/*
Theme Name: GeneratePress Child
Template: generatepress
*/

/* ============================================
   悬浮按钮 + 回到顶部按钮 — 移动端防重叠
   ============================================ */

/* ---------- 桌面端 ---------- */
.vistar-float-wrap {
    position: fixed;
    bottom: 80px;
    right: 30px;
    left: auto !important; /* 🔥 关键修复：强制清除 left，保证在右下角 */
    z-index: 1000;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 12px;
    width: auto;
    min-width: 180px;
}

.vistar-float-modal {
    position: absolute;
    bottom: 100%;
    right: 0;
    margin-bottom: 12px;
    width: 380px;
    max-width: calc(100vw - 60px);
    height: auto;
    min-height: 300px;
    max-height: calc(100vh - 200px);
    overflow: hidden;
    background: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.12);
    opacity: 0;
    visibility: hidden;
    transform: none;
    transition: opacity 0.3s ease, visibility 0s linear 0.3s;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    z-index: 10000;
}

.vistar-float-modal.show {
    opacity: 1;
    visibility: visible;
    transition: opacity 0.3s ease, visibility 0s linear 0s;
    pointer-events: auto;
}

.vistar-float-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #0052cc;
    color: #fff;
    padding: 12px 20px;
    border-radius: 50px;
    border: none;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(0,82,204,0.35);
    transition: all 0.2s ease;
    white-space: nowrap;
}

.vistar-float-btn:hover {
    background: #b22b2b;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(178,43,43,0.3);
}

.vistar-float-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px 10px;
    border-bottom: 2px solid #0052cc;
    flex-shrink: 0;
}

.vistar-float-header span {
    font-size: 15px;
    font-weight: 700;
    color: #1e1e1e;
}

.vistar-modal-close {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    color: #666;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s;
}

.vistar-modal-close:hover {
    background: #f0f0f0;
    color: #b22b2b;
}

.vistar-float-body {
    padding: 16px 20px 20px;
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    min-height: 0;
}

.vistar-float-body .wpcf7-form {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.vistar-float-body label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: #333;
    margin-bottom: 2px;
}

.vistar-float-body input,
.vistar-float-body select,
.vistar-float-body textarea {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 13px;
    background: #fff;
    color: #000;
    box-sizing: border-box;
    margin-bottom: 6px;
}

.vistar-float-body input[type="submit"] {
    width: 100%;
    background: #0052cc;
    color: #fff;
    font-weight: bold;
    padding: 10px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    margin-top: 4px;
    margin-bottom: 0 !important;
    transition: background 0.2s;
}

.vistar-float-body .wpcf7-response-output {
    margin: 0 !important;
    padding: 6px 10px;
    border-radius: 4px;
    font-size: 12px;
    line-height: 1.4;
    text-align: center;
    border: none !important;
}

.vistar-float-body .wpcf7-mail-sent-ok {
    background: #e8f5e9;
    color: #1a7a3c;
}

.vistar-float-body .wpcf7-validation-errors {
    background: #ffebee;
    color: #b22b2b;
}

.vistar-float-body input[type="submit"]:hover {
    background: #b22b2b;
}

.vistar-float-body br {
    display: none !important;
}

.vistar-float-body p,
.vistar-float-body br {
    margin: 0 !important;
    padding: 0 !important;
}

/* ---------- 回到顶部按钮 ---------- */
button#vistarBackToTop.vistar-back-to-top {
    position: fixed !important;
    bottom: 24px !important;
    right: 24px !important;
    left: auto !important; /* 🔥 同步修复 */
    z-index: 999 !important;
    width: 48px !important;
    height: 48px !important;
    border-radius: 50% !important;
    background: #1a5fc8 !important;
    color: #fff !important;
    border: none !important;
    cursor: pointer !important;
    display: none;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(26, 95, 200, 0.3);
    margin: 0 !important;
    padding: 0 !important;
}

button#vistarBackToTop.vistar-back-to-top.vistar-show {
    opacity: 1 !important;
    transform: translateY(0) !important;
}

button#vistarBackToTop.vistar-back-to-top:hover {
    background: #0d4aa9 !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 6px 20px rgba(26, 95, 200, 0.4) !important;
}

/* ============================================
   移动端适配
   ============================================ */
@media (max-width: 480px) {
    .vistar-float-wrap {
        bottom: 80px;
        right: 16px;
        left: auto !important; /* 🔥 移动端也强制清除 */
        top: auto;
        z-index: 1000;
    }

    .vistar-float-btn {
        padding: 12px;
        border-radius: 50%;
        width: 48px;
        height: 48px;
        justify-content: center;
    }

    .vistar-float-btn span {
        display: none;
    }

    .vistar-float-modal {
        position: fixed;
        bottom: 136px;
        right: 16px;
        left: auto;
        width: calc(100vw - 32px);
        max-width: 360px;
        height: 580px;
        max-height: 65vh;
        transform-origin: bottom right;
    }

    .vistar-float-modal.show {
        max-height: 75vh;
    }

    button#vistarBackToTop.vistar-back-to-top {
        bottom: 16px !important;
        right: 16px !important;
        left: auto !important;
        width: 48px !important;
        height: 48px !important;
        z-index: 999 !important;
    }
}

/* ============================================
   弹窗内容区滚动 + textarea 加高
   ============================================ */
.vistar-float-body {
    overflow-y: auto !important;
    padding: 16px 20px 20px !important;
    flex: 1;
    min-height: 0;
}

.vistar-float-body textarea,
.vistar-float-body .wpcf7-form textarea {
    min-height: 60px !important;
    max-height: 100px;
    resize: vertical;
    line-height: 1.4;
    padding: 5px 7px;
    font-size: 14px;
}

.vistar-float-body input[type="text"],
.vistar-float-body input[type="email"],
.vistar-float-body input[type="tel"],
.vistar-float-body select {
    min-height: 40px;
    padding: 8px 12px;
    font-size: 14px;
    line-height: 1.5;
}

.vistar-float-body .wpcf7-form p {
    margin: 0 !important;
    padding: 0 !important;
}

.vistar-float-body .wpcf7-form p:has(input[type="submit"]) {
    margin-bottom: 0 !important;
}

.vistar-float-body .wpcf7-form p:has(.wpcf7-response-output) {
    margin-top: 0 !important;
}