* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    overflow-x: hidden;
    overscroll-behavior-x: none;
}

:root {
    --primary-color: #FEE500;
    --secondary-color: #F5D900;
    --bg-color: #FFFFFF;
    --chat-bg: #B2C7D9;
    --message-out: #FEE500;
    --message-in: #FFFFFF;
    --text-color: #333333;
    --text-secondary: #999999;
    --border-color: #D5D5D5;
    --header-bg: #B2C7D9;
    --header-text: #333333;
    --pending-bg: #FFF8E1;
    --pending-border: #FFB300;
    --input-bg: #FFFFFF;
    --sidebar-bg: #FFFFFF;
    --hover-bg: #F0F0F0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background: #FFFFFF;
    /* 흰색: 안드로이드 하단 네비게이션바를 흰색으로 표시 */
    overflow-x: hidden;
    overflow-y: hidden;
    overscroll-behavior-x: none;
    -webkit-tap-highlight-color: transparent;
    max-width: 100vw;
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
}

/* Allow selection in input fields specifically */
input,
textarea {
    -webkit-user-select: auto !important;
    user-select: auto !important;
}

.hidden {
    display: none !important;
}

@keyframes toastFadeIn {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

@keyframes toastFadeOut {
    from {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }

    to {
        opacity: 0;
        transform: translateX(-50%) translateY(20px);
    }
}

#app {
    height: 100vh;
    height: 100svh;
    /* svh = Small Viewport Height: stable height that doesn't change when keyboard opens.
       Unlike dvh (dynamic), svh prevents layout jumps in PWA mode. */
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    overscroll-behavior-x: none;
    max-width: 100vw;
}

.app-header {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to bottom,
            rgba(178, 199, 217, 1) 0%,
            rgba(178, 199, 217, 0.8) 100%);
    color: var(--header-text);
    padding: 10px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: none;
    /* Removed shadow/border for seamless transparency */
    z-index: 100;
    gap: 8px;
}

.header-left,
.header-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.header-left {
    min-width: 0;
    flex-shrink: 1;
}

.header-left h1 {
    font-size: 16px;
    font-weight: 600;
    color: #333333 !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 140px;
}

.header-center {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    min-width: 0;
}

.header-tabs {
    display: flex;
    gap: 4px;
    background: rgba(255, 255, 255, 0.15);
    padding: 3px;
    border-radius: 20px;
}

