/* 前台「用户反馈」悬浮按钮 + 弹窗
 * 只服务 views/common/feedback_widget.html，类名统一 tkfb- 前缀避免污染现有样式。
 * 不依赖 Bootstrap JS（部分前台页只引了 jQuery），弹窗行为由片段内的原生 JS 实现。
 */

/* ---------- 悬浮按钮 ---------- */
.tkfb {
    position: fixed;
    right: 24px;
    bottom: 96px;
    z-index: 1030;
}

.tkfb-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin: 0;
    padding: 12px 18px;
    border: 0;
    border-radius: 999px;
    background: linear-gradient(135deg, #dc2437 0%, #a80514 100%);
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    line-height: 1;
    letter-spacing: .02em;
    cursor: pointer;
    box-shadow: 0 10px 24px rgba(199, 6, 25, .32);
    transition: transform .18s ease, box-shadow .18s ease;
    -webkit-tap-highlight-color: transparent;
}

.tkfb-btn:hover {
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 14px 30px rgba(199, 6, 25, .4);
}

.tkfb-btn:active {
    transform: translateY(0);
}

.tkfb-btn i {
    font-size: 16px;
}

/* ---------- 遮罩 + 面板 ---------- */
.tkfb-mask {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 1040;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(15, 23, 42, .5);
    overflow-y: auto;
}

.tkfb-mask[hidden] {
    display: none;
}

.tkfb-panel {
    position: relative;
    width: 430px;
    max-width: 100%;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    padding: 24px 24px 18px;
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 24px 64px rgba(15, 23, 42, .24);
    text-align: left;
    animation: tkfb-pop .2s ease-out;
}

@keyframes tkfb-pop {
    from { opacity: 0; transform: translateY(12px) scale(.98); }
    to   { opacity: 1; transform: none; }
}

.tkfb-close {
    position: absolute;
    top: 10px;
    right: 12px;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 0;
    background: transparent;
    color: #9aa3b2;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    border-radius: 50%;
}

.tkfb-close:hover {
    color: #4b5563;
    background: #f3f4f6;
}

.tkfb-title {
    margin: 0 0 6px;
    color: #111827;
    font-size: 18px;
    font-weight: 700;
    line-height: 1.4;
}

.tkfb-sub {
    margin: 0 0 18px;
    color: #6b7280;
    font-size: 13px;
    line-height: 1.6;
}

.tkfb-field {
    margin-bottom: 14px;
}

.tkfb-label {
    display: block;
    margin-bottom: 6px;
    color: #374151;
    font-size: 13px;
    font-weight: 600;
}

.tkfb-label em {
    color: #dc2437;
    font-style: normal;
}

.tkfb-input,
.tkfb-textarea {
    display: block;
    width: 100%;
    box-sizing: border-box;
    padding: 10px 12px;
    border: 1px solid #d7dbe3;
    border-radius: 8px;
    background: #fff;
    color: #111827;
    font-size: 14px;
    line-height: 1.5;
    transition: border-color .15s ease, box-shadow .15s ease;
}

.tkfb-input:focus,
.tkfb-textarea:focus {
    outline: none;
    border-color: #dc2437;
    box-shadow: 0 0 0 3px rgba(220, 36, 55, .12);
}

.tkfb-textarea {
    resize: vertical;
    min-height: 108px;
}

.tkfb-count {
    margin-top: 4px;
    color: #9aa3b2;
    font-size: 12px;
    text-align: right;
}

/* 蜜罐字段：正常用户看不见，也不能被 tab 聚焦 */
.tkfb-hp {
    position: absolute;
    left: -9999px;
    top: auto;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

.tkfb-msg {
    display: none;
    margin: 4px 0 10px;
    padding: 8px 10px;
    border-radius: 6px;
    background: #fef2f2;
    color: #b91c1c;
    font-size: 13px;
    line-height: 1.5;
}

.tkfb-msg.is-show {
    display: block;
}

.tkfb-submit {
    display: block;
    width: 100%;
    padding: 11px 16px;
    border: 0;
    border-radius: 8px;
    background: linear-gradient(135deg, #dc2437 0%, #a80514 100%);
    color: #fff;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity .15s ease;
}

.tkfb-submit:hover {
    opacity: .92;
    color: #fff;
}

.tkfb-submit:disabled {
    opacity: .6;
    cursor: default;
}

.tkfb-note {
    margin: 10px 0 0;
    color: #9aa3b2;
    font-size: 12px;
    line-height: 1.6;
    text-align: center;
}

/* ---------- 提交成功态 ---------- */
.tkfb-done {
    padding: 14px 4px 6px;
    text-align: center;
}

.tkfb-done[hidden] {
    display: none;
}

.tkfb-done-icon {
    width: 52px;
    height: 52px;
    margin: 0 auto 12px;
    border-radius: 50%;
    background: #e8f7ee;
    color: #1a9c53;
    font-size: 26px;
    line-height: 52px;
}

.tkfb-done-title {
    margin: 0 0 6px;
    color: #111827;
    font-size: 16px;
    font-weight: 700;
}

.tkfb-done-text {
    margin: 0 0 16px;
    color: #6b7280;
    font-size: 13px;
    line-height: 1.6;
}

.tkfb-done-btn {
    padding: 9px 26px;
    border: 1px solid #d7dbe3;
    border-radius: 8px;
    background: #fff;
    color: #374151;
    font-size: 14px;
    cursor: pointer;
}

.tkfb-done-btn:hover {
    background: #f9fafb;
}

/* ---------- 移动端：底部弹出，按钮缩成圆形 ---------- */
@media (max-width: 575.98px) {
    .tkfb {
        right: 16px;
        bottom: calc(76px + env(safe-area-inset-bottom, 0px));
    }

    .tkfb-btn {
        width: 52px;
        height: 52px;
        padding: 0;
        border-radius: 50%;
    }

    .tkfb-btn span {
        display: none;
    }

    .tkfb-btn i {
        font-size: 20px;
    }

    .tkfb-mask {
        align-items: flex-end;
        padding: 0;
    }

    .tkfb-panel {
        width: 100%;
        max-height: 92vh;
        padding: 20px 18px calc(16px + env(safe-area-inset-bottom, 0px));
        border-radius: 16px 16px 0 0;
        animation: tkfb-slide .22s ease-out;
    }

    @keyframes tkfb-slide {
        from { transform: translateY(100%); }
        to   { transform: none; }
    }
}

/* 打印时隐藏，避免干扰试卷/文档打印 */
@media print {
    .tkfb,
    .tkfb-mask {
        display: none !important;
    }
}
