/* Bootstrap风格的反馈框 */

#fpi_feedback {
    z-index: 999999;
    position: fixed;
    width: 46px;
    height: 46px;
    bottom: 20px;
    right: 20px;
    font-size: 16px;
}

#fpi_title {
    position: absolute;
    left: 0;
    top: 0;
    width: 46px;
    height: 46px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
    cursor: grab;
    border-radius: 50%;
    box-shadow: 0 2px 12px rgba(220, 53, 69, 0.4);
    transition: background 0.3s ease, box-shadow 0.3s ease, transform 0.3s ease;
    user-select: none;
}

#fpi_title:hover {
    background: linear-gradient(135deg, #c82333 0%, #bd2130 100%);
    box-shadow: 0 4px 16px rgba(220, 53, 69, 0.6);
    transform: scale(1.1);
}

#fpi_title:active {
    cursor: grabbing;
}

#fpi_title i {
    font-size: 22px;
    color: white;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.2));
}

#fpi_title h2 {
    display: none;
}

#fpi_content {
    position: fixed;
    right: 76px;
    bottom: 20px;
    width: 0;
    height: 0;
    padding: 0;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    opacity: 0;
    transition: all 0.3s ease;
    pointer-events: none;
}

#fpi_content.open {
    width: 320px;
    height: 420px;
    padding: 20px;
    opacity: 1;
    pointer-events: auto;
}

/* 关闭按钮 */
.fpi-close-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: 50%;
    color: #6c757d;
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 10;
}

.fpi-close-btn:hover {
    background: rgba(0, 0, 0, 0.05);
    color: #dc3545;
    transform: rotate(90deg);
}

.fpi-close-btn i {
    font-size: 14px;
}

[data-bs-theme="dark"] .fpi-close-btn,
[data-bs-theme="dark-small"] .fpi-close-btn {
    color: #adb5bd;
}

[data-bs-theme="dark"] .fpi-close-btn:hover,
[data-bs-theme="dark-small"] .fpi-close-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #ea868f;
}

/* 暗黑主题支持 */
[data-bs-theme="dark"] #fpi_content,
[data-bs-theme="dark-small"] #fpi_content {
    background: #212529;
    color: #dee2e6;
    border: 1px solid #495057;
}

[data-bs-theme="dark"] #fpi_title,
[data-bs-theme="dark-small"] #fpi_title {
    background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
    box-shadow: 0 2px 12px rgba(220, 53, 69, 0.5);
}

[data-bs-theme="dark"] #fpi_title:hover,
[data-bs-theme="dark-small"] #fpi_title:hover {
    background: linear-gradient(135deg, #c82333 0%, #bd2130 100%);
    box-shadow: 0 4px 16px rgba(220, 53, 69, 0.7);
}

[data-bs-theme="dark"] #fpi_content #fpi_submit_message textarea,
[data-bs-theme="dark-small"] #fpi_content #fpi_submit_message textarea {
    background-color: #343a40;
    color: #dee2e6;
    border-color: #495057;
}

[data-bs-theme="dark"] #fpi_content #fpi_submit_message textarea:focus,
[data-bs-theme="dark-small"] #fpi_content #fpi_submit_message textarea:focus {
    background-color: #343a40;
    color: #dee2e6;
    border-color: #0d6efd;
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

#fpi_content #fpi_header_message {
    display: none;
}

#fpi_content form {
    margin: 0;
    height: 100%;
    display: flex;
    flex-direction: column;
    padding-top: 10px;
}

#fpi_content #fpi_submit_message {
    flex: 1;
    display: flex;
    flex-direction: column;
}

#fpi_content #fpi_submit_message textarea {
    flex: 1;
    width: 100%;
    padding: 12px;
    font-size: 14px;
    line-height: 1.5;
    color: #212529;
    background-color: #fff;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    resize: none;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

#fpi_content #fpi_submit_message textarea:focus {
    color: #212529;
    background-color: #fff;
    border-color: #86b7fe;
    outline: 0;
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

#fpi_content #fpi_submit_message textarea::placeholder {
    color: #6c757d;
    opacity: 1;
}

