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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background: #0D1418;
    overflow: hidden;
    height: 100vh;
    width: 100vw;
}

/* Chat Header */
.chat-header {
    position: fixed;
    top: 24px;
    left: 0;
    right: 0;
    height: 60px;
    background: #1F2C34;
    display: flex;
    align-items: center;
    padding: 0 12px;
    gap: 12px;
    z-index: 999;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.back-btn {
    background: none;
    border: none;
    color: #00A884;
    cursor: pointer;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.2s;
}

.back-btn:active {
    opacity: 0.6;
}

.group-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #E6405F 0%, #FF6B4A 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    flex-shrink: 0;
}

.group-info {
    flex: 1;
    min-width: 0;
}

.group-name {
    color: #E9EDEF;
    font-size: 16px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.group-members {
    color: #8696A0;
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 2px;
}

.header-actions {
    display: flex;
    gap: 8px;
}

.action-btn {
    background: none;
    border: none;
    color: #8696A0;
    cursor: pointer;
    font-size: 20px;
    padding: 8px;
    transition: opacity 0.2s;
}

.action-btn:active {
    opacity: 0.6;
}

/* Chat Container */
.chat-container {
    position: fixed;
    top: 84px;
    bottom: 70px;
    left: 0;
    right: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.chat-background {
    position: fixed;
    top: 104px;
    bottom: 70px;
    left: 0;
    right: 0;
    background: #0D1418;
    opacity: 1;
    z-index: -1;
}

.messages-wrapper {
    padding: 12px 8px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

/* Date Divider */
.date-divider {
    display: flex;
    justify-content: center;
    margin: 16px 0 12px;
}

.date-divider span {
    background: rgba(17, 27, 33, 0.85);
    color: #8696A0;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    backdrop-filter: blur(10px);
}

/* Messages */
.message-group {
    display: flex;
    flex-direction: column;
    margin-bottom: 4px;
}

.message-group.other {
    align-items: flex-start;
}

.message-group.mine {
    align-items: flex-end;
}

.message-bubble {
    max-width: 75%;
    background: #1F2C34;
    border-radius: 8px;
    padding: 6px 10px 8px;
    position: relative;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.message-group.mine .message-bubble {
    background: #005C4B;
}

.sender-name {
    color: #00A884;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 4px;
}

.message-text {
    color: #E9EDEF;
    font-size: 15px;
    line-height: 1.5;
    word-wrap: break-word;
    margin-bottom: 4px;
}

.message-text>i {
    margin: 16px 0;
    color: #8696A0;
    font-size: 13px;
    font-style: normal;
}

.message-time {
    color: #8696A0;
    font-size: 11px;
    text-align: right;
    margin-top: 2px;
}

/* Link Message */
.link-message {
    padding: 0;
    overflow: hidden;
}

.link-preview {
    background: #1A2529;
    border-radius: 8px;
    overflow: hidden;
}

.link-preview-content {
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.link-emoji {
    font-size: 32px;
    margin-bottom: 4px;
}

.link-title {
    color: #00A884;
    font-size: 14px;
    font-weight: 500;
}

.link-url {
    color: #8696A0;
    font-size: 13px;
}

.link-message .message-time {
    padding: 4px 10px 6px;
}

/* Reactions */
.reactions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px solid rgba(134, 150, 160, 0.15);
}

.reaction {
    background: rgba(17, 27, 33, 0.6);
    color: #E9EDEF;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(134, 150, 160, 0.2);
}

/* System Messages */
.message-group.system {
    align-items: center;
    margin: 8px 0;
}

.system-message {
    background: rgba(17, 27, 33, 0.85);
    color: #8696A0;
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 13px;
    text-align: center;
    max-width: 80%;
    backdrop-filter: blur(10px);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
}

/* Input Area */
.input-area {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 70px;
    background: #1F2C34;
    display: flex;
    align-items: center;
    padding: 8px 12px 24px;
    gap: 8px;
    box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.2);
}

.input-btn,
.mic-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    background: none;
    color: #8696A0;
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.2s;
    flex-shrink: 0;
}

.input-btn:active,
.mic-btn:active {
    opacity: 0.6;
}

.input-wrapper {
    flex: 1;
    background: #2A3942;
    border-radius: 22px;
    display: flex;
    align-items: center;
    padding: 0 16px;
    height: 44px;
}

.input-wrapper input {
    flex: 1;
    background: none;
    border: none;
    color: #E9EDEF;
    font-size: 16px;
    outline: none;
}

.input-wrapper input::placeholder {
    color: #8696A0;
}

.emoji-btn {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    padding: 4px;
    transition: opacity 0.2s;
}

.emoji-btn:active {
    opacity: 0.6;
}

/* Scrollbar */
.chat-container::-webkit-scrollbar {
    width: 6px;
}

.chat-container::-webkit-scrollbar-track {
    background: transparent;
}

.chat-container::-webkit-scrollbar-thumb {
    background: rgba(134, 150, 160, 0.3);
    border-radius: 3px;
}

.chat-container::-webkit-scrollbar-thumb:hover {
    background: rgba(134, 150, 160, 0.5);
}

/* Animations */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message-bubble {
    animation: slideIn 0.3s ease-out;
}

/* Responsive adjustments */
@media (max-width: 375px) {
    .message-bubble {
        max-width: 80%;
    }

    .group-members {
        font-size: 12px;
    }
}