.header-tab {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 6px 16px;
    border-radius: 16px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.header-tab.active {
    background: var(--primary-color);
    color: white;
}

.header-tab:hover:not(.active) {
    background: rgba(255, 255, 255, 0.2);
}

.header-message {
    font-size: 9px;
    color: #333333;
    opacity: 0.9;
    text-align: center;
    line-height: 1.3;
    white-space: pre-line;
    max-width: 200px;
}

.icon-btn {
    background: none;
    border: none;
    color: inherit;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.icon-btn:hover {
    background: rgba(255, 255, 255, 0.15);
}

.icon-btn.login-highlight {
    animation: loginPulse 0.5s ease-in-out 3;
    background: rgba(250, 225, 0, 0.4);
    box-shadow: 0 0 0 4px rgba(250, 225, 0, 0.6);
}

@keyframes loginPulse {

    0%,
    100% {
        transform: scale(1);
        box-shadow: 0 0 0 4px rgba(250, 225, 0, 0.6);
    }

    50% {
        transform: scale(1.15);
        box-shadow: 0 0 0 8px rgba(250, 225, 0, 0.3);
    }
}

.header-avatar {
    width: 36px;
    height: 36px;
    object-fit: cover;
}

.chat-container {
    flex: 1;
    min-height: 0;
    /* CRITICAL: allows flex item to shrink below content height.
                      Without this, chat overflows and pushes input box off screen. */
    overflow-y: auto;
    overflow-x: hidden;
    /* 좌우 스크롤 제거 */
    overscroll-behavior-x: none;
    /* 가로 오버스크롤 완전 차단 */
    touch-action: pan-y;
    /* 터치 제스처를 세로 전용으로 제한 */
    padding: 70px 20px 20px 20px;
    /* Added 70px top padding so it clears the absolute header, but scrolls underneath it */
    background: var(--chat-bg);
    position: relative;
}

.floating-date {
    position: fixed;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.4);
    color: white;
    padding: 6px 14px;
    border-radius: 16px;
    font-size: 13px;
    font-weight: 500;
    z-index: 50;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    transition: opacity 0.2s, transform 0.2s;
    pointer-events: none;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.floating-date.hidden {
    opacity: 0;
    transform: translateX(-50%) translateY(-10px);
}

.date-divider {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 16px 0;
    text-align: center;
}

.date-divider-text {
    background: rgba(0, 0, 0, 0.4);
    color: white;
    padding: 5px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.messages-container {
    max-width: 1000px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.loading-indicator {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px 16px;
    gap: 10px;
    color: var(--text-secondary);
    font-size: 14px;
    background: linear-gradient(to bottom, var(--chat-bg) 0%, transparent 100%);
    position: sticky;
    top: 0;
    z-index: 10;
}

.loading-spinner {
    width: 24px;
    height: 24px;
    border: 3px solid rgba(0, 0, 0, 0.1);
    border-top: 3px solid var(--header-bg);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

.refresh-indicator {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 12px 16px;
    gap: 10px;
    color: var(--text-secondary);
    font-size: 13px;
    background: linear-gradient(to top, var(--chat-bg) 0%, transparent 100%);
    position: sticky;
    bottom: 0;
    z-index: 10;
}

.pull-refresh-indicator {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(60, 60, 60, 0.9);
    color: white;
    padding: 10px 20px;
    border-radius: 24px;
    display: none;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    transition: opacity 0.2s ease;
}

.pull-refresh-indicator .loading-spinner {
    width: 16px;
    height: 16px;
    border-width: 2px;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.message-wrapper {
    display: flex;
    gap: 6px;
    max-width: 96%;
    position: relative;
}

.message-wrapper.in {
    align-self: flex-start;
}

.message-wrapper.out {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.message-avatar {
    width: 35px;
    height: 35px;
    object-fit: cover;
    flex-shrink: 0;
    cursor: pointer;
}

img.message-avatar {
    clip-path: url(#squircleClip);
}

.avatar-initials,
.avatar-default {
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 16px;
    text-transform: uppercase;
    user-select: none;
    overflow: hidden;
}

.message {
    padding: 8px 14px;
    border-radius: 12px;
    word-wrap: break-word;
    position: relative;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
    max-width: 88%;
}

/* ── 발신 메시지 (노란 말풍선) ── */
.message.out {
    background: var(--message-out);
    border-radius: 12px;
    color: #333333;
    margin-right: 0;
}

/* ── 수신 메시지 (흰 말풍선) ── */
.message.in {
    background: var(--message-in);
    border-radius: 12px;
    color: #333333;
    margin-left: 0;
}

.message {
    position: relative;
}

.message-content-wrapper {
    display: flex;
    flex-direction: column;
    gap: 2px;
    max-width: 100%;
}

.message-wrapper.out .message-content-wrapper {
    align-items: flex-end;
}

.message-wrapper.in .message-content-wrapper {
    align-items: flex-start;
}

.message-row {
    display: flex;
    align-items: flex-end;
    gap: 6px;
    max-width: 100%;
}

.message-wrapper.out .message-row {
    flex-direction: row-reverse;
}

.message-meta-external {
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    gap: 2px;
    margin-bottom: 2px;
}

.message-wrapper.out .message-meta-external {
    align-items: flex-end;
}

.message-wrapper.in .message-meta-external {
    align-items: flex-start;
}

.message-sender {
    font-size: 12px;
    color: #3C3C3C !important;
    font-weight: 500;
    margin-bottom: 2px;
    padding: 0 2px;
}


.message-wrapper .delete-btn {
    position: absolute;
    top: 4px;
    right: 4px;
    background: rgba(255, 0, 0, 0.3);
    border: none;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s, background 0.2s;
    z-index: 10;
}

.message-wrapper:hover .delete-btn {
    opacity: 1;
}

.message-wrapper .delete-btn:hover {
    background: rgba(255, 0, 0, 0.5);
}

.message-wrapper.pending-wrapper {
    background: rgba(255, 165, 0, 0.05);
    border-radius: 12px;
    padding: 4px;
    margin: 8px 0;
}

.message.pending {
    background: var(--pending-bg);
    border: 2px solid #FFB300;
    border-left: 4px solid #FFB300;
}

.message-wrapper.highlight-message {
    animation: highlightPulse 2s ease-out;
}

@keyframes highlightPulse {
    0% {
        background: rgba(66, 153, 225, 0.4);
        transform: scale(1.02);
    }

    50% {
        background: rgba(66, 153, 225, 0.2);
    }

    100% {
        background: transparent;
        transform: scale(1);
    }
}

.message-wrapper.user-message .message {
    background: linear-gradient(135deg, #FEE500 0%, #F5D900 100%);
    border-left: 3px solid #E5C800;
}

.message-wrapper.user-message .message::before {
    content: '👤';
    position: absolute;
    top: -8px;
    left: -8px;
    font-size: 14px;
    background: #FEE500;
    border-radius: 50%;
    padding: 2px 4px;
}

.message-actions {
    display: flex;
    gap: 8px;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
}

.btn-approve,
.btn-reject {
    flex: 1;
    padding: 6px 12px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s;
}

.btn-approve {
    background: #4caf50;
    color: white;
}

.btn-approve:hover {
    background: #45a049;
    transform: translateY(-1px);
}

.btn-reject {
    background: #f44336;
    color: white;
}

.btn-reject:hover {
    background: #da190b;
    transform: translateY(-1px);
}

/* Removed duplicate .message-sender rule that was overriding color to yellow */

.message-content {
    font-size: 14px;
    line-height: 1.4;
    color: var(--text-color);
    white-space: pre-wrap;
}

.message-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 4px;
    gap: 8px;
}

.read-indicator-outer {
    display: flex;
    align-items: flex-end;
    flex-shrink: 0;
    padding-bottom: 4px;
}

.read-indicator {
    font-size: 11px;
    color: #E5C800;
    font-weight: 600;
    line-height: 1;
}

.message-time {
    font-size: 11px;
    color: var(--text-secondary);
}

/* ═══════════════════════════════════════════════════════
   카카오톡 스타일 버블 하단 reaction pill (일반 메시지)
   ═══════════════════════════════════════════════════════ */

/* 버블 아래 reaction 영역 wrapper — reaction이 없을 때는 높이 0 */
.bubble-reaction-wrap {
    display: flex;
    align-items: center;
    gap: 4px;
    /* min-height 없음: reaction이 0이면 높이 0, pill/버튼이 생기면 자동으로 공간 생김 */
}

.bubble-reaction-wrap.out {
    justify-content: flex-end;
    padding-right: 4px;
}

.bubble-reaction-wrap.in {
    justify-content: flex-start;
    padding-left: 4px;
}

/* reaction 카운트 wrap — 개별 pill 들의 flex 컨테이너 (배경 없음) */
.bubble-reaction-pill {
    display: flex;
    align-items: center;
    gap: 5px;
    background: none;
    padding: 0;
    border-radius: 0;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    cursor: default;
}

/* 각 타입별 개별 pill */
.bubble-reaction-pill .reaction-count {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 3px 9px 3px 7px;
    border-radius: 14px;
    background: rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    font-size: 12px;
    font-weight: 500;
    color: #ffffff;
    cursor: pointer;
    transition: background 0.2s;
}

.bubble-reaction-pill .reaction-count:hover {
    background: rgba(0, 0, 0, 0.2);
}

/* 유저가 눌렀을 때: pill 배경만 light로 변경 (카카오톡 방식) — 텍스트 색은 어두운 색으로 대비 유지 */
.bubble-reaction-pill .reaction-count.user-reacted {
    background: rgba(255, 255, 255, 0.4);
    color: #222222;
}

.bubble-reaction-pill .reaction-count.user-reacted:hover {
    background: rgba(255, 255, 255, 0.4);
}


/* reaction 버튼 (hover/long-press 시 표시) — 이미지 reaction과 동일한 다크 스타일 */
.bubble-reaction-buttons {
    display: none;
    gap: 4px;
    padding: 3px 6px;
    border-radius: 14px;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

/* reaction 버튼 표시: long-press로만 (show-reactions 클래스로 제어) */
.message-wrapper.show-reactions .bubble-reaction-buttons {
    display: flex;

}

/* ── legacy .message-reactions (이미지 overlay 등 fallback) ── */
.message-reactions {
    display: none;
    /* 더 이상 bubble 안에서 사용 안 함 */
}

.reaction-counts {
    display: flex;
    gap: 6px;
}

/* 이미지 overlay 안의 reaction-count는 별도 스타일로 override */
.reaction-count {
    font-size: 12px;
    padding: 2px 6px;
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.06);
    cursor: pointer;
    transition: background 0.2s;
}

.reaction-count:hover {
    background: rgba(0, 0, 0, 0.1);
}

.reaction-count.user-reacted {
    background: rgba(66, 153, 225, 0.15);
}

/* generic .reaction-buttons (이미지용 오버라이드는 .image-reaction-buttons로) */
.reaction-buttons {
    display: none;
    gap: 2px;
}

/* long-press로만 표시 (hover 트리거 제거) */
.message-wrapper.show-reactions .reaction-buttons {
    display: flex;
}


.reaction-btn {
    background: none;
    border: none;
    font-size: 14px;
    padding: 2px 4px;
    cursor: pointer;
    opacity: 0.6;
    transition: opacity 0.2s, transform 0.2s;
    border-radius: 4px;
}

.reaction-btn:hover {
    opacity: 1;
    transform: scale(1.2);
}

.reaction-btn.active {
    opacity: 1;
}

.reaction-btn svg {
    width: 16px;
    height: 16px;
    vertical-align: middle;
}

.reaction-count svg {
    width: 12px;
    height: 12px;
    vertical-align: text-top;
    margin-right: 2px;
}


.message-status {
    font-size: 10px;
    color: var(--text-secondary);
    margin-top: 4px;
    text-align: right;
    font-style: italic;
}

/* ═══════════════════════════════════════════════════════
   KakaoTalk-style PHOTO-only messages (no bubble)
   ═══════════════════════════════════════════════════════ */
.message-image-only {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    max-width: 88%;
    /* 텍스트 말풍선 최대너비와 동일 */
    display: block;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
    flex-shrink: 0;
}

.message-image-only.out {
    align-self: flex-end;
}

.message-image-only.in {
    align-self: flex-start;
}

.message-image-only .chat-image {
    display: block;
    width: 100%;
    /* 컨테이너 너비에 맞춤 */
    height: auto;
    /* 가로 비율에 맞게 세로 자동 조정 */
    min-width: 80px;
    border-radius: 12px;
    /* prevent onclick from triggering during long-press */
    user-select: none;
    -webkit-user-drag: none;
}

/* ── Reaction overlay base ── */
.image-reaction-overlay {
    position: absolute;
    bottom: 6px;
    pointer-events: auto;
    z-index: 2;
}

/* 다른 사람 메시지(in): 좌측 하단 */
.image-reaction-overlay.in {
    left: 8px;
}

/* 내 메시지(out): 우측 하단 */
.image-reaction-overlay.out {
    right: 8px;
}



.image-reaction-counts {
    display: flex;
    gap: 4px;
    align-items: center;
}

/* reaction count pill on image – white text over dark bg */
.image-reaction-overlay .reaction-count {
    font-size: 12px;
    padding: 3px 8px;
    border-radius: 14px;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    color: #ffffff;
    cursor: pointer;
    transition: background 0.2s;
    border: none;
}

.image-reaction-overlay .reaction-count:hover {
    background: rgba(0, 0, 0, 0.62);
}

.image-reaction-overlay .reaction-count.user-reacted {
    background: rgba(66, 153, 225, 0.65);
}

/* ── Reaction buttons for image messages (shown on hover/long-press) ── */
.image-reaction-buttons {
    display: none;
    position: absolute;
    bottom: 6px;
    left: 8px;
    gap: 4px;
    z-index: 3;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    border-radius: 14px;
    padding: 3px 6px;
}

/* long-press로만 표시 (hover 트리거 제거) */
.message-wrapper.show-reactions .image-reaction-buttons {
    display: flex;
}


.image-reaction-buttons .reaction-btn {
    background: none;
    border: none;
    font-size: 16px;
    padding: 2px 3px;
    cursor: pointer;
    opacity: 0.75;
    transition: opacity 0.2s, transform 0.2s;
    border-radius: 4px;
}

.image-reaction-buttons .reaction-btn:hover {
    opacity: 1;
    transform: scale(1.25);
}

.image-reaction-buttons .reaction-btn.active {
    opacity: 1;
}



.message-input-wrapper {
    background: #ffffff;
    padding: 10px 12px;
    padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
    display: flex;
    gap: 8px;
    align-items: flex-end;
    border-top: 1px solid #e5e7eb;
    box-shadow: 0 -4px 15px rgba(0, 0, 0, 0.05);
}

.input-container {
    flex: 1;
    position: relative;
}

/* KakaoTalk 스타일 둥근 회색 입력 영역 */
.kakao-input-container {
    background: #f5f5f5;
    border-radius: 24px;
    border: 1px solid #e5e7eb;
    overflow: hidden;
}

.input-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    cursor: text;
    display: none;
    z-index: 100;
    border-radius: 24px;
}

.input-overlay.active {
    display: block;
    pointer-events: auto;
}

#messageInput {
    width: 100%;
    box-sizing: border-box;
    padding: 11px 20px;
    border: none;
    border-radius: 24px;
    font-size: 16px;
    line-height: 1.5;
    font-family: inherit;
    resize: none;
    max-height: 144px;
    outline: none;
    background: transparent;
    color: #1f2937;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

#messageInput::-webkit-scrollbar {
    display: none;
}

#messageInput::placeholder {
    color: #9ca3af;
}

#messageInput:focus {
    border-color: transparent;
}

/* KakaoTalk + 버튼 (파일 첨부) */
.kakao-plus-btn {
    width: 38px;
    height: 38px;
    flex-shrink: 0;
    border-radius: 50%;
    background: transparent;
    color: #6b7280;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
    margin-bottom: 2px;
}

.kakao-plus-btn:hover {
    color: #374151;
}

#fileInput {
    display: none;
}

.voice-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: transparent;
    color: #6b7280;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
    flex-shrink: 0;
    margin-bottom: 2px;
}

.voice-btn:hover {
    color: #374151;
}

/* KakaoTalk 스타일 전송 버튼 (노란색 원 + 검정 화살표) */
.send-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: #fee500;
    color: #000000;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
    margin-bottom: 2px;
}

.send-btn:hover {
    background: #fada0a;
}

.voice-btn:active,
.send-btn:active {
    transform: scale(0.95);
}

.voice-btn.hidden,
.send-btn.hidden {
    display: none;
}

.voice-btn.recording {
    background: #e53935;
    color: white;
    animation: pulse-recording 1s ease-in-out infinite;
}

@keyframes pulse-recording {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
    }
}

