/*!
 * 卡瓦里催更插件 - 前台样式
 * @Author: Kawakil
 */

.knag-icon {
    width: 24px;
    height: 24px;
    display: inline-block;
    vertical-align: middle;
}

/* 文章页按钮：与子比主题 .action 按钮同排同风格 */
.action-kawakil-nag {
    display: inline-block;
    width: 80px;
    padding: 10px 0;
    text-align: center;
    opacity: .7;
    vertical-align: top;
    text-decoration: none;
    cursor: pointer;
    transition: opacity .2s ease, color .2s ease;
    position: relative;
}

.action-kawakil-nag:hover {
    opacity: 1;
    text-decoration: none;
}

.action-kawakil-nag .knag-icon {
    display: block;
    margin: 5px auto;
    width: 24px;
    height: 24px;
}

.action-kawakil-nag text {
    font-size: 14px;
    display: inline-block;
    line-height: 1.2;
}

.action-kawakil-nag .knag-count {
    font-size: .9em;
    opacity: .7;
    margin-left: 2px;
    font-style: normal;
}

.action-kawakil-nag.is-actived {
    color: var(--focus-color, #f04494);
    opacity: .95;
}

/* 弹窗 */
.knag-modal {
    position: fixed;
    inset: 0;
    z-index: 100050;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    -webkit-overflow-scrolling: touch;
}

.knag-modal.is-open {
    display: flex;
}

.knag-mask {
    position: absolute;
    inset: 0;
    background: rgba(12, 14, 20, .55);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
    opacity: 0;
    transition: opacity .25s ease;
}

.knag-modal.is-open .knag-mask {
    opacity: 1;
}

.knag-dialog {
    position: relative;
    width: 440px;
    max-width: 100%;
    max-height: 88vh;
    display: flex;
    flex-direction: column;
    background: #fff;
    border-radius: 18px;
    box-shadow: 0 24px 70px rgba(0, 0, 0, .28);
    overflow: hidden;
    transform: translateY(16px) scale(.97);
    opacity: 0;
    transition: transform .3s cubic-bezier(.2, .9, .3, 1.2), opacity .25s ease;
}

.knag-modal.is-open .knag-dialog {
    transform: none;
    opacity: 1;
}

.knag-head {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 18px 20px;
    background: linear-gradient(135deg, var(--focus-color, #f04494) 0%, #ff7a9c 55%, #ffa06b 100%);
    color: #fff;
    position: relative;
}

.knag-head::after {
    content: "";
    position: absolute;
    right: -40px;
    top: -60px;
    width: 160px;
    height: 160px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .13);
}

.knag-head-icon {
    position: relative;
    z-index: 1;
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: rgba(255, 255, 255, .2);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.knag-head-icon .knag-icon {
    width: 22px;
    height: 22px;
    color: #fff;
}

.knag-head-text {
    position: relative;
    z-index: 1;
    flex: 1;
    min-width: 0;
}

.knag-head-text h3 {
    margin: 0;
    font-size: 17px;
    font-weight: 600;
    color: #fff;
    line-height: 1.4;
}

.knag-head-text p {
    margin: 2px 0 0;
    font-size: 12px;
    opacity: .88;
    color: #fff;
}

.knag-close {
    position: relative;
    z-index: 2;
    width: 30px;
    height: 30px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, .18);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
    transition: background .2s;
}

.knag-close:hover {
    background: rgba(255, 255, 255, .32);
}

.knag-tabs {
    display: flex;
    gap: 8px;
    padding: 14px 20px 0;
    background: #fff;
}

.knag-tab {
    border: none;
    background: rgba(136, 136, 136, .1);
    color: #666;
    font-size: 13px;
    padding: 8px 16px;
    border-radius: 30px;
    cursor: pointer;
    transition: .2s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.knag-tab.is-active {
    background: var(--focus-color, #f04494);
    color: #fff;
    box-shadow: 0 6px 16px -8px var(--focus-color, #f04494);
}

.knag-tab .knag-tab-count {
    font-size: 12px;
    background: rgba(255, 255, 255, .25);
    border-radius: 20px;
    padding: 0 6px;
    line-height: 1.6;
    min-width: 18px;
    text-align: center;
}

.knag-tab:not(.is-active) .knag-tab-count {
    background: rgba(136, 136, 136, .14);
    color: #888;
}

.knag-body {
    padding: 16px 20px 20px;
    overflow-y: auto;
    flex: 1;
    background: #fff;
}

.knag-pane {
    display: none;
}

.knag-pane.is-active {
    display: block;
    animation: knag-fade .25s ease;
}

@keyframes knag-fade {
    from {
        opacity: 0;
        transform: translateY(4px);
    }
    to {
        opacity: 1;
        transform: none;
    }
}

.knag-quota {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: #888;
    background: rgba(136, 136, 136, .07);
    border-radius: 10px;
    padding: 9px 12px;
    margin-bottom: 12px;
}

.knag-quota .knag-dot {
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: #c5c5c5;
}

.knag-field {
    position: relative;
}

.knag-textarea {
    width: 100%;
    min-height: 110px;
    resize: vertical;
    border: 1px solid rgba(0, 0, 0, .1);
    background: #f7f8fa;
    border-radius: 12px;
    padding: 12px 14px;
    font-size: 14px;
    line-height: 1.6;
    color: #333;
    outline: none;
    box-sizing: border-box;
    transition: border-color .2s, background .2s, box-shadow .2s;
}

.knag-textarea:focus {
    border-color: var(--focus-color, #f04494);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(240, 68, 148, .1);
}

.knag-textarea::placeholder {
    color: #aaa;
}

.knag-field-foot {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 6px;
    font-size: 12px;
    color: #999;
}

.knag-required-hint {
    color: var(--focus-color, #f04494);
    background: rgba(240, 68, 148, .08);
    border-radius: 4px;
    padding: 1px 6px;
}

.knag-message {
    min-height: 18px;
    font-size: 12px;
    margin: 8px 0 0;
    color: var(--focus-color, #f04494);
    line-height: 1.6;
}

.knag-message.is-success {
    color: #12b928;
}

.knag-submit {
    width: 100%;
    margin-top: 10px;
    border: none;
    border-radius: 12px;
    padding: 12px 18px;
    font-size: 15px;
    font-weight: 500;
    color: #fff;
    cursor: pointer;
    background: linear-gradient(135deg, var(--focus-color, #f04494), #ff8a6b);
    box-shadow: 0 10px 22px -12px var(--focus-color, #f04494);
    transition: opacity .2s, transform .15s;
}

.knag-submit:hover {
    opacity: .92;
}

.knag-submit:active {
    transform: translateY(1px);
}

.knag-submit[disabled] {
    opacity: .6;
    cursor: not-allowed;
}

/* 更新通知 */
.knag-update-notice {
    margin: 0 0 12px;
    padding: 12px 14px;
    border-radius: 12px;
    background: rgba(240, 68, 148, .07);
    border: 1px solid rgba(240, 68, 148, .18);
}

.knag-update-notice-head {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 12px;
}

.knag-update-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--focus-color, #f04494);
    flex-shrink: 0;
}

.knag-update-notice-head b {
    color: #d6337f;
    font-size: 12.5px;
}

.knag-update-time {
    margin-left: auto;
    font-size: 11px;
    color: #b07a95;
}

.knag-update-content {
    margin-top: 6px;
    font-size: 13px;
    line-height: 1.7;
    color: #4b4450;
    word-break: break-word;
}

/* 列表 */
.knag-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 60px;
}

.knag-list-loading,
.knag-empty {
    text-align: center;
    color: #999;
    font-size: 13px;
    padding: 26px 10px;
    background: rgba(136, 136, 136, .06);
    border-radius: 12px;
}

.knag-item {
    display: flex;
    overflow: hidden;
    gap: 10px;
    padding: 12px;
    border-radius: 12px;
    background: #f8f9fb;
    border: 1px solid rgba(0, 0, 0, .04);
}

.knag-item-avatar {
    flex: 0 0 34px;
    width: 34px;
    height: 34px;
    overflow: hidden;
    border-radius: 50%;
}

/* 子比主题会过滤 get_avatar 的自定义 class，这里直接约束图片本身 */
.knag-item-avatar img,
.knag-item-avatar .avatar {
    width: 34px !important;
    height: 34px !important;
    max-width: 34px !important;
    max-height: 34px !important;
    border-radius: 50% !important;
    object-fit: cover;
    display: block;
}

.knag-item-main {
    flex: 1;
    min-width: 0;
}

.knag-item-head {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    font-size: 12px;
}

.knag-item-name {
    font-size: 13px;
    font-weight: 600;
    color: #333;
    max-width: 50%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.knag-badge {
    font-size: 11px;
    padding: 1px 7px;
    border-radius: 20px;
    line-height: 1.7;
    background: rgba(136, 136, 136, .12);
    color: #888;
}

.knag-badge.is-pending {
    background: rgba(255, 111, 6, .1);
    color: #ff6f06;
}

.knag-badge.is-replied {
    background: rgba(41, 151, 247, .1);
    color: #2997f7;
}

.knag-badge.is-updated {
    background: rgba(18, 185, 40, .1);
    color: #12b928;
}

.knag-item-time {
    color: #aaa;
    margin-left: auto;
}

.knag-item-content {
    margin-top: 6px;
    font-size: 13px;
    line-height: 1.65;
    color: #555;
    word-break: break-word;
}

.knag-muted {
    color: #aaa;
}

.knag-reply {
    margin-top: 8px;
    padding: 8px 10px;
    border-radius: 10px;
    background: rgba(240, 68, 148, .06);
    border-left: 2px solid rgba(240, 68, 148, .5);
}

.knag-reply-head {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    color: var(--focus-color, #f04494);
    opacity: .9;
}

.knag-reply-body {
    margin-top: 4px;
    font-size: 13px;
    line-height: 1.6;
    color: #444;
    word-break: break-word;
}

.knag-reply-time {
    margin-top: 4px;
    font-size: 11px;
    color: #aaa;
}

.knag-more {
    width: 100%;
    margin-top: 12px;
    border: 1px solid rgba(0, 0, 0, .08);
    background: #fff;
    color: #666;
    border-radius: 10px;
    padding: 9px;
    font-size: 13px;
    cursor: pointer;
    transition: .2s;
}

.knag-more:hover {
    border-color: var(--focus-color, #f04494);
    color: var(--focus-color, #f04494);
}

.knag-more[hidden] {
    display: none;
}

/* 轻提示 */
.knag-toast {
    position: fixed;
    left: 50%;
    bottom: 12%;
    transform: translate(-50%, 12px);
    z-index: 100060;
    background: rgba(30, 32, 38, .92);
    color: #fff;
    font-size: 13px;
    padding: 10px 18px;
    border-radius: 30px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, .2);
    opacity: 0;
    transition: opacity .25s, transform .25s;
    pointer-events: none;
    max-width: 80vw;
    text-align: center;
}

.knag-toast.is-show {
    opacity: 1;
    transform: translate(-50%, 0);
}

.knag-toast.is-error {
    background: rgba(220, 53, 69, .94);
}

/* 暗色模式（跟随子比主题 body.dark-theme） */
body.dark-theme .knag-dialog,
body.dark-theme .knag-tabs,
body.dark-theme .knag-body {
    background: #23262d;
}

body.dark-theme .knag-head-text h3,
body.dark-theme .knag-head-text p {
    color: #fff;
}

body.dark-theme .knag-tab:not(.is-active) {
    background: rgba(255, 255, 255, .08);
    color: #b9bdc7;
}

body.dark-theme .knag-quota {
    background: rgba(255, 255, 255, .06);
    color: #9ba1ad;
}

body.dark-theme .knag-textarea {
    background: rgba(255, 255, 255, .05);
    border-color: rgba(255, 255, 255, .1);
    color: #e6e8ee;
}

body.dark-theme .knag-textarea:focus {
    background: rgba(255, 255, 255, .08);
}

body.dark-theme .knag-list-loading,
body.dark-theme .knag-empty {
    background: rgba(255, 255, 255, .05);
    color: #9ba1ad;
}

body.dark-theme .knag-update-notice {
    background: rgba(240, 68, 148, .14);
    border-color: rgba(240, 68, 148, .28);
}

body.dark-theme .knag-update-notice-head b {
    color: #ff8fbe;
}

body.dark-theme .knag-update-time {
    color: #b58fa5;
}

body.dark-theme .knag-update-content {
    color: #e6d8e2;
}

body.dark-theme .knag-item {
    background: rgba(255, 255, 255, .05);
    border-color: rgba(255, 255, 255, .06);
}

body.dark-theme .knag-item-name {
    color: #e6e8ee;
}

body.dark-theme .knag-item-content,
body.dark-theme .knag-reply-body {
    color: #c2c7d1;
}

body.dark-theme .knag-reply {
    background: rgba(240, 68, 148, .12);
    border-left-color: rgba(240, 68, 148, .6);
}

body.dark-theme .knag-more {
    background: rgba(255, 255, 255, .06);
    border-color: rgba(255, 255, 255, .1);
    color: #b9bdc7;
}

body.dark-theme .knag-textarea[disabled] {
    opacity: .65;
    cursor: not-allowed;
}

.knag-message:not(.is-success) {
    color: #ff8098;
}

body.knag-modal-open {
    overflow: hidden !important;
}

@media (max-width: 480px) {
    .knag-modal {
        padding: 12px;
        align-items: flex-end;
    }

    .knag-dialog {
        width: 100%;
        max-height: 90vh;
        border-radius: 18px 18px 0 0;
        transform: translateY(30px);
    }

    .knag-head {
        padding: 16px;
    }

    .knag-tabs,
    .knag-body {
        padding-left: 16px;
        padding-right: 16px;
    }

    .knag-item-time {
        width: 100%;
        margin-left: 0;
    }
}
