/* ============================================================ */
/* 反饋彈窗 — TY 主題                                              */
/* ============================================================ */

/* 遮罩 */
.ty-feedback-mask {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 10000;
    background: rgba(0,0,0,0.5);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

/* 彈窗主體 */
.ty-feedback-box {
    position: relative;
    width: 92%;
    max-width: 520px;
    max-height: 90vh;
    margin: 5vh auto;
    background: #fff;
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0,0,0,0.25);
    display: flex;
    flex-direction: column;
    animation: tyFbSlideIn 0.28s ease;
}

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

/* 標題 */
.ty-feedback-title {
    margin: 0;
    padding: 18px 0;
    font-size: 17px;
    font-weight: 700;
    text-align: center;
    color: #222;
    border-bottom: 1px solid rgba(0,0,0,0.06);
    flex-shrink: 0;
}

/* 關閉按鈕 */
.ty-feedback-close {
    position: absolute;
    top: 14px; right: 14px;
    width: 30px; height: 30px;
    cursor: pointer;
    z-index: 10;
    border-radius: 50%;
    transition: background 0.2s;
}

.ty-feedback-close:active {
    background: rgba(0,0,0,0.06);
}

.ty-feedback-close::before,
.ty-feedback-close::after {
    content: '';
    position: absolute;
    top: 50%; left: 50%;
    width: 16px; height: 2px;
    background: #999;
}

.ty-feedback-close::before { transform: translate(-50%,-50%) rotate(45deg); }
.ty-feedback-close::after  { transform: translate(-50%,-50%) rotate(-45deg); }

/* ===== 反饋歷史 ===== */
.ty-feedback-history {
    border-bottom: 1px solid rgba(0,0,0,0.06);
    max-height: 260px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
}

.ty-feedback-history-title {
    margin: 0;
    padding: 14px 16px 10px;
    font-size: 14px;
    font-weight: 600;
    color: #333;
    flex-shrink: 0;
}