.recording-indicator {
    display: none;
    align-items: center;
    gap: 8px;
    flex: 1;
    padding: 0 12px;
    color: #e53935;
    font-size: 14px;
}

.recording-indicator.active {
    display: flex;
}

.recording-dot {
    width: 10px;
    height: 10px;
    background: #e53935;
    border-radius: 50%;
    animation: blink 1s ease-in-out infinite;
}

@keyframes blink {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.3;
    }
}

.voice-sending-indicator {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-size: 14px;
    font-weight: 500;
    border-radius: 12px;
    margin: 8px 16px;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.voice-sending-indicator.active {
    display: flex;
}

.sending-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.optimistic-message {
    opacity: 0.85;
}

.optimistic-message .sending-indicator {
    color: var(--text-secondary);
    font-size: 12px;
    margin-left: 4px;
}

.message-failed {
    opacity: 0.6;
}

.message-failed .sending-indicator.failed {
    color: #e53935;
}

.recording-time {
    font-family: monospace;
    font-size: 16px;
}

.cancel-recording-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(229, 57, 53, 0.15);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #e53935;
    transition: all 0.2s ease;
    margin-right: 4px;
}

.cancel-recording-btn:hover {
    background: rgba(229, 57, 53, 0.3);
    transform: scale(1.05);
}

.cancel-recording-btn:active {
    transform: scale(0.95);
}

#messageInput.hidden {
    display: none;
}

.side-menu {
    position: fixed;
    top: 0;
    left: 0;
    width: 280px;
    height: 100vh;
    height: 100dvh;
    background: var(--bg-color);
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.2);
    z-index: 1000;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    will-change: transform;
}

.side-menu.open {
    transform: translateX(0);
}

.side-menu-header {
    background: var(--header-bg);
    color: var(--header-text);
    padding: 24px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.menu-avatar {
    width: 60px;
    height: 60px;
    object-fit: cover;
}

.menu-user-info {
    flex: 1;
}

.menu-display-name {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 4px;
}

.menu-username {
    font-size: 13px;
    opacity: 0.9;
    display: none;
}

.side-menu-content {
    padding: 8px 0;
}

.menu-item {
    width: 100%;
    padding: 14px 16px;
    background: none;
    border: none;
    text-align: left;
    font-size: 15px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 16px;
    color: var(--text-color);
    transition: background 0.2s;
}

.menu-item:hover {
    background: var(--hover-bg);
}

.menu-item.danger {
    color: #d32f2f;
}

.menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

.menu-overlay.show {
    opacity: 1;
    pointer-events: all;
}

.menu-section {
    margin-top: 8px;
    padding-top: 8px;
}

.menu-section-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.menu-divider {
    height: 1px;
    background: var(--border-color);
    margin: 8px 16px;
}

.room-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    cursor: pointer;
    transition: background 0.2s;
    border-left: 3px solid transparent;
}

.room-item:hover {
    background: rgba(254, 229, 0, 0.1);
}

