/* @font-face {
    font-family: "StarRailFont";
    src: local("StarRailFont"), url("res/StarRailFont.ttf") format("truetype");
} */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: "StarRailFont", "Microsoft YaHei", sans-serif;
    overflow: hidden;
    background: none;
}

.container {
    position: relative;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
}

.container::before {
    content: " ";
    position: absolute;
    top: -5%;
    left: -5%;
    width: 110%;
    height: 110%;
    background-image: url("res/background.webp");
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    filter: blur(0px) brightness(100%);
    z-index: -1;
}

.two-col-layout {
    display: flex;
    height: 100vh;
    padding: 20px;
    gap: 10px;
}

.two-col-layout__aside {
    width: 280px;
    margin: 0 10px;
    background-color: rgba(0, 0, 0, 0.5);
    border: 2px solid rgba(172, 172, 172, 0.35);
    border-radius: 2px;
    display: flex;
    flex-direction: column;
}

.search-box {
    padding: 15px;
}

.search-input {
    width: 100%;
    padding: 10px 15px;
    border: 2px solid rgba(172, 172, 172, 0.5);
    border-radius: 15px;
    background-color: rgba(0, 0, 0, 0.3);
    color: rgb(200, 200, 200);
    font-size: 14px;
    font-family: inherit;
    outline: none;
}

.search-input:focus {
    border-color: rgba(231, 231, 234, 0.75);
    background-color: rgba(0, 0, 0, 0.1);
}

.search-input::placeholder {
    color: rgb(150, 150, 150);
}

.recent-contact-list {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
}

.recent-contact-item {
    display: flex;
    align-items: center;
    padding: 15px;
    margin-bottom: 8px;
    border: 2px solid rgba(172, 172, 172, 0.35);
    border-radius: 2px;
    background-color: rgba(0, 0, 0, 0.4);
    cursor: pointer;
    transition: all 0.5s ease;
}

.recent-contact-item:hover {
    border: 2px solid rgba(231, 231, 234, 0.75);
    background-color: rgba(0, 0, 0, 0.1);
}

.recent-contact-item.active {
    border: 2px solid rgba(255, 215, 0, 0.75);
    background-color: rgba(0, 0, 0, 0.6);
}

.recent-contact-item .avatar {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    margin-right: 15px;
    object-fit: cover;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 20px;
    overflow: hidden;
}

.recent-contact-item .avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.recent-contact-item .contact-info {
    flex: 1;
    overflow: hidden;
}

.recent-contact-item .contact-name {
    color: rgb(200, 200, 200);
    font-size: 16px;
    font-weight: bold;
    margin-bottom: 5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.recent-contact-item .contact-preview {
    color: rgb(150, 150, 150);
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    word-break: break-all;
}

.two-col-layout__main {
    flex: 1;
    position: relative;
    background-color: rgba(221, 221, 221, 95%);
    border-radius: 0 15px 0 0;
    box-shadow: 0 0 3px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.two-col-layout__main::before {
    content: " ";
    z-index: -1;
    position: absolute;
    top: 5px;
    left: -6px;
    display: block;
    width: 100%;
    height: 100%;
    border: 1.5px solid rgba(172, 172, 172, 0.5);
    pointer-events: none;
}

.corner-decoration {
    position: absolute;
    top: 0;
    left: 0;
    width: 130px;
    height: 130px;
    background-image: url("res/img_header.png");
    background-size: 130px 130px;
    background-repeat: no-repeat;
    opacity: 0.75;
    z-index: 10;
}

.back-btn {
    display: none;
}

.chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px 20px 15px 24px;
    background-color: rgba(221, 221, 221, 0.95);
    border-bottom: 1px solid rgba(172, 172, 172, 0.5);
}

.chat-header__title-area {
    display: flex;
    flex-direction: column;
    gap: 2px;
    position: relative;
    z-index: 11;
    pointer-events: none;
}

.chat-header__contact-name span {
    color: rgb(0, 0, 0);
    font-weight: bolder;
    font-size: large;
}

.chat-header__contact-info {
    color: rgb(130, 130, 130);
    font-size: 13px;
    font-weight: normal;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 280px;
    min-height: 18px;
}

.chat-header__toolbar {
    display: flex;
    gap: 15px;
    opacity: 1;
    transition: opacity 0.7s ease;
    position: relative;
}

.chat-header:hover .chat-header__toolbar {
    opacity: 1;
}

.toolbar-btn {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    padding: 5px;
    transition: transform 0.2s;
    color: rgb(80, 80, 80);
    display: flex;
    align-items: center;
    justify-content: center;
}

.toolbar-btn:hover {
    transform: scale(1.2);
}

.chat-menu-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 8px;
    min-width: 260px;
    background: rgb(252, 252, 252);
    border: 1px solid rgba(172, 172, 172, 0.5);
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    z-index: 100;
    padding: 14px 16px;
}

.chat-menu-dropdown.open {
    display: block;
}

.chat-menu-section {
    margin-bottom: 0;
}

.chat-menu-label {
    display: block;
    font-size: 13px;
    font-weight: bold;
    color: rgb(100, 100, 100);
    margin-bottom: 8px;
}