#fpi_content #fpi_submit_message .error {
    border-color: #dc3545;
    box-shadow: 0 0 0 0.25rem rgba(220, 53, 69, 0.25);
}

#fpi_submit_loading {
    display: none;
    margin: 10px 0;
    text-align: center;
    color: #0d6efd;
    font-size: 14px;
}

#fpi_submit_loading.show {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

#fpi_submit_loading.show::before {
    content: '';
    width: 16px;
    height: 16px;
    border: 2px solid #0d6efd;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spinner 0.8s linear infinite;
}

#fpi_submit_loading.show::after {
    content: '提交中...';
}

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

[data-bs-theme="dark"] #fpi_submit_loading,
[data-bs-theme="dark-small"] #fpi_submit_loading {
    color: #6ea8fe;
}

[data-bs-theme="dark"] #fpi_submit_loading.show::before,
[data-bs-theme="dark-small"] #fpi_submit_loading.show::before {
    border-color: #6ea8fe;
    border-top-color: transparent;
}

#fpi_content #fpi_submit_submit {
    margin-top: 12px;
    text-align: center;
}

#fpi_content #fpi_submit_submit input {
    width: 100%;
    padding: 10px 16px;
    font-size: 16px;
    font-weight: 500;
    line-height: 1.5;
    color: #fff;
    background-color: #0d6efd;
    border: 1px solid #0d6efd;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s ease-in-out;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

#fpi_content #fpi_submit_submit input:hover {
    background-color: #0b5ed7;
    border-color: #0a58ca;
}

#fpi_content #fpi_submit_submit input:active {
    background-color: #0a58ca;
    border-color: #0a53be;
    transform: scale(0.98);
}

#fpi_content #fpi_submit_submit input:disabled {
    background-color: #6c757d;
    border-color: #6c757d;
    opacity: 0.65;
    cursor: not-allowed;
}

#fpi_content #fpi_ajax_message {
    display: none;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80%;
    text-align: center;
    z-index: 10;
}

#fpi_content #fpi_ajax_message.show {
    display: block;
}

#fpi_content #fpi_ajax_message h2 {
    font-size: 16px;
    font-weight: 500;
    color: #198754;
    margin: 0;
    padding: 15px 20px;
    background: rgba(25, 135, 84, 0.1);
    border-radius: 8px;
    border: 1px solid rgba(25, 135, 84, 0.3);
}

#fpi_content #fpi_ajax_message h2.success::before {
    content: '✓ ';
    font-size: 20px;
    margin-right: 8px;
}

#fpi_content #fpi_ajax_message h2.error {
    color: #dc3545;
    background: rgba(220, 53, 69, 0.1);
    border-color: rgba(220, 53, 69, 0.3);
}

#fpi_content #fpi_ajax_message h2.error::before {
    content: '✕ ';
    font-size: 20px;
    margin-right: 8px;
}

[data-bs-theme="dark"] #fpi_content #fpi_ajax_message h2.success,
[data-bs-theme="dark-small"] #fpi_content #fpi_ajax_message h2.success {
    color: #75b798;
    background: rgba(25, 135, 84, 0.2);
    border-color: rgba(25, 135, 84, 0.4);
}

[data-bs-theme="dark"] #fpi_content #fpi_ajax_message h2.error,
[data-bs-theme="dark-small"] #fpi_content #fpi_ajax_message h2.error {
    color: #ea868f;
    background: rgba(220, 53, 69, 0.2);
    border-color: rgba(220, 53, 69, 0.4);
}

/* 移动端优化 */
@media (max-width: 768px) {
    #fpi_feedback {
        bottom: 15px;
        right: 15px;
        width: 42px;
        height: 42px;
    }

    #fpi_title {
        width: 42px;
        height: 42px;
    }

    #fpi_title i {
        font-size: 18px;
    }

    #fpi_content {
        right: 57px;
        bottom: 15px;
    }

    #fpi_content.open {
        width: 280px;
        height: 380px;
        padding: 15px;
    }

    .fpi-close-btn {
        width: 26px;
        height: 26px;
    }

    .fpi-close-btn i {
        font-size: 12px;
    }
}