.room-item.active {
    background: rgba(254, 229, 0, 0.15);
    border-left-color: var(--header-bg);
}

.room-icon {
    width: 40px;
    height: 40px;
    clip-path: url(#squircleClip);
    background: var(--primary-color);
    color: #333333;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.room-item span {
    font-size: 15px;
    color: var(--text-color);
    font-weight: 500;
}

.dm-list {
    max-height: 300px;
    overflow-y: auto;
}

.dm-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    cursor: pointer;
    transition: background 0.2s;
    border-left: 3px solid transparent;
}

.dm-item:hover {
    background: rgba(254, 229, 0, 0.1);
}

.dm-item.active {
    background: rgba(254, 229, 0, 0.15);
    border-left-color: var(--header-bg);
}

.dm-avatar {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
    color: white;
    flex-shrink: 0;
}

.dm-info {
    flex: 1;
    min-width: 0;
}

.dm-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-color);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dm-preview {
    font-size: 12px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 2px;
}

.dm-empty {
    padding: 12px 16px;
    font-size: 13px;
    color: var(--text-secondary);
    text-align: center;
}

.auth-screen {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--chat-bg);
    padding: 20px;
}

.auth-container {
    background: var(--bg-color);
    border-radius: 12px;
    padding: 32px 24px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
    position: relative;
}

.back-to-main-btn {
    position: absolute;
    top: 12px;
    left: 12px;
    background: transparent;
    border: none;
    color: #333333;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 8px 12px;
    border-radius: 8px;
    transition: background 0.2s;
}

.back-to-main-btn:hover {
    background: rgba(0, 0, 0, 0.05);
}

.back-to-main-btn svg {
    stroke: #333333;
}

.auth-logo {
    text-align: center;
    margin-bottom: 32px;
}

.auth-logo h1 {
    font-size: 64px;
    margin-bottom: 8px;
}

.auth-logo h2 {
    font-size: 24px;
    color: var(--text-color);
}

.auth-logo-img {
    max-width: 200px;
    max-height: 120px;
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
    margin: 0 auto;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.auth-form input {
    padding: 14px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 15px;
    font-family: inherit;
    outline: none;
    background: var(--input-bg);
    color: var(--text-color);
}

.auth-form input::placeholder {
    color: var(--text-secondary);
}

.auth-form input:focus {
    border-color: var(--primary-color);
}

.auth-btn {
    padding: 14px;
    background: var(--primary-color);
    color: #333333;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.auth-btn:hover {
    background: var(--secondary-color);
}

.auth-switch {
    text-align: center;
    margin-top: 16px;
    font-size: 14px;
    color: var(--text-secondary);
}

.auth-switch a {
    color: #333333;
    text-decoration: none;
    font-weight: 600;
}

.auth-error {
    background: #FFEBEE;
    color: #D32F2F;
    padding: 12px;
    border-radius: 8px;
    margin-top: 12px;
    font-size: 14px;
}

.twofa-title {
    color: #333333;
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 8px;
    text-align: center;
}

.twofa-message {
    color: #666666;
    font-size: 14px;
    margin-bottom: 16px;
    text-align: center;
}

#twoFACode {
    text-align: center;
    font-size: 24px;
    letter-spacing: 8px;
    font-weight: 600;
}

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-content {
    background: var(--bg-color);
    border-radius: 12px;
    width: 100%;
    max-width: 600px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
}

.modal-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-size: 20px;
    color: var(--text-color);
}

.close-btn {
    background: none;
    border: none;
    font-size: 32px;
    cursor: pointer;
    color: var(--text-secondary);
    line-height: 1;
}

.modal-body {
    padding: 20px;
    overflow-y: auto;
}

.pending-messages {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 12px;
}

.pending-message-item {
    background: var(--input-bg);
    padding: 12px;
    border-radius: 8px;
    border-left: 3px solid var(--primary-color);
}

.pending-message-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.pending-message-sender {
    font-weight: 600;
    color: var(--primary-color);
}

.pending-message-time {
    font-size: 12px;
    color: var(--text-secondary);
}

.pending-message-content {
    margin-bottom: 12px;
    color: var(--text-color);
}

.pending-message-actions {
    display: flex;
    gap: 8px;
}

.btn-approve,
.btn-reject {
    flex: 1;
    padding: 8px;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s;
}

.btn-approve {
    background: #4caf50;
    color: white;
}

.btn-reject {
    background: #f44336;
    color: white;
}

.btn-approve:hover,
.btn-reject:hover {
    opacity: 0.9;
}

.profile-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.profile-image-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.profile-preview {
    width: 120px;
    height: 120px;
    clip-path: url(#squircleClip);
    object-fit: cover;
    overflow: hidden;
}

.profile-form input,
.profile-form textarea {
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 15px;
    font-family: inherit;
    outline: none;
    background: var(--input-bg);
    color: var(--text-color);
}

.profile-form input::placeholder,
.profile-form textarea::placeholder {
    color: var(--text-secondary);
}

.profile-form input:focus,
.profile-form textarea:focus {
    border-color: var(--primary-color);
}

.btn-primary,
.btn-secondary {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s;
}

.btn-primary {
    background: var(--primary-color);
    color: #000;
}

.btn-secondary {
    background: var(--input-bg);
    color: var(--text-color);
    border: 1px solid var(--border-color);
}

.btn-primary:hover,
.btn-secondary:hover {
    opacity: 0.9;
}

.user-info-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    padding: 20px 0;
}

.user-info-avatar-section {
    display: flex;
    justify-content: center;
}

.user-info-avatar {
    width: 120px;
    height: 120px;
    object-fit: cover;
    border: none;
}

img.user-info-avatar {
    clip-path: url(#squircleClip);
}

.user-info-avatar.avatar-initials {
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 500;
    font-size: 48px;
    text-transform: uppercase;
}

.user-info-name {
    font-size: 24px;
    font-weight: 600;
    margin: 0 0 16px 0;
    color: var(--text-color);
}

.send-message-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 24px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    margin-top: 8px;
}

