@import url("./style.css");

/* ========== 全屏讨论页（上线向布局） ========== */

html.rt-chat-root {
    height: 100%;
}

.rt-chat-body.rt-chat-fullpage {
    margin: 0;
    min-height: 100%;
    height: 100%;
    overflow: hidden;
    background: #0c1220;
    color: #e8edf7;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", sans-serif;
}

.rt-app {
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
    min-height: 0;
    box-sizing: border-box;
    /* 为底部固定 ICP 栏留出空间，避免遮挡输入区 */
    padding-bottom: 42px;
}

/* —— 顶栏 —— */
.rt-pro-topbar__start {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.rt-chat-body .rt-pro-topbar.site-header {
    position: relative;
    z-index: 40;
    flex-shrink: 0;
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) auto minmax(0, 1fr);
    align-items: center;
    gap: 12px 20px;
    padding: 10px 20px;
    min-height: 56px;
    background: rgba(10, 16, 28, 0.92) !important;
    backdrop-filter: blur(16px) saturate(1.2) !important;
    border-bottom: 1px solid rgba(100, 140, 200, 0.12);
    box-shadow: none !important;
}

.rt-pro-topbar__brand {
    justify-self: start;
    min-width: 0;
}

.rt-pro-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: inherit;
    min-width: 0;
}