.ty-feedback-history-list {
    padding: 0 16px 14px;
    overflow-y: auto;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ty-feedback-loading {
    text-align: center;
    padding: 20px;
    color: #999;
    font-size: 13px;
}

/* 歷史條目 */
.historyItem {
    padding: 10px 12px;
    background: #f8f9fa;
    border: 1px solid #eee;
    border-radius: 8px;
}

.historyHeader {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.historyType {
    font-size: 13px;
    font-weight: 500;
    color: var(--sn-primary, #E88CA5);
}

.historyStatus {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 500;
}

.status-unread { background: #fff3cd; color: #856404; }
.status-read   { background: #d1ecf1; color: #0c5460; }

.historyContent {
    font-size: 13px;
    color: #555;
    line-height: 1.5;
}

.historyReply {
    margin-top: 8px;
    padding: 8px 10px;
    background: #f0f8ff;
    border-left: 3px solid var(--sn-primary, #E88CA5);
    border-radius: 4px;
}

.historyReply strong {
    font-size: 12px;
    color: var(--sn-primary, #E88CA5);
    display: block;
    margin-bottom: 4px;
}

.historyReply p {
    font-size: 12px;
    color: #666;
    line-height: 1.5;
    margin: 0;
}

/* 歷史圖片 */
.feedbackImageList {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-top: 6px;
}

.feedbackImageItem img {
    width: 56px;
    height: 56px;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid #eee;
    cursor: pointer;
}

/* 分頁 */
.ty-feedback-pagination {
    padding: 8px 16px;
    text-align: center;
    flex-shrink: 0;
}

.ty-feedback-pagination ul {
    list-style: none;
    display: flex;
    justify-content: center;
    gap: 4px;
    padding: 0;
    margin: 0;
}

.ty-feedback-pagination li a,
.ty-feedback-pagination li span {
    display: inline-block;
    padding: 4px 10px;
    font-size: 12px;
    border-radius: 4px;
    color: #666;
}

.ty-feedback-pagination li a {
    cursor: pointer;
}

.ty-feedback-pagination li a:active {
    background: rgba(0,0,0,0.06);
}

.ty-feedback-pagination li.current span {
    background: var(--sn-primary, #E88CA5);
    color: #fff;
}

/* ===== 反饋表單 ===== */
.ty-feedback-form {
    padding: 14px 16px 20px;
    overflow-y: auto;
    flex: 1;
}

.ty-feedback-form-title {
    margin: 0 0 12px;
    font-size: 14px;
    font-weight: 600;
    color: #333;
}

.ty-feedback-field {
    margin-bottom: 16px;
}

.ty-feedback-label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: #333;
    margin-bottom: 6px;
}

.ty-feedback-textarea {
    width: 100%;
    min-height: 80px;
    padding: 10px 12px;
    font-size: 14px;
    line-height: 1.5;
    border: 1px solid #ddd;
    border-radius: 8px;
    resize: vertical;
    box-sizing: border-box;
    font-family: inherit;
    transition: border-color 0.2s;
}

.ty-feedback-textarea:focus {
    outline: none;
    border-color: var(--sn-primary, #E88CA5);
}

/* 圖片上傳 */
.ty-feedback-img-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.ty-feedback-img-add {
    width: 72px;
    height: 72px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    border: 1px dashed #ccc;
    border-radius: 8px;
    color: #999;
    font-size: 11px;
    cursor: pointer;
    transition: border-color 0.2s;
}

.ty-feedback-img-add:active {
    border-color: var(--sn-primary, #E88CA5);
    color: var(--sn-primary, #E88CA5);
}

/* 已上傳圖片預覽 */
.imagePreviewItem {
    position: relative;
    width: 72px;
    height: 72px;
}

.imagePreviewItem img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid #eee;
}

.imagePreviewItem .removeBtn {
    position: absolute;
    top: -6px; right: -6px;
    width: 18px; height: 18px;
    background: rgba(0,0,0,0.5);
    color: #fff;
    border-radius: 50%;
    font-size: 12px;
    line-height: 18px;
    text-align: center;
    cursor: pointer;
}

/* 問題類型 */
.ty-feedback-types {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.ty-feedback-type-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border: 1px solid #e8e8e8;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    color: #333;
    transition: border-color 0.15s;
}

.ty-feedback-type-item:active {
    border-color: var(--sn-primary, #E88CA5);
}

.ty-feedback-type-item input[type="radio"] {
    width: 16px; height: 16px;
    margin: 0;
    accent-color: var(--sn-primary, #E88CA5);
    cursor: pointer;
}

.ty-feedback-type-item input[type="radio"]:checked + span {
    font-weight: 500;
    color: var(--sn-primary, #E88CA5);
}

/* 提交按鈕 */
.ty-feedback-submit {
    display: block;
    width: 100%;
    height: 44px;
    margin: 0 0 12px;
    font-size: 15px;
    font-weight: 600;
    color: #fff;
    background: var(--sn-primary, #E88CA5);
    border: none;
    border-radius: 22px;
    cursor: pointer;
    transition: background 0.15s;
    -webkit-appearance: none;
    appearance: none;
}

.ty-feedback-submit:active {
    background: #d16f8a;
}

/* 提示 */
.ty-feedback-tips {
    text-align: center;
}

.ty-feedback-tips p {
    font-size: 12px;
    color: #999;
    margin: 0;
    line-height: 1.6;
}

/* ===== 圖片預覽彈出層 ===== */
.ty-imgpreview-mask {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 10010;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ty-imgpreview-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.8);
}

.ty-imgpreview-container {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    z-index: 1;
}

.ty-imgpreview-close {
    position: absolute;
    top: -12px; right: -12px;
    width: 28px; height: 28px;
    background: rgba(0,0,0,0.6);
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    cursor: pointer;
    z-index: 2;
}

.ty-imgpreview-img {
    display: block;
    max-width: 90vw;
    max-height: 85vh;
    border-radius: 4px;
}

/* 滾動條 */
.ty-feedback-history-list::-webkit-scrollbar,
.ty-feedback-form::-webkit-scrollbar {
    width: 4px;
}

.ty-feedback-history-list::-webkit-scrollbar-thumb,
.ty-feedback-form::-webkit-scrollbar-thumb {
    background: #ddd;
    border-radius: 2px;
}