.send-message-btn:hover {
    background: var(--secondary-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    white-space: pre-wrap;
}

.fullscreen-profile {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(178, 199, 217, 0.60);
    /* Matches chat background #B2C7D9 with transparency */
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.fullscreen-profile.hidden {
    display: none;
}

.fullscreen-profile-header {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    background: transparent;
    border-bottom: none;
    /* Removed border to match seamless header style */
    flex-shrink: 0;
}

.back-btn {
    background: transparent;
    border: none;
    color: var(--text-color);
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.back-btn:hover {
    background: var(--bg-tertiary);
}

.fullscreen-profile-content {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.profile-top-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 24px 16px;
    background: transparent;
}

.profile-avatar-large {
    width: 80px;
    height: 80px;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    font-weight: 600;
    background: var(--bg-tertiary);
}

.profile-avatar-large img {
    clip-path: url(#squircleClip);
}

.profile-avatar-large img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.profile-display-name {
    font-size: 18px;
    font-weight: 600;
    margin: 12px 0 0 0;
    color: var(--text-color);
}

.profile-message-btn {
    background: var(--primary-color);
    color: #333333;
    border: none;
    padding: 8px 20px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    margin-top: 12px;
    transition: all 0.2s;
}

.profile-message-btn:hover {
    background: var(--secondary-color);
}

.profile-posts-section {
    padding: 16px 0 0 0;
}

.profile-posts-title {
    font-size: 14px;
    font-weight: 600;
    color: #333333;
    margin: 0 0 12px 0;
    padding-left: 16px;
}

.profile-media-title {
    font-size: 14px;
    font-weight: 600;
    color: #333333;
    margin: 0 0 12px 0;
    padding-left: 16px;
}

.profile-posts-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2px;
}

.profile-posts-grid .post-item {
    aspect-ratio: 1;
    border-radius: 0;
}

.profile-posts-grid .post-item.selected {
    outline: 3px solid var(--primary-color);
    outline-offset: -3px;
}

.profile-posts-grid .post-item img {
    border-radius: 0;
}

.profile-post-expansion {
    background: var(--bg-primary);
    border-radius: 0;
    margin-top: 4px;
    overflow: hidden;
    position: relative;
    max-height: 0;
    opacity: 0;
    transition: max-height 0.4s ease, opacity 0.3s ease, margin 0.3s ease;
    grid-column: 1 / -1 !important;
    width: 100% !important;
}

.profile-post-expansion.active {
    max-height: none;
    opacity: 1;
    margin-top: 2px;
    margin-bottom: 8px;
    display: block !important;
}

.profile-post-expansion.hidden {
    display: none;
}

.expansion-pointer {
    position: absolute;
    top: -8px;
    left: 50px;
    width: 16px;
    height: 16px;
    background: var(--bg-secondary);
    transform: rotate(45deg);
    transition: left 0.2s ease;
}

.expansion-close-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 32px;
    height: 32px;
    border: none;
    background: rgba(0, 0, 0, 0.5);
    color: white;
    font-size: 20px;
    border-radius: 50%;
    cursor: pointer;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
}

.expansion-content {
    display: flex;
    flex-direction: column;
}

.expansion-media {
    width: 100%;
    min-height: 200px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
}

.expansion-media img,
.expansion-media video {
    width: 100%;
    min-height: 200px;
    max-height: 60vh;
    object-fit: contain;
}

.expansion-details {
    padding: 12px;
}

.expansion-caption {
    font-size: 14px;
    line-height: 1.5;
    margin-bottom: 8px;
    white-space: pre-wrap;
    word-break: break-word;
    color: var(--text-color);
}

.expansion-meta {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.expansion-actions {
    margin-bottom: 12px;
}

.expansion-like-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: var(--bg-tertiary);
    border: none;
    border-radius: 20px;
    cursor: pointer;
    font-size: 14px;
    color: var(--text-color);
    transition: background 0.2s;
}

.expansion-like-btn:hover {
    background: var(--bg-color);
}

.expansion-like-btn.liked .like-icon {
    transform: scale(1.2);
}


@media (min-width: 768px) {
    .fullscreen-profile-content {
        max-width: 600px;
        margin: 0 auto;
    }

    .profile-posts-section {
        padding: 16px;
    }

    .profile-posts-grid {
        gap: 4px;
    }

    .profile-posts-grid .post-item {
        border-radius: 4px;
    }

    .profile-posts-grid .post-item img {
        border-radius: 4px;
    }
}

.text-only-post {
    background: var(--bg-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
}

.text-post-indicator {
    font-size: 24px;
}

.post-item {
    position: relative;
    aspect-ratio: 1;
    overflow: hidden;
    cursor: pointer;
    background: var(--bg-secondary);
}

.post-item.skeleton {
    background: linear-gradient(90deg, var(--bg-secondary) 25%, var(--bg-tertiary) 50%, var(--bg-secondary) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

.post-item.skeleton-item {
    position: relative;
    overflow: hidden;
    background: var(--bg-tertiary);
    border-radius: 4px;
}

.skeleton-shimmer {
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg,
            rgba(255, 255, 255, 0) 0%,
            rgba(255, 255, 255, 0.08) 50%,
            rgba(255, 255, 255, 0) 100%);
    background-size: 200% 100%;
    animation: shimmer 1.2s ease-in-out infinite;
}

@keyframes shimmer {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

.post-img-placeholder {
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, var(--bg-secondary) 25%, var(--bg-tertiary) 50%, var(--bg-secondary) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

.post-item img,
.post-item video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.2s ease, opacity 0.3s ease;
    opacity: 0;
}

.post-item img.loaded,
.post-item video.loaded {
    opacity: 1;
}

.post-item:hover img,
.post-item:hover video {
    transform: scale(1.05);
}

.post-video-indicator {
    position: absolute;
    top: 6px;
    right: 6px;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 4px;
}

.message-wrapper.highlight,
.feed-post.highlight {
    animation: highlightMessage 2s ease-out;
}

@keyframes highlightMessage {

    0%,
    30% {
        background: rgba(78, 148, 254, 0.3);
    }

    100% {
        background: transparent;
    }
}

@media (max-width: 768px) {
    .message {
        max-width: 85%;
    }

    .modal-content {
        max-height: 90vh;
    }
}

@media (max-width: 480px) {
    .chat-container {
        padding: 12px;
    }

    .message {
        max-width: 90%;
    }
}

.scroll-to-bottom-btn {
    position: fixed;
    bottom: 80px;
    right: 14px;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.95);
    border: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #333333;
    transition: all 0.3s ease;
    z-index: 1001;
    padding: 0;
}

.scroll-to-bottom-btn:hover {
    background: #FFFFFF;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.scroll-to-bottom-btn:active {
    transform: translateY(0);
}

.scroll-to-bottom-btn.hidden {
    opacity: 0;
    pointer-events: none;
    transform: translateY(10px);
}

.new-message-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: var(--primary-color);
    color: white;
    border-radius: 12px;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    font-size: 12px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.new-message-badge.hidden {
    display: none;
}

.menu-unread-dot {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--primary-color);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    display: block;
}

.menu-unread-dot.hidden {
    display: none !important;
}

.notification-alert-dot-header {
    position: absolute;
    top: 4px;
    left: 4px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #ff3b3b;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    display: block;
}

.notification-alert-dot-header.hidden {
    display: none !important;
}

.notification-alert-dot-menu {
    width: 10px;
    height: 10px;
    min-width: 10px;
    border-radius: 50%;
    background: #ff3b3b;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    margin-left: auto;
    align-self: center;
}

.notification-alert-dot-menu.hidden {
    display: none;
}

.dm-unread-dot {
    width: 10px;
    height: 10px;
    min-width: 10px;
    border-radius: 50%;
    background: var(--primary-color);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    margin-left: auto;
    align-self: center;
}

.dm-unread-dot.hidden {
    display: none;
}

.lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 3000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
}

.lightbox-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 44px;
    height: 44px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 28px;
    cursor: pointer;
    z-index: 3001;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.lightbox-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

.lightbox-content {
    position: relative;
    max-width: 95vw;
    max-height: 95vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-media {
    max-width: 95vw;
    max-height: 95vh;
    object-fit: contain;
    border-radius: 4px;
}

.lightbox-media.hidden {
    display: none;
}

.message-media {
    cursor: pointer;
    transition: opacity 0.2s;
}

.message-media:hover {
    opacity: 0.9;
}

/* Video Container Styles */
.message-media.video-container {
    position: relative;
    display: inline-block;
}

.message-media.video-container video {
    display: block;
    min-height: 120px;
    background: #e0e0e0;
}

.video-play-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 2;
}

.video-play-overlay svg {
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

.message-media.video-container:hover .video-play-overlay svg circle {
    fill: rgba(0, 0, 0, 0.7);
}

/* Voice Message Styles - Telegram Style */
.voice-message {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    min-width: 200px;
    max-width: 280px;
    background: transparent;
    border-radius: 8px;
    margin-bottom: 4px;
}

.voice-play-btn {
    width: 42px;
    height: 42px;
    min-width: 42px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.1);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #333;
    transition: all 0.2s ease;
}

.voice-play-btn:hover {
    background: rgba(0, 0, 0, 0.15);
    transform: scale(1.05);
}

.voice-play-btn:active {
    transform: scale(0.95);
}

.voice-message.playing .voice-play-btn {
    background: rgba(0, 0, 0, 0.15);
}

.voice-play-btn svg {
    width: 20px;
    height: 20px;
}

.voice-waveform {
    flex: 1;
    height: 32px;
    position: relative;
    display: flex;
    align-items: center;
    overflow: hidden;
}

.waveform-bars {
    display: flex;
    align-items: center;
    gap: 2px;
    height: 100%;
    width: 100%;
}

.waveform-bar {
    width: 3px;
    min-width: 3px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 2px;
    transition: background 0.1s;
}

.waveform-progress {
    display: none;
}

.voice-message.playing .waveform-bar {
    animation: waveform-pulse 0.5s ease-in-out infinite;
}

.voice-message.playing .waveform-bar:nth-child(odd) {
    animation-delay: 0.1s;
}

.voice-message.playing .waveform-bar:nth-child(3n) {
    animation-delay: 0.2s;
}

@keyframes waveform-pulse {

    0%,
    100% {
        opacity: 0.4;
    }

    50% {
        opacity: 1;
    }
}

.voice-duration {
    font-size: 12px;
    color: rgba(0, 0, 0, 0.5);
    min-width: 36px;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

/* Incoming message voice style */
.message.in .voice-message {
    background: transparent;
}

.message.in .voice-play-btn {
    background: rgba(0, 0, 0, 0.08);
}

.message.in .waveform-bar {
    background: rgba(0, 0, 0, 0.25);
}

.message.in .voice-duration {
    color: rgba(0, 0, 0, 0.45);
}

/* Outgoing message voice style */
.message.out .voice-message {
    background: transparent;
}

.message.out .voice-play-btn {
    background: rgba(0, 0, 0, 0.08);
}

.message.out .waveform-bar {
    background: rgba(0, 0, 0, 0.3);
}

.message.out .voice-duration {
    color: rgba(0, 0, 0, 0.5);
}

/* Feed Styles */
.feed-container {
    flex: 1;
    overflow-y: auto;
    background: var(--chat-bg);
    padding: 0;
}

.feed-posts {
    max-width: 600px;
    margin: 0 auto;
    padding: 16px;
}

.feed-post {
    background: var(--message-in);
    border-radius: 12px;
    margin-bottom: 16px;
    overflow: hidden;
}

.feed-post-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
}

.feed-post-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    cursor: pointer;
}

.feed-post-avatar.avatar-initials {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 500;
    color: white;
}

.feed-post-author {
    flex: 1;
}

.feed-post-author-name {
    font-weight: 600;
    color: var(--text-color);
    font-size: 14px;
    cursor: pointer;
}

.feed-post-author-name:hover {
    text-decoration: underline;
}

.feed-post-time {
    font-size: 12px;
    color: var(--text-secondary);
}

.feed-post-media {
    width: 100%;
    max-height: 600px;
    object-fit: contain;
    background: #000;
}

.feed-post-media video {
    width: 100%;
    max-height: 600px;
}

.feed-post-actions {
    display: flex;
    gap: 16px;
    padding: 12px 16px;
    border-top: 1px solid var(--border-color);
}

.feed-action-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 14px;
    padding: 8px 12px;
    border-radius: 8px;
    transition: all 0.2s;
}