.rt-pro-logo__mark {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    font-weight: 800;
    font-size: 18px;
    color: #061018;
    background: linear-gradient(135deg, #5ad4ff, #5b7cff);
    flex-shrink: 0;
}

.rt-pro-logo__text {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.rt-pro-logo__title {
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #f0f6ff;
}

.rt-pro-logo__sub {
    font-size: 11px;
    color: rgba(180, 200, 230, 0.65);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.rt-pro-nav.main-nav {
    justify-self: center;
    gap: 6px 16px;
    flex-wrap: wrap;
    justify-content: center;
}

.rt-chat-body .rt-pro-nav .nav-item {
    color: rgba(200, 215, 240, 0.75);
    font-size: 13px;
    font-weight: 500;
    padding: 6px 4px;
}

.rt-chat-body .rt-pro-nav .nav-item:hover,
.rt-chat-body .rt-pro-nav .nav-item-active {
    color: #fff;
}

.rt-chat-body .rt-pro-nav .nav-item::after {
    background: linear-gradient(90deg, #5ad4ff, #7c9dff);
}

.rt-pro-topbar__meta {
    justify-self: end;
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
    min-width: 0;
}

.rt-pro-live {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(120, 160, 220, 0.15);
}

.rt-pro-live__dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #5ad4ff;
    animation: rt-pro-pulse 2s ease-in-out infinite;
}

@keyframes rt-pro-pulse {
    0%,
    100% {
        box-shadow: 0 0 0 0 rgba(90, 212, 255, 0.45);
    }
    50% {
        box-shadow: 0 0 0 6px rgba(90, 212, 255, 0);
    }
}

.rt-pro-live__text {
    font-size: 12px;
    font-weight: 600;
    color: rgba(220, 232, 255, 0.88);
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.rt-pro-account {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    min-width: 0;
}

.rt-user-chip {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 4px 4px 4px;
    border-radius: 999px;
    border: 1px solid rgba(120, 160, 220, 0.2);
    background: rgba(255, 255, 255, 0.04);
}

.rt-user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 10px;
    display: grid;
    place-items: center;
    font-weight: 800;
    font-size: 13px;
    color: #061018;
    background: linear-gradient(135deg, #5ad4ff, #6b8dff);
}

.rt-user-text {
    display: flex;
    flex-direction: column;
    gap: 0;
    max-width: 120px;
}

.rt-user-name {
    font-size: 12px;
    font-weight: 700;
    color: #fff;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.rt-user-email {
    font-size: 10px;
    color: rgba(180, 200, 230, 0.55);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.rt-user-logout {
    padding: 6px 10px;
    font-size: 11px;
    font-weight: 600;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: transparent;
    color: rgba(255, 255, 255, 0.85);
    cursor: pointer;
    margin-right: 4px;
}

.rt-user-logout:hover {
    background: rgba(255, 255, 255, 0.08);
}

.rt-user-profile {
    margin-right: 4px;
    font-size: 12px;
}

.rt-user-guest {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    font-size: 12px;
}

.rt-user-guest-text {
    color: rgba(200, 215, 240, 0.6);
}

.rt-link {
    color: #7ec8ff;
    font-weight: 600;
    text-decoration: none;
}

.rt-link:hover {
    text-decoration: underline;
}

.rt-link-muted {
    opacity: 0.85;
}

/* —— 主工作区：消息 + 右侧成员 —— */
.rt-workspace {
    flex: 1 1 auto;
    min-height: 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 300px;
    gap: 0;
}

.rt-thread {
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    border-right: 1px solid rgba(100, 140, 200, 0.1);
    background: linear-gradient(180deg, #0e1525 0%, #0a101c 100%);
}

.rt-thread__head {
    flex-shrink: 0;
    padding: 16px 24px 12px;
    border-bottom: 1px solid rgba(100, 140, 200, 0.08);
}

.rt-thread__h {
    margin: 0 0 4px;
    font-size: 18px;
    font-weight: 700;
    color: #fff;
    letter-spacing: 0.02em;
}

.rt-thread__sub {
    margin: 0;
    font-size: 13px;
    color: rgba(180, 200, 230, 0.55);
    line-height: 1.45;
}

.rt-feed {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 16px 24px 20px;
    scroll-behavior: smooth;
}

.rt-msg {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    margin-bottom: 14px;
    animation: rt-msg-in 0.22s ease both;
}

@keyframes rt-msg-in {
    from {
        opacity: 0;
        transform: translateY(6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.rt-msg--own {
    flex-direction: row-reverse;
}

.rt-msg-avatar {
    flex: 0 0 auto;
    width: 38px;
    height: 38px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    font-size: 14px;
    font-weight: 800;
    color: rgba(240, 248, 255, 0.95);
    background: rgba(90, 140, 220, 0.15);
    border: 1px solid rgba(120, 170, 240, 0.2);
}

.rt-msg--own .rt-msg-avatar {
    background: rgba(90, 212, 255, 0.18);
    border-color: rgba(90, 212, 255, 0.28);
}

.rt-msg-bubble {
    max-width: min(560px, calc(100vw - 380px));
    padding: 11px 15px 13px;
    border-radius: 18px;
    border: 1px solid rgba(140, 185, 255, 0.28);
    background: rgba(255, 255, 255, 0.055);
    box-shadow:
        0 0 0 1px rgba(0, 0, 0, 0.12) inset,
        0 8px 24px rgba(0, 0, 0, 0.12);
}

.rt-msg--own .rt-msg-bubble {
    background: linear-gradient(145deg, rgba(55, 130, 215, 0.32), rgba(85, 95, 195, 0.22));
    border-color: rgba(130, 200, 255, 0.42);
    box-shadow:
        0 0 0 1px rgba(255, 255, 255, 0.06) inset,
        0 8px 26px rgba(40, 100, 200, 0.2);
}

.rt-msg-meta {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 6px;
    font-size: 11px;
    color: rgba(180, 200, 230, 0.5);
}

.rt-msg-author {
    font-weight: 700;
    color: rgba(230, 240, 255, 0.88);
}

.rt-msg-body {
    font-size: 14px;
    line-height: 1.65;
    white-space: pre-wrap;
    word-break: break-word;
    color: rgba(240, 248, 255, 0.94);
}

.rt-msg-image {
    display: block;
    max-width: 100%;
    max-height: min(320px, 48vh);
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 14px;
    border: 1px solid rgba(150, 195, 255, 0.28);
    background: rgba(0, 0, 0, 0.22);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

.rt-msg-caption {
    margin-top: 8px;
    font-size: 13px;
    line-height: 1.5;
    color: rgba(200, 220, 245, 0.8);
}

.rt-thread__footer {
    flex-shrink: 0;
    border-top: 1px solid rgba(100, 140, 200, 0.12);
    background: rgba(8, 12, 22, 0.95);
    padding-bottom: env(safe-area-inset-bottom, 0);
}

.rt-guest-strip {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    padding: 10px 24px;
    background: rgba(90, 140, 220, 0.08);
    border-bottom: 1px solid rgba(100, 140, 200, 0.1);
}

.rt-guest-strip__text {
    font-size: 13px;
    color: rgba(200, 220, 255, 0.75);
}

.rt-guest-strip__actions {
    display: flex;
    gap: 8px;
}

.rt-pill {
    display: inline-flex;
    align-items: center;
    padding: 7px 14px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    text-decoration: none;
    border: 1px solid rgba(140, 180, 240, 0.3);
    color: rgba(230, 240, 255, 0.9);
    background: rgba(255, 255, 255, 0.04);
}

.rt-pill--primary {
    background: linear-gradient(90deg, #3a9ee8, #5b6fd8);
    border-color: transparent;
    color: #fff;
}

.rt-composer {
    padding: 14px 24px 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    transition: opacity 0.2s ease;
}

.rt-composer.is-locked {
    opacity: 0.42;
    pointer-events: none;
}

.rt-preview {
    display: none;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px dashed rgba(120, 180, 255, 0.35);
    background: rgba(60, 120, 200, 0.08);
}

.rt-preview.is-show {
    display: flex;
}

.rt-preview img {
    width: min(200px, 42vw);
    height: 120px;
    max-height: 28vh;
    object-fit: cover;
    border-radius: 12px;
    border: 1px solid rgba(150, 195, 255, 0.35);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}

.rt-preview__label {
    display: block;
    font-size: 12px;
    font-weight: 700;
    color: #fff;
}

.rt-preview__name {
    font-size: 11px;
    color: rgba(180, 200, 230, 0.55);
}

.rt-composer__row {
    display: flex;
    align-items: flex-end;
    gap: 10px;
}

.rt-input {
    flex: 1 1 auto;
    min-height: 44px;
    max-height: 160px;
    resize: vertical;
    padding: 12px 16px;
    border-radius: 14px;
    border: 1px solid rgba(120, 160, 220, 0.2);
    background: rgba(255, 255, 255, 0.05);
    color: #f0f6ff;
    font-size: 14px;
    line-height: 1.5;
    outline: none;
    font-family: inherit;
}

.rt-input::placeholder {
    color: rgba(160, 180, 210, 0.45);
}

.rt-input:focus {
    border-color: rgba(90, 180, 255, 0.45);
    box-shadow: 0 0 0 3px rgba(60, 140, 240, 0.15);
}

.rt-composer__actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.rt-icon-btn {
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    border: 1px solid rgba(120, 160, 220, 0.2);
    background: rgba(255, 255, 255, 0.04);
    color: rgba(200, 220, 255, 0.85);
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.rt-icon-btn:hover {
    background: rgba(90, 160, 255, 0.12);
    border-color: rgba(90, 180, 255, 0.3);
}

.rt-send-btn {
    height: 44px;
    padding: 0 20px;
    border-radius: 12px;
    border: none;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    color: #fff;
    background: linear-gradient(135deg, #2d8ae6, #5b66d8);
    box-shadow: 0 4px 18px rgba(40, 100, 200, 0.35);
    transition: transform 0.12s ease, filter 0.15s ease;
}

.rt-send-btn:hover:not(:disabled) {
    transform: translateY(-1px);
    filter: brightness(1.05);
}

.rt-send-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    box-shadow: none;
}

.rt-composer__hint {
    margin: 0;
    font-size: 11px;
    color: rgba(150, 170, 200, 0.45);
}

/* —— 在线成员侧栏 —— */
.rt-roster {
    display: flex;
    flex-direction: column;
    min-height: 0;
    background: #0a0f18;
    border-left: 1px solid rgba(100, 140, 200, 0.08);
}

.rt-roster__head {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 18px 8px;
}

.rt-roster__title {
    margin: 0;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: rgba(200, 215, 240, 0.55);
}

.rt-roster__count {
    font-size: 12px;
    font-weight: 800;
    padding: 2px 10px;
    border-radius: 999px;
    background: rgba(90, 160, 255, 0.15);
    color: #9fd4ff;
}

.rt-roster__lead {
    margin: 0 18px 12px;
    font-size: 12px;
    line-height: 1.45;
    color: rgba(160, 180, 210, 0.45);
}

.rt-roster__list {
    list-style: none;
    margin: 0;
    padding: 0 12px 20px;
    overflow-y: auto;
    flex: 1 1 auto;
    min-height: 0;
}

.rt-roster__item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 10px;
    margin-bottom: 4px;
    border-radius: 12px;
    border: 1px solid transparent;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.rt-roster__item:hover {
    background: rgba(255, 255, 255, 0.03);
}

.rt-roster__item.is-self {
    background: rgba(60, 130, 220, 0.12);
    border-color: rgba(90, 180, 255, 0.2);
}

.rt-roster__ava {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: grid;
    place-items: center;
    font-weight: 800;
    font-size: 13px;
    color: #061018;
    background: linear-gradient(135deg, #6ab8ff, #7c8ae8);
    flex-shrink: 0;
}

.rt-roster__item:not(.is-self) .rt-roster__ava {
    background: rgba(100, 140, 200, 0.25);
    color: rgba(230, 240, 255, 0.95);
}

.rt-roster__name {
    flex: 1 1 auto;
    min-width: 0;
    font-size: 13px;
    font-weight: 600;
    color: rgba(235, 242, 255, 0.92);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.rt-roster__badge {
    flex-shrink: 0;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.04em;
    padding: 3px 8px;
    border-radius: 6px;
    text-transform: uppercase;
}

.rt-roster__badge--member {
    background: rgba(80, 200, 140, 0.18);
    color: #7ee0b8;
}

.rt-roster__badge--guest {
    background: rgba(200, 200, 220, 0.08);
    color: rgba(180, 190, 210, 0.7);
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* 侧栏按钮：与全局 sidebar-toggle 协调 */
.rt-chat-body .sidebar-toggle {
    border-color: rgba(120, 160, 220, 0.25);
    background: rgba(255, 255, 255, 0.06);
}

.rt-chat-body .sidebar-toggle-bar {
    background: #b8d4ff;
}

/* 响应式：窄屏成员栏到底部抽屉式 —— 简化为底部折叠条或隐藏到 Tab */
@media (max-width: 960px) {
    .rt-workspace {
        grid-template-columns: minmax(0, 1fr);
        grid-template-rows: minmax(0, 1fr) auto;
    }

    .rt-roster {
        max-height: 200px;
        border-left: none;
        border-top: 1px solid rgba(100, 140, 200, 0.12);
    }

    .rt-msg-bubble {
        max-width: min(520px, 88vw);
    }

    .rt-chat-body .rt-pro-topbar.site-header {
        grid-template-columns: 1fr;
        justify-items: stretch;
    }

    .rt-pro-topbar__brand,
    .rt-pro-topbar__meta {
        justify-self: stretch;
    }

    .rt-pro-nav.main-nav {
        justify-self: stretch;
        justify-content: flex-start;
    }

    .rt-pro-topbar__meta {
        justify-content: space-between;
    }
}

@media (max-width: 520px) {
    .rt-thread__head {
        padding-left: 16px;
        padding-right: 16px;
    }

    .rt-feed {
        padding-left: 16px;
        padding-right: 16px;
    }

    .rt-composer {
        padding-left: 16px;
        padding-right: 16px;
    }

    .rt-pro-logo__sub {
        display: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .rt-msg,
    .rt-pro-live__dot {
        animation: none !important;
    }
}

/* 底部 ICP 备案（固定于视口底栏，不遮挡主讨论区滚动） */
.site-footer--chat {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 60;
    padding: 8px 16px 12px;
    margin: 0;
    background: rgba(8, 12, 24, 0.94);
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    text-align: center;
}

.site-footer--chat .site-footer-icp {
    margin: 0;
}

.site-footer--chat .site-footer-icp a {
    color: rgba(160, 180, 210, 0.9);
}

.site-footer--chat .site-footer-icp a:hover {
    color: #c8d4ec;
}