.chat-menu-identity-row {
    display: flex;
    gap: 8px;
    align-items: center;
}

.chat-menu-input {
    flex: 1;
    padding: 7px 10px;
    border: 1.5px solid rgba(172, 172, 172, 0.6);
    border-radius: 4px;
    font-size: 13px;
    font-family: inherit;
    outline: none;
    background: #fff;
    color: rgb(40, 40, 40);
    transition: border-color 0.2s;
}

.chat-menu-input:focus {
    border-color: rgba(102, 126, 234, 0.7);
}

.chat-menu-save-btn {
    padding: 7px 16px;
    background-color: rgb(234, 234, 234);
    border: 1px solid rgba(172, 172, 172, 0.6);
    border-radius: 4px;
    font-size: 13px;
    font-family: inherit;
    font-weight: bold;
    cursor: pointer;
    color: rgb(60, 60, 60);
    transition: background-color 0.2s;
    white-space: nowrap;
}

.chat-menu-save-btn:hover {
    background-color: rgb(210, 210, 210);
}

.chat-menu-divider {
    height: 1px;
    background: rgba(172, 172, 172, 0.4);
    margin: 12px 0;
}

.chat-menu-danger-btn {
    display: block;
    width: 100%;
    padding: 8px 0;
    background: none;
    border: 1.5px solid rgba(200, 60, 60, 0.5);
    border-radius: 4px;
    font-size: 13px;
    font-family: inherit;
    font-weight: bold;
    color: rgb(200, 60, 60);
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.chat-menu-danger-btn:hover {
    background-color: rgba(200, 60, 60, 0.08);
    border-color: rgba(200, 60, 60, 0.8);
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px 40px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.empty-state {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: rgb(150, 150, 150);
    font-size: 18px;
}

.message-container {
    display: flex;
    gap: 15px;
    max-width: 70%;
}

.message-container--align-right {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.message-container .avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 24px;
    flex-shrink: 0;
    overflow: hidden;
    border: 1px solid rgba(200, 200, 200, 0.6);
    box-sizing: border-box;
}

.message-container .avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.message-content-wrapper {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.user-name {
    font-size: 14px;
    color: rgb(100, 100, 100);
    font-weight: bold;
    margin: 0 6px;
}

.msg-content-container {
    background-color: rgb(248, 248, 248);
    border-radius: 13px;
    border-top-left-radius: 2px;
    padding: 11px 17px 9px 17px;
    box-shadow: -1px 2px rgb(156, 156, 156);
    margin: 2px 6px;
    position: relative;
}

.message-container--align-right .msg-content-container {
    background-color: rgb(209, 189, 149);
    border-top-left-radius: 12px;
    border-top-right-radius: 2px;
    box-shadow: 1px 3px rgb(156, 156, 156);
    color: rgb(40, 40, 40);
}

.message-content {
    color: rgb(0, 0, 0);
    font-size: 16px;
    font-weight: bold;
    line-height: 1.5;
    word-wrap: break-all;
    overflow-wrap: anywhere;
}

/* 表情包样式 */
.emoji-base {
    border-radius: 8px;
    object-fit: contain; /* 可选，防止变形 */
}

.emoji-image {
    width: 150px;      /* 改为固定宽度，替代 max-width */
    height: 150px;     /* 改为固定高度，替代 max-height */
    display: block;
}

.message-text {
    display: inline;
}

.message-timestamp {
    font-size: 12px;
    color: rgb(150, 150, 150);
    text-align: center;
    margin: 10px 0;
}

.chat-input-area {
    padding: 15px 20px;
    background-color: rgba(200, 200, 200, 0.1);
    border-top: 1px solid rgba(172, 172, 172, 0.3);
    box-shadow: inset 0px 2px rgba(172, 172, 172, 0.25);
}

.chat-func-bar {
    display: flex;
    gap: 15px;
    margin-bottom: 10px;
}

.func-btn {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    padding: 5px;
    transition: transform 0.2s;
}

.func-btn:hover {
    transform: scale(1.2);
}

.input-wrapper {
    margin-bottom: 10px;
}

.input-wrapper textarea {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid rgba(172, 172, 172, 0.5);
    border-radius: 8px;
    background-color: rgba(255, 255, 255, 0.9);
    color: rgb(0, 0, 0);
    font-family: inherit;
    font-size: 15px;
    resize: none;
    outline: none;
}

.input-wrapper textarea:focus {
    border-color: rgba(102, 126, 234, 0.7);
}

.send-btn-wrap {
    display: flex;
    justify-content: flex-end;
}

.send-msg {
    padding: 10px 30px;
    background-color: rgb(234, 234, 234);
    border: 1px solid rgba(172, 172, 172, 0.75);
    border-radius: 1px;
    box-shadow: 1px 1px 2px rgba(172, 172, 172, 0.75);
    color: rgb(18, 18, 18);
    font-family: inherit;
    font-weight: bold;
    font-size: 15px;
    cursor: pointer;
    transition: all 0.3s;
}

.send-msg:hover {
    background-color: rgb(200, 200, 200);
    box-shadow: 2px 2px 4px rgba(172, 172, 172, 0.9);
}

.send-msg--disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.typing-dots {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 0;
    margin-left: 10px;
    margin-top: 5px;
}

.typing-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: rgb(90, 90, 90);
    animation: typingBounce 1.4s infinite ease-in-out both;
}

.typing-dot:nth-child(1) {
    animation-delay: 0s;
}

.typing-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typingBounce {
    0%, 80%, 100% {
        transform: scale(0.6);
        opacity: 0.4;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

.message__timestamp {
    text-align: center;
    color: rgb(108, 108, 108);
    font-size: 14px;
    margin: 10px 0;
    font-weight: bold;
}

.message__timestamp::before {
    content: " ";
    display: inline-block;
    vertical-align: middle;
    width: 20px;
    height: 20px;
    margin-right: 8px;
    /* background-image: url("res/icon_tip.svg"); */
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

.message__tips {
    text-align: center;
    color: rgb(108, 108, 108);
    font-size: 14px;
    margin: 10px 0;
    font-weight: bold;
}

.message__tips::before {
    content: " ";
    display: inline-block;
    vertical-align: middle;
    width: 20px;
    height: 20px;
    margin-right: 8px;
    background-image: url("res/icon_tip.svg");
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

/* 加载更多消息指示器 */
.load-more-indicator {
    text-align: center;
    padding: 12px 0 8px;
}

.load-more-btn {
    background: rgba(172, 172, 172, 0.2);
    border: 1px solid rgba(172, 172, 172, 0.4);
    border-radius: 15px;
    padding: 6px 20px;
    color: rgb(120, 120, 120);
    font-size: 13px;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s;
}

.load-more-btn:hover {
    background: rgba(172, 172, 172, 0.35);
    color: rgb(80, 80, 80);
}

.load-more-text {
    color: rgb(150, 150, 150);
    font-size: 13px;
}

::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
}

::-webkit-scrollbar-thumb {
    background: rgba(172, 172, 172, 0.5);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(172, 172, 172, 0.8);
}

.sidebar-nav {
    position: fixed;
    left: 0;
    top: 0;
    width: 60px;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-top: 20px;
    z-index: 100;
}

.sidebar-nav .q-icon {
    color: rgb(200, 200, 200);
    font-size: 24px;
    margin-bottom: 20px;
    cursor: pointer;
    transition: transform 0.2s;
}

.sidebar-nav .q-icon:hover {
    transform: scale(1.2);
}

.message-container--align-right .user-name {
    text-align: right;
}

.contact-name-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
}
.contact-time {
    color: gray;
    font-size: 12px;
}

.recall-btn {
    position: absolute;
    bottom: -4px;
    left: -32px;
    width: 24px;
    height: 24px;
    background: none;
    border: none;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.message-container--align-right:hover .recall-btn {
    opacity: 1;
}

.recall-btn svg {
    width: 18px;
    height: 18px;
    fill: rgb(180, 180, 180);
    transition: fill 0.2s;
}

.recall-btn:hover svg {
    fill: rgb(120, 120, 120);
}

/* 响应式设计 - 移动端适配 */
@media screen and (max-width: 768px) {
    .two-col-layout {
        padding: 0;
        gap: 0;
    }

    .two-col-layout__aside {
        width: 100%;
        margin: 0;
        border-radius: 0;
        border: none;
        position: absolute;
        top: 0;
        left: 0;
        height: 100vh;
        z-index: 50;
    }

    .two-col-layout__aside.hidden-mobile {
        display: none !important;
    }

    .two-col-layout__main {
        width: 100%;
        border-radius: 0;
        position: absolute;
        top: 0;
        left: 0;
        height: 100vh;
        z-index: 40;
    }

    .two-col-layout__main::before {
        display: none;
    }

    .two-col-layout__main.hidden-mobile {
        display: none !important;
    }

    .corner-decoration {
        display: block;
        width: 80px;
        height: 80px;
        background-size: 80px 80px;
        cursor: pointer;
    }

    .corner-decoration:active {
        opacity: 0.6;
    }

    .chat-header {
        padding: 15px 15px 10px 24px;
    }

    .chat-header__contact-info {
        max-width: 180px;
    }

    .recent-contact-item {
        padding: 12px;
    }

    .recent-contact-item .avatar {
        width: 45px;
        height: 45px;
        margin-right: 12px;
        font-size: 18px;
    }

    .recent-contact-item .contact-name {
        font-size: 14px;
    }

    .recent-contact-item .contact-preview {
        font-size: 12px;
    }

    .message-container .avatar {
        width: 40px;
        height: 40px;
        font-size: 18px;
    }

    .message-container {
        max-width: 85%;
        gap: 10px;
    }

    .message-content-wrapper {
        gap: 4px;
    }

    .user-name {
        font-size: 12px;
        margin: 0 4px;
    }

    .msg-content-container {
        font-size: 14px;
    }

    .chat-messages {
        padding: 15px 20px;
    }

    .emoji-image {
    width: 100px;
    height: 100px;
    display: block;
    }
}