.feed-action-btn:hover {
    background: rgba(0, 0, 0, 0.05);
}

.feed-action-btn.liked {
    color: #ff4757;
}

.feed-action-btn.liked svg {
    fill: #ff4757;
}

.feed-post-caption {
    padding: 0 16px 12px;
    color: var(--text-color);
    font-size: 14px;
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-word;
}

.feed-post-caption .author-name {
    font-weight: 600;
    margin-right: 6px;
}

.create-post-fab {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--primary-color);
    color: white;
    border: none;
    box-shadow: 0 4px 12px rgba(0, 136, 204, 0.4);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    z-index: 50;
}

.create-post-fab:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(0, 136, 204, 0.5);
}

.feed-loading {
    display: flex;
    justify-content: center;
    padding: 20px;
}

.post-media-preview {
    position: relative;
    margin-bottom: 12px;
    border-radius: 8px;
    overflow: hidden;
    background: #000;
}

.post-media-preview img,
.post-media-preview video {
    width: 100%;
    max-height: 400px;
    object-fit: contain;
}

.remove-media-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    border: none;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.post-media-upload {
    margin-bottom: 12px;
}

.select-media-btn {
    width: 100%;
    padding: 40px;
    border: 2px dashed var(--border-color);
    border-radius: 12px;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    transition: all 0.2s;
}

.select-media-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

#postCaption {
    width: 100%;
    background: var(--input-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px;
    color: var(--text-color);
    font-size: 14px;
    resize: none;
}

.comments-modal-content {
    max-width: 500px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
}

.comments-list {
    flex: 1;
    overflow-y: auto;
    padding: 12px 0;
    min-height: 200px;
    max-height: 400px;
}

.comment-item {
    display: flex;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
}

.comment-item:last-child {
    border-bottom: none;
}

.comment-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    flex-shrink: 0;
}

.comment-content {
    flex: 1;
}

.comment-author {
    font-weight: 600;
    font-size: 13px;
    color: var(--text-color);
    margin-bottom: 2px;
}

.comment-text {
    font-size: 14px;
    color: var(--text-color);
    line-height: 1.4;
}

.comment-time {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 4px;
}

.comment-input-wrapper {
    display: flex;
    gap: 8px;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
}

.comment-input-wrapper input {
    flex: 1;
    background: var(--input-bg);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 10px 16px;
    color: var(--text-color);
    font-size: 14px;
}

.comment-input-wrapper button {
    background: var(--primary-color);
    color: #333333;
    border: none;
    padding: 10px 20px;
    border-radius: 20px;
    font-weight: 500;
    cursor: pointer;
}

.comment-input-wrapper button:hover {
    background: var(--secondary-color);
}

.no-posts-message {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.no-posts-message svg {
    opacity: 0.3;
    margin-bottom: 16px;
}

.no-posts-message p {
    font-size: 16px;
}

/* Posts Stories Modal */
.posts-stories-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(178, 199, 217, 0.92);
    z-index: 1000;
    display: flex;
    flex-direction: column;
}

.posts-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    position: relative;
    z-index: 10;
}

.posts-close-btn {
    background: rgba(0, 0, 0, 0.08);
    border: none;
    color: #333333;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.posts-close-btn:hover {
    background: rgba(0, 0, 0, 0.15);
}

.posts-modal-title {
    color: #333333;
    font-size: 16px;
    font-weight: 600;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}

.posts-new-btn {
    background: var(--primary-color);
    color: #333333;
    border: none;
    padding: 10px 20px;
    border-radius: 20px;
    font-weight: 500;
    cursor: pointer;
    font-size: 14px;
}

.posts-new-btn:hover {
    background: var(--secondary-color);
}

.posts-stories-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 60px;
    position: relative;
}

.posts-nav-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.08);
    border: none;
    color: #333333;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.posts-nav-btn:hover {
    background: rgba(0, 0, 0, 0.15);
}

.posts-nav-btn.prev {
    left: 10px;
}

.posts-nav-btn.next {
    right: 10px;
}

.posts-content {
    max-width: 500px;
    width: 100%;
    max-height: calc(100vh - 120px);
    display: flex;
    align-items: center;
    justify-content: center;
}

.posts-loading,
.posts-empty {
    color: var(--text-secondary);
    text-align: center;
    padding: 40px;
}

.post-story-card {
    background: var(--bg-secondary);
    border-radius: 16px;
    overflow: hidden;
    width: 100%;
    max-height: calc(100vh - 140px);
    display: flex;
    flex-direction: column;
}

.post-story-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
}

.post-story-time {
    color: #333333;
    font-size: 14px;
}

.post-story-header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.post-story-counter {
    color: #333333;
    font-size: 14px;
}

.post-delete-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
}

.post-delete-btn:hover {
    color: #ff375f;
}

.post-like-display {
    display: flex;
    align-items: center;
    gap: 6px;
    color: #ff375f;
    font-size: 14px;
}

.post-story-author {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

.post-author-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
}

.post-author-info {
    display: flex;
    flex-direction: column;
}

.post-author-name {
    font-weight: 600;
    font-size: 14px;
    color: var(--text-color);
}

.post-time {
    font-size: 12px;
    color: var(--text-secondary);
}

.post-story-counter {
    font-size: 13px;
    color: #333333;
    background: rgba(255, 255, 255, 0.1);
    padding: 4px 12px;
    border-radius: 12px;
}

.post-story-media {
    width: 100%;
    max-height: 60vh;
    object-fit: contain;
    background: #000;
}

.post-story-caption {
    padding: 16px;
    color: var(--text-color);
    font-size: 15px;
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 120px;
    overflow-y: auto;
}

.post-story-actions {
    padding: 12px 16px;
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
}

.post-like-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background: none;
    border: none;
    color: #333333;
    cursor: pointer;
    font-size: 15px;
    padding: 8px 16px;
    border-radius: 20px;
    transition: all 0.15s ease;
}

.post-like-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.post-like-btn.liked {
    color: #ff3b5c;
}

.post-like-btn .like-icon {
    display: flex;
    align-items: center;
    justify-content: center;
}

.post-like-btn .like-icon svg {
    transition: all 0.15s ease;
}

.post-like-btn:active .like-icon svg {
    transform: scale(1.2);
}

@media (max-width: 600px) {
    .posts-stories-container {
        padding: 0 20px;
    }

    .posts-nav-btn {
        width: 36px;
        height: 36px;
    }

    .posts-nav-btn.prev {
        left: 4px;
    }

    .posts-nav-btn.next {
        right: 4px;
    }
}


/* Link Preview Cards */
.link-previews {
    margin-top: 8px;
}

.link-preview-card {
    display: block;
    background: rgba(0, 0, 0, 0.03);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    margin-top: 8px;
    transition: background 0.2s ease;
}

.link-preview-card:hover {
    background: rgba(0, 0, 0, 0.06);
}

.link-preview-image {
    width: 100%;
    max-height: 180px;
    overflow: hidden;
    background: #e0e0e0;
}

.link-preview-image img {
    width: 100%;
    height: auto;
    object-fit: cover;
    display: block;
}

.link-preview-content {
    padding: 10px 12px;
}

.link-preview-site {
    font-size: 11px;
    color: var(--text-secondary);
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.link-preview-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-color);
    line-height: 1.3;
    margin-bottom: 4px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.link-preview-desc {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

@media (max-width: 600px) {
    .link-preview-image {
        max-height: 140px;
    }

    .link-preview-title {
        font-size: 13px;
    }

    .link-preview-desc {
        font-size: 11px;
    }
}

/* PWA Install Button */
.pwa-install-btn {
    position: fixed;
    top: 70px;
    right: 20px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(128, 128, 128, 0.6);
    border: none;
    color: white;
    cursor: pointer;
    z-index: 99;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    transition: transform 0.2s, background 0.2s;
    animation: pulse-ring-gray 2s ease-in-out infinite;
}

@keyframes pulse-ring-gray {
    0% {
        box-shadow: 0 0 0 0 rgba(128, 128, 128, 0.6);
    }

    50% {
        box-shadow: 0 0 0 12px rgba(128, 128, 128, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(128, 128, 128, 0);
    }
}

.pwa-install-btn:hover {
    transform: scale(1.1);
    background: rgba(128, 128, 128, 0.8);
}

.pwa-install-btn:active {
    transform: scale(0.95);
}

.pwa-install-btn svg {
    width: 24px;
    height: 24px;
}

/* Open in Browser Button */
.open-browser-btn {
    position: fixed;
    top: 70px;
    right: 16px;
    height: 40px;
    padding: 0 14px;
    border-radius: 20px;
    background: rgba(76, 175, 80, 0.9);
    border: none;
    color: white;
    cursor: pointer;
    z-index: 99;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    transition: transform 0.2s, background 0.2s;
    font-size: 13px;
    font-weight: 500;
    animation: pulse-ring-green 2s ease-in-out infinite;
}

@keyframes pulse-ring-green {
    0% {
        box-shadow: 0 0 0 0 rgba(76, 175, 80, 0.6);
    }

    50% {
        box-shadow: 0 0 0 12px rgba(76, 175, 80, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(76, 175, 80, 0);
    }
}

.open-browser-btn:hover {
    transform: scale(1.05);
    background: rgba(76, 175, 80, 1);
}

.open-browser-btn:active {
    transform: scale(0.95);
}

.open-browser-btn svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.open-browser-btn.hidden {
    display: none;
}

/* Notification Button in Menu */
#notificationBtn.notification-enabled {
    color: #4ade80;
}

#notificationBtn.notification-enabled svg {
    stroke: #4ade80;
}

/* In-App Browser Modal */
.inapp-browser-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: 20px;
}

.inapp-browser-content {
    background: var(--bg-color, #FFFFFF);
    border-radius: 16px;
    padding: 30px 24px;
    max-width: 340px;
    width: 100%;
    text-align: center;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.inapp-browser-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.inapp-browser-content h3 {
    color: #333;
    font-size: 20px;
    margin: 0 0 12px 0;
}

.inapp-browser-content p {
    color: #666;
    font-size: 14px;
    line-height: 1.5;
    margin: 0 0 20px 0;
}

.inapp-browser-steps {
    background: rgba(0, 0, 0, 0.04);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 20px;
}

.inapp-browser-steps .step {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #333;
    font-size: 14px;
    text-align: left;
}

.inapp-browser-steps .step+.step {
    margin-top: 12px;
}

.inapp-browser-steps .step-num {
    background: #3b82f6;
    color: #fff;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    flex-shrink: 0;
}

.inapp-browser-close {
    background: transparent;
    border: 1px solid rgba(0, 0, 0, 0.15);
    color: #666;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.inapp-browser-close:hover {
    background: rgba(0, 0, 0, 0.05);
    color: #333;
}

/* PWA Install Popup Modal */
.pwa-install-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: 20px;
    animation: fadeIn 0.2s ease;
}

.pwa-install-content {
    background: var(--bg-color, #FFFFFF);
    border-radius: 16px;
    padding: 30px 24px;
    max-width: 340px;
    width: 100%;
    text-align: center;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.pwa-install-icon {
    font-size: 56px;
    margin-bottom: 16px;
    filter: drop-shadow(0 2px 8px rgba(255, 215, 0, 0.4));
}

.pwa-install-icon-img {
    width: 72px;
    height: 72px;
    margin-bottom: 12px;
    object-fit: contain;
}

.pwa-btn-icon {
    width: 28px;
    height: 28px;
    object-fit: contain;
}

.pwa-install-content h3 {
    color: #3C3C3C;
    font-size: 18px;
    margin: 0 0 12px 0;
    font-weight: 600;
}

.pwa-install-description {
    color: #666;
    font-size: 14px;
    line-height: 1.6;
    margin: 0 0 24px 0;
}

.pwa-install-description strong {
    color: #333;
}

.pwa-install-confirm-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    background: linear-gradient(135deg, #2b9348 0%, #1e7a34 100%);
    color: white;
    border: none;
    padding: 14px 20px;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 12px;
}

.pwa-install-confirm-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(43, 147, 72, 0.4);
}

.pwa-install-confirm-btn:active {
    transform: translateY(0);
}

.pwa-install-confirm-btn svg {
    stroke: white;
}

.pwa-install-close-btn {
    background: transparent;
    border: none;
    color: #999;
    padding: 12px 24px;
    font-size: 14px;
    cursor: pointer;
    transition: color 0.2s;
}

.pwa-install-close-btn:hover {
    color: #333;
}

.pwa-notification-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
    border: none;
    padding: 14px 20px;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 10px;
}

.pwa-notification-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(245, 158, 11, 0.4);
}

.pwa-notification-btn:active {
    transform: translateY(0);
}

.pwa-notification-btn svg {
    stroke: white;
}

.pwa-notification-btn.completed {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    cursor: default;
}

.pwa-notification-btn.completed:hover {
    transform: none;
    box-shadow: none;
}

.pwa-notification-btn.denied {
    background: linear-gradient(135deg, #6b7280 0%, #4b5563 100%);
    cursor: default;
}

.pwa-notification-btn.denied:hover {
    transform: none;
    box-shadow: none;
}

/* Admin Delete Button */
.delete-btn {
    display: none;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid #ddd;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    padding: 0;
    cursor: pointer;
    font-size: 14px;
    line-height: 26px;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    z-index: 100;
}

.message-wrapper:hover .delete-btn {
    display: flex;
    align-items: center;
    justify-content: center;
}

.message-wrapper.out .delete-btn {
    left: -35px;
}

.message-wrapper.in .delete-btn {
    right: -35px;
}

.delete-btn:hover {
    background: #ffebee;
    border-color: #ffcdd2;
}

/* ─── 카카오 소셜 로그인 버튼 ─── */
.kakao-login-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 12px 16px;
    background: #FEE500;
    color: #191600;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
    font-family: inherit;
}

.kakao-login-btn:hover {
    background: #f5dc00;
    transform: translateY(-1px);
}

.kakao-login-btn:active {
    transform: translateY(0);
    background: #e6cf00;
}

.kakao-login-btn svg {
    flex-shrink: 0;
}

/* 로그인/회원가입 구분선 "또는" */
.auth-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 4px 0;
    color: var(--text-secondary, #888);
    font-size: 13px;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border-color, rgba(255, 255, 255, 0.1));
}

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   이미지+텍스트 혼합 메시지 — Telegram/KakaoTalk 스타일
   이미지(top) + 텍스트버블(bottom) 을 붙여서 하나처럼 보이게
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
.msg-photo-text-wrap {
    display: flex;
    flex-direction: column;
    max-width: 88%;
    /* 일반 .message와 동일한 최대 너비 */
    margin-bottom: 2px;
}

.msg-photo-text-wrap.out {
    align-self: flex-end;
    align-items: flex-end;
}

.msg-photo-text-wrap.in {
    align-self: flex-start;
    align-items: flex-start;
}

/* 이미지 블록 — wrap 100% 채움, 위쪽 radius만 */
.msg-photo-text-img {
    width: 100%;
    cursor: pointer;
    overflow: hidden;
    border-radius: 12px 12px 0 0;
    line-height: 0;
}

.msg-photo-text-img img {
    width: 100%;
    height: auto;
    display: block;
    object-fit: cover;
}

/* 텍스트 버블 — wrap 100% 채움, 아래쪽 radius만 */
.msg-photo-text-bubble {
    width: 100%;
    padding: 8px 14px 6px;
    font-size: 14px;
    line-height: 1.5;
    word-break: break-word;
    position: relative;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

.msg-photo-text-bubble.in {
    background: var(--message-in);
    color: #333333;
    border-radius: 0 0 12px 12px;
}

.msg-photo-text-bubble.out {
    background: var(--message-out);
    color: #333333;
    border-radius: 0 0 12px 12px;
}

/* 시간 — 버블 안 우하단 */
.msg-photo-text-bubble .message-time-inline {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 4px;
    margin-top: 2px;
    font-size: 11px;
    opacity: 0.7;
}

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   파일 첨부 미리보기 바
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
.file-preview-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 16px;
    background: rgba(245, 247, 250, 0.95);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-top: 1px solid rgba(0, 0, 0, 0.08);
    z-index: 999;
    animation: slideUpPreview 0.2s ease;
}

@keyframes slideUpPreview {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.file-preview-content {
    display: flex;
    align-items: center;
    gap: 10px;
    overflow: hidden;
    flex: 1;
    min-width: 0;
}

.file-preview-thumb {
    width: 40px;
    height: 40px;
    border-radius: 6px;
    object-fit: cover;
    border: 1px solid rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
}

.file-preview-name {
    font-size: 13px;
    color: #555;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-preview-cancel {
    background: none;
    border: none;
    padding: 6px;
    cursor: pointer;
    color: #888;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.15s, color 0.15s;
}

.file-preview-cancel:hover {
    background: rgba(0, 0, 0, 0.08);
    color: #333;
}

.file-preview-cancel:active {
    background: rgba(0, 0, 0, 0.12);
}

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   매너 채팅 OFF 오버레이  
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
.chatting-off-overlay {
    position: fixed;
    bottom: calc(env(safe-area-inset-bottom, 0px) + 20px);
    left: 0;
    right: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    background: transparent;
    z-index: 1000;
    pointer-events: none;
    animation: chattingOffFadeIn 0.3s ease;
}

@keyframes chattingOffFadeIn {
    from {
        opacity: 0;
        transform: translateY(12px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.chatting-off-content {
    pointer-events: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    width: 85%;
    max-width: 420px;
    background: rgba(220, 230, 240, 0.4);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 30px;
    padding: 14px 24px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
    text-align: center;
}

.chatting-off-icon {
    display: none;
}

.chatting-off-text {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.chatting-off-title {
    font-size: 12px;
    font-weight: 500;
    color: #4a5568;
    letter-spacing: -0.2px;
    white-space: nowrap;
}

.chatting-off-sub {
    font-size: 11px;
    color: #6b7d8e;
    letter-spacing: -0.2px;
    white-space: nowrap;
}

.chatting-off-sub-info {
    font-size: 9.5px;
    color: #8a9bb0;
    margin-top: 8px;
    letter-spacing: -0.2px;
    white-space: nowrap;
}

@media (max-width: 380px) {
    .chatting-off-content {
        width: 92%;
        padding: 12px 16px;
    }

    .chatting-off-title {
        font-size: 11px;
    }

    .chatting-off-sub {
        font-size: 10px;
    }

    .chatting-off-sub-info {
        font-size: 8.5px;
    }
}