* {
    box-sizing: border-box;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none
}

body.dark {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, Tahoma, sans-serif;
    background: #0e0e0e;
    color: #e0e0e0;
    height: 100dvh;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale
}

#auth-screen {
    position: fixed;
    inset: 0;
    background: linear-gradient(135deg, #1a1a2e, #16213e);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100
}

.box {
    background: #1e1e2e;
    padding: 32px;
    border-radius: 20px;
    width: 90%;
    max-width: 360px;
    text-align: center;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.1)
}

.box h2 {
    margin-top: 0;
    margin-bottom: 24px
}

.box input {
    width: 100%;
    padding: 14px 18px;
    margin: 10px 0;
    border: 1px solid #444;
    border-radius: 12px;
    background: #2a2a3a;
    color: #fff;
    font-size: 15px;
    transition: all 0.2s
}

.box input:focus {
    outline: none;
    border-color: #00bfa5;
    background: #2e2e3e
}

.box button {
    width: 100%;
    padding: 14px;
    background: #00bfa5;
    color: white;
    border: none;
    border-radius: 12px;
    margin-top: 12px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s
}

.box button:hover {
    background: #00a58a
}

.box button:active {
    transform: scale(0.98)
}

#auth-toggle {
    color: #00bfa5;
    font-size: 14px;
    margin-top: 16px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px
}

#app {
    display: flex;
    height: 100dvh;
    width: 100%;
    background: #0a0a0a;
    position: relative
}

.sidebar {
    width: 30%;
    min-width: 280px;
    max-width: 380px;
    background: #17212b;
    display: flex;
    flex-direction: column;
    border-right: 1px solid #0e1621;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1)
}

.sidebar .header {
    padding: 18px 20px;
    background: #0e1621;
    font-weight: 600;
    font-size: 15px;
    border-bottom: 1px solid #0a0f14;
    flex-shrink: 0;
    display: flex;
    justify-content: space-between;
    align-items: center
}

#user-list {
    list-style: none;
    margin: 0;
    padding: 0;
    overflow-y: auto;
    flex: 1
}

#user-list li {
    padding: 12px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: background 0.15s;
    position: relative
}

.user-info {
    flex: 1;
    overflow: hidden
}

.user-name {
    font-size: 14px;
    font-weight: 500
}

#user-list li:hover {
    background: rgba(255, 255, 255, 0.05)
}

#user-list li:active {
    background: rgba(255, 255, 255, 0.08)
}

.unread-badge {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    background: #ff6b6b;
    color: white;
    border-radius: 12px;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    box-shadow: 0 2px 4px rgba(255, 107, 107, 0.3)
}

.avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 18px;
    color: white;
    flex-shrink: 0;
    position: relative
}

.avatar.icon {
    background: linear-gradient(135deg, #ff6b6b, #ee5a52)
}

.online-badge {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #4caf50;
    border: 2px solid #17212b;
    box-shadow: 0 0 0 2px rgba(76, 175, 80, 0.3);
    animation: pulse-online 2s infinite
}

@keyframes pulse-online {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(76, 175, 80, 0.7)
    }
    50% {
        box-shadow: 0 0 0 4px rgba(76, 175, 80, 0)
    }
}

.chat-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #0e1621;
    position: relative
}

.chat-area .header {
    height: 64px;
    background: #17212b;
    display: flex;
    align-items: center;
    padding: 0 20px;
    border-bottom: 1px solid #0a0f14;
    flex-shrink: 0
}

.header-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1
}

.header-info b {
    font-size: 16px;
    font-weight: 600
}

.chat-status {
    font-size: 12px;
    color: #999;
    font-weight: 400
}

.back-btn {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    color: #aaa;
    margin-left: 8px;
    transition: color 0.2s
}

.back-btn:hover {
    color: #00bfa5
}

.messages-container {
    flex: 1;
    position: relative;
    overflow: hidden
}

.messages {
    height: 100%;
    padding: 12px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
    scroll-behavior: smooth;
    background: #0e1621;
    position: relative;
    -webkit-overflow-scrolling: touch
}

.msg {
    max-width: 75%;
    min-width: 60px;
    padding: 10px 14px;
    border-radius: 18px;
    font-size: 14.5px;
    line-height: 1.45;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    position: relative;
    word-wrap: break-word;
    word-break: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
    animation: slideIn 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    transition: all 0.2s;
    touch-action: pan-x pan-y
}

.msg p {
    overflow-wrap: break-word;
    word-break: break-word;
    margin: 0
}

.msg a {
    word-break: break-all
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(8px) scale(0.95)
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1)
    }
}

.msg.me {
    align-self: flex-start;
    background: linear-gradient(135deg, #2b5278, #1e3a5f);
    color: white;
    border-bottom-right-radius: 4px;
    margin-left: auto;
    margin-right: 0
}

.msg.other {
    align-self: flex-start;
    background: linear-gradient(135deg, #182533, #0f1926);
    color: #e0e0e0;
    border-bottom-left-radius: 4px;
    margin-left: 0;
    margin-right: auto
}

.msg.highlight {
    animation: highlight 2s ease;
    box-shadow: 0 0 0 2px rgba(0, 191, 165, 0.3)
}

@keyframes highlight {
    0%, 100% {
        background-color: inherit
    }
    50% {
        background-color: rgba(0, 191, 165, 0.1)
    }
}

.msg small {
    display: block;
    color: #00bfa5;
    font-weight: 600;
    margin-bottom: 4px;
    font-size: 12px
}

.msg .time {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.5);
    margin-top: 5px;
    display: block;
    text-align: left;
    direction: ltr;
    font-variant-numeric: tabular-nums
}

.msg-media {
    max-width: 100%;
    max-height: 400px;
    border-radius: 12px;
    margin-top: 6px;
    cursor: pointer;
    display: block;
    object-fit: contain;
    -webkit-tap-highlight-color: rgba(0, 191, 165, 0.3);
    touch-action: manipulation
}

.voice-message {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: rgba(0, 0, 0, 0.25);
    border-radius: 14px;
    margin-top: 4px;
    min-width: 260px;
    position: relative;
    touch-action: manipulation
}

.download-btn {
    color: rgba(255, 255, 255, 0.5);
    transition: color 0.2s;
    flex-shrink: 0;
    margin-left: 4px;
    -webkit-tap-highlight-color: rgba(0, 191, 165, 0.3);
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center
}

.download-btn:hover {
    color: #00bfa5
}

.voice-play-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #00bfa5;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.2s;
    box-shadow: 0 2px 6px rgba(0, 191, 165, 0.3);
    -webkit-tap-highlight-color: rgba(0, 191, 165, 0.3);
    min-width: 44px;
    min-height: 44px
}

.voice-play-btn:hover {
    background: #00a58a;
    transform: scale(1.05)
}

.voice-play-btn:active {
    transform: scale(0.95)
}

.voice-play-btn svg {
    width: 18px;
    height: 18px;
    fill: white
}

.voice-waveform {
    flex: 1;
    height: 40px;
    display: flex;
    align-items: center;
    gap: 2px;
    overflow: hidden
}

.voice-bar {
    width: 3px;
    background: rgba(255, 255, 255, 0.25);
    border-radius: 2px;
    transition: background 0.1s, height 0.1s
}

.voice-bar.active {
    background: #00bfa5
}

.voice-time {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.65);
    flex-shrink: 0;
    min-width: 42px;
    text-align: right;
    font-variant-numeric: tabular-nums
}

.audio-player-modern {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    background: rgba(0, 0, 0, 0.25);
    border-radius: 14px;
    margin-top: 4px;
    min-width: 280px;
    max-width: 100%;
    touch-action: manipulation
}

.audio-play-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #00bfa5;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.2s;
    box-shadow: 0 2px 8px rgba(0, 191, 165, 0.3);
    -webkit-tap-highlight-color: rgba(0, 191, 165, 0.3);
    min-width: 44px;
    min-height: 44px
}

.audio-play-btn:hover {
    background: #00a58a;
    transform: scale(1.05)
}

.audio-play-btn:active {
    transform: scale(0.95)
}

.audio-play-btn svg {
    width: 20px;
    height: 20px;
    fill: white
}

.audio-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0
}

.audio-title {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #e0e0e0;
    font-size: 13px;
    font-weight: 500;
    overflow: hidden
}

.audio-title span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis
}

.audio-title svg {
    opacity: 0.7;
    flex-shrink: 0
}

.audio-progress {
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 2px;
    overflow: hidden
}

.audio-progress-bar {
    height: 100%;
    background: #00bfa5;
    width: 0%;
    transition: width 0.1s linear;
    border-radius: 2px
}

.audio-time-info {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.5);
    font-variant-numeric: tabular-nums
}

.video-player {
    margin-top: 4px;
    border-radius: 14px;
    overflow: hidden;
    background: #000;
    position: relative;
    max-width: 100%;
    touch-action: manipulation
}

.video-player video {
    width: 100%;
    max-height: 400px;
    display: block;
    border-radius: 14px;
    background: #000;
    playsinline;
    -webkit-tap-highlight-color: rgba(0, 191, 165, 0.3)
}

.video-download-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    padding: 8px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: all 0.2s;
    z-index: 2;
    -webkit-tap-highlight-color: rgba(0, 191, 165, 0.3);
    min-width: 44px;
    min-height: 44px
}

.video-player:hover .video-download-btn {
    opacity: 1
}

.video-download-btn:hover {
    background: rgba(0, 191, 165, 0.8)
}

.file-viewer {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    background: rgba(0, 0, 0, 0.25);
    border-radius: 14px;
    margin-top: 4px;
    min-width: 240px;
    max-width: 100%;
    touch-action: manipulation
}

.file-icon {
    position: relative;
    width: 48px;
    height: 48px;
    background: rgba(0, 191, 165, 0.15);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0
}

.file-icon svg {
    color: #00bfa5
}

.file-ext {
    position: absolute;
    bottom: 2px;
    right: 2px;
    font-size: 9px;
    font-weight: 700;
    color: #00bfa5;
    background: rgba(0, 0, 0, 0.3);
    padding: 1px 3px;
    border-radius: 3px
}

.file-info {
    flex: 1;
    overflow: hidden;
    min-width: 0
}

.file-name {
    font-size: 13px;
    font-weight: 500;
    color: #e0e0e0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis
}

.file-size {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.5);
    margin-top: 2px
}

.file-download-btn {
    color: rgba(255, 255, 255, 0.5);
    transition: all 0.2s;
    flex-shrink: 0;
    padding: 8px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    -webkit-tap-highlight-color: rgba(0, 191, 165, 0.3);
    min-width: 44px;
    min-height: 44px
}

.file-download-btn:hover {
    color: #00bfa5;
    background: rgba(0, 191, 165, 0.1)
}

.reply-reference {
    background: rgba(0, 0, 0, 0.25);
    padding: 8px 12px;
    border-radius: 10px;
    margin-bottom: 6px;
    border-right: 3px solid #00bfa5;
    font-size: 12px;
    opacity: 0.85;
    cursor: pointer;
    transition: all 0.2s;
    touch-action: manipulation
}

.reply-reference:hover {
    background: rgba(0, 0, 0, 0.35);
    border-right-color: #00a58a
}

.reply-reference strong {
    display: block;
    color: #00bfa5;
    margin-bottom: 2px;
    font-weight: 600
}

.reply-reference span {
    display: block;
    color: #aaa;
    font-size: 11px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap
}

/* بهبود دکمه اسکرول به پایین */
.scroll-to-bottom-btn {
    position: absolute;
    bottom: 100px;
    right: 20px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #1a2332;
    color: #00bfa5;
    border: 2px solid #00bfa5;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    z-index: 100;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transform: translateY(20px);
    -webkit-tap-highlight-color: rgba(0, 191, 165, 0.3);
    min-width: 44px;
    min-height: 44px
}

.scroll-to-bottom-btn.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0)
}

.scroll-to-bottom-btn:hover {
    background: #00bfa5;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 191, 165, 0.4)
}

.scroll-to-bottom-btn:active {
    transform: translateY(0)
}

.scroll-to-bottom-btn svg {
    width: 24px;
    height: 24px;
    fill: currentColor
}

.input-bar {
    padding: 12px 16px;
    background: #17212b;
    display: flex;
    align-items: flex-end;
    gap: 10px;
    border-top: 1px solid #0a0f14;
    flex-shrink: 0
}

.input-bar textarea {
    flex: 1;
    padding: 12px 18px;
    border-radius: 24px;
    border: none;
    background: #0e1621;
    color: white;
    outline: none;
    font-size: 16px; /* جلوگیری از zoom در iOS */
    transition: background 0.2s;
    resize: none;
    font-family: inherit;
    line-height: 1.5;
    min-height: 44px;
    max-height: 120px;
    overflow-y: hidden !important
}

.input-bar textarea:focus {
    background: #0a0f14;
    overflow-y: auto !important
}

.input-bar button {
    background: transparent;
    border: none;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #8a96a1;
    border-radius: 50%;
    transition: all 0.2s;
    flex-shrink: 0;
    -webkit-tap-highlight-color: rgba(0, 191, 165, 0.3);
    min-width: 44px;
    min-height: 44px
}

.input-bar button:hover {
    background: rgba(0, 191, 165, 0.1);
    color: #00bfa5
}

.input-bar button:active {
    transform: scale(0.9)
}

#mic-btn.recording {
    background: #f44336 !important;
    color: white !important;
    animation: pulse-rec 1s infinite
}

@keyframes pulse-rec {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(244, 67, 54, 0.7)
    }
    50% {
        transform: scale(1.08);
        box-shadow: 0 0 0 8px rgba(244, 67, 54, 0)
    }
}

#reply-panel {
    position: fixed;
    bottom: 80px;
    left: 0;
    right: 0;
    background: #212f3c;
    padding: 12px 18px;
    border-top: 2px solid #00bfa5;
    z-index: 10;
    animation: slideUp 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.2)
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
        opacity: 0
    }
    to {
        transform: translateY(0);
        opacity: 1
    }
}

.reply-content {
    display: flex;
    align-items: center;
    gap: 12px;
    max-width: 100%
}

.reply-info {
    flex: 1;
    overflow: hidden
}

.reply-info strong {
    display: block;
    color: #00bfa5;
    font-size: 13px;
    margin-bottom: 3px;
    font-weight: 600
}

.reply-info span {
    display: block;
    color: #aaa;
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis
}

#cancel-reply {
    background: rgba(255, 255, 255, 0.05);
    border: none;
    color: #aaa;
    font-size: 22px;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border-radius: 50%;
    transition: all 0.2s;
    -webkit-tap-highlight-color: rgba(0, 191, 165, 0.3)
}

#cancel-reply:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff
}

.context-menu {
    position: fixed;
    background: #1e1e2e;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    z-index: 1000;
    min-width: 200px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.1);
    animation: slideInUp 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    transform-origin: top right
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(10px) scale(0.95)
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1)
    }
}

.context-menu-item {
    padding: 14px 20px;
    color: #e0e0e0;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all 0.2s;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    font-size: 14px
}

.context-menu-item:last-child {
    border-bottom: none
}

.context-menu-item:hover {
    background: rgba(0, 191, 165, 0.1);
    color: #00bfa5
}

.context-menu-item.danger:hover {
    background: rgba(244, 67, 54, 0.1);
    color: #f44336
}

.context-menu-icon {
    width: 18px;
    height: 18px;
    fill: currentColor
}

.edit-message-container {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    animation: fadeIn 0.2s ease
}

@keyframes fadeIn {
    from {
        opacity: 0
    }
    to {
        opacity: 1
    }
}

.edit-message-box {
    background: #1e1e2e;
    padding: 24px;
    border-radius: 20px;
    width: 90%;
    max-width: 500px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5)
}

.edit-message-box textarea {
    width: 100%;
    min-height: 120px;
    padding: 16px;
    background: #2a2a3a;
    border: 1px solid #444;
    border-radius: 12px;
    color: white;
    font-size: 14.5px;
    line-height: 1.5;
    resize: vertical;
    outline: none;
    margin-bottom: 16px;
    font-family: inherit
}

.edit-message-box textarea:focus {
    border-color: #00bfa5
}

.edit-message-buttons {
    display: flex;
    gap: 12px;
    justify-content: flex-end
}

.edit-message-buttons button {
    padding: 10px 24px;
    border-radius: 10px;
    border: none;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s
}

.edit-message-buttons button:first-child {
    background: #2a2a3a;
    color: #aaa
}

.edit-message-buttons button:last-child {
    background: #00bfa5;
    color: white
}

.edit-message-buttons button:hover {
    transform: translateY(-2px)
}

.typing-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    font-size: 12px;
    color: #aaa
}

.typing-dots {
    display: flex;
    gap: 3px
}

.typing-dot {
    width: 6px;
    height: 6px;
    background: #00bfa5;
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out
}

.typing-dot:nth-child(1) {
    animation-delay: -0.32s
}

.typing-dot:nth-child(2) {
    animation-delay: -0.16s
}

@keyframes typing {
    0%, 80%, 100% {
        transform: scale(0.6);
        opacity: 0.4
    }
    40% {
        transform: scale(1);
        opacity: 1
    }
}

/* بهبود سوایپ برای ریپلای */
.msg.swipe-left {
    transform: translateX(-40px);
    transition: transform 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    background-color: rgba(0, 191, 165, 0.08);
    box-shadow: -5px 0 15px rgba(0, 191, 165, 0.2);
}

.msg.swipe-right {
    transform: translateX(40px);
    transition: transform 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    background-color: rgba(0, 191, 165, 0.08);
    box-shadow: 5px 0 15px rgba(0, 191, 165, 0.2);
}

.msg.swipe-reply {
    transform: translateX(0);
    background-color: rgba(0, 191, 165, 0.15);
    transition: transform 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55), background-color 0.3s ease;
    box-shadow: 0 0 20px rgba(0, 191, 165, 0.3);
}

.msg.swipe-reply::after {
    content: "↪";
    position: absolute;
    right: -35px;
    top: 50%;
    transform: translateY(-50%);
    color: #00bfa5;
    font-size: 24px;
    opacity: 0.8;
    animation: swipeHint 0.6s ease;
}

@keyframes swipeHint {
    0% { opacity: 0; transform: translateY(-50%) translateX(-10px); }
    100% { opacity: 0.8; transform: translateY(-50%); }
}

/* استایل برای گروه اطلاع‌رسانی */
.input-bar.notice-restricted {
    opacity: 0.5;
    pointer-events: none;
}

.input-bar.notice-restricted::before {
    content: "فقط shervin می‌تواند در این گروه پیام ارسال کند";
    position: absolute;
    top: -25px;
    right: 10px;
    font-size: 11px;
    color: #999;
    background: rgba(0, 0, 0, 0.5);
    padding: 3px 8px;
    border-radius: 10px;
}

.loading-dots {
    display: inline-flex;
    gap: 4px
}

.loading-dot {
    width: 6px;
    height: 6px;
    background: #00bfa5;
    border-radius: 50%;
    animation: loading 1.4s infinite ease-in-out
}

.loading-dot:nth-child(1) {
    animation-delay: -0.32s
}

.loading-dot:nth-child(2) {
    animation-delay: -0.16s
}

@keyframes loading {
    0%, 80%, 100% {
        transform: scale(0.6);
        opacity: 0.4
    }
    40% {
        transform: scale(1);
        opacity: 1
    }
}

.edited-indicator {
    font-size: 10px;
    color: rgba(255, 255, 255, 0.4);
    margin-right: 4px;
    font-style: italic
}

.message-deleted {
    font-style: italic;
    color: #999;
    opacity: 0.7
}

.forwarded-note {
    font-size: 11px;
    color: #aaa;
    margin-bottom: 5px;
    padding-right: 5px;
    border-right: 2px solid #00bfa5;
    font-style: italic
}

#recording-panel {
    display: none;
    position: fixed;
    bottom: 80px;
    left: 0;
    right: 0;
    background: #1e1e2e;
    padding: 12px 20px;
    text-align: center;
    z-index: 100;
    animation: slideUp 0.3s ease
}

.recording-timer {
    font-size: 18px;
    color: #f44336;
    font-weight: 600;
    margin-bottom: 8px;
    font-variant-numeric: tabular-nums
}

/* بهبود نمایش عکس و ویدیو در موبایل */
.media-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    touch-action: none;
}

.media-overlay.active {
    opacity: 1;
}

.media-content {
    max-width: 95%;
    max-height: 85%;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
}

.media-content img,
.media-content video {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 8px;
}

.media-close-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    background: #f44336;
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    -webkit-tap-highlight-color: rgba(244, 67, 54, 0.3);
    min-width: 44px;
    min-height: 44px;
}

@media(max-width:768px) {
    #app {
        flex-direction: column
    }
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        z-index: 20;
        background: #17212b;
        transform: translateX(-100%);
        min-width: unset;
        max-width: unset
    }
    .sidebar.active {
        transform: translateX(0)
    }
    .chat-area {
        width: 100%;
        height: 100%
    }
    .back-btn {
        display: flex
    }
    .input-bar {
        padding: 10px 12px;
        gap: 8px
    }
    .input-bar button {
        width: 40px;
        height: 40px
    }
    .input-bar textarea {
        padding: 11px 16px;
        font-size: 16px;
        min-height: 40px
    }
    .msg {
        font-size: 14px;
        padding: 9px 12px;
        max-width: 85%;
        border-radius: 16px
    }
    .msg-media {
        max-height: 300px;
        min-height: 150px;
        object-fit: cover;
        width: 100%;
    }
    .video-player video {
        max-height: 300px;
        min-height: 200px;
    }
    .voice-message {
        min-width: 200px;
        padding: 8px 12px
    }
    .audio-player-modern {
        min-width: 220px;
        padding: 10px 12px
    }
    #reply-panel {
        bottom: 70px;
        padding: 10px 14px
    }
    .avatar {
        width: 44px;
        height: 44px;
        font-size: 17px
    }
    .scroll-to-bottom-btn {
        bottom: 110px;
        right: 15px;
        width: 40px;
        height: 40px;
        background: #1a2332;
        border: 2px solid #00bfa5;
        color: #00bfa5;
    }
    .file-viewer {
        min-width: 200px
    }
    
    /* بهبود نمایش عکس در موبایل */
    .msg-media {
        cursor: pointer !important;
        -webkit-tap-highlight-color: rgba(0, 191, 165, 0.3);
    }
    
    .voice-play-btn, 
    .audio-play-btn,
    .download-btn,
    .video-download-btn,
    .file-download-btn {
        cursor: pointer !important;
        -webkit-tap-highlight-color: rgba(0, 191, 165, 0.3);
        min-width: 44px;
        min-height: 44px;
    }
    
    /* جلوگیری از zoom ناخواسته */
    input, textarea {
        font-size: 16px !important;
    }
}

@media(max-width:480px) {
    .msg {
        max-width: 90%
    }
    .input-bar {
        padding: 8px 10px
    }
    .input-bar textarea {
        padding: 10px 14px;
        font-size: 16px
    }
    .scroll-to-bottom-btn {
        bottom: 100px;
        right: 10px;
        width: 36px;
        height: 36px
    }
    .voice-message {
        min-width: 180px
    }
    .audio-player-modern {
        min-width: 200px
    }
    .msg-media {
        max-height: 250px;
        min-height: 120px;
    }
    .video-player video {
        max-height: 250px;
        min-height: 180px;
    }
}

@media(max-height:600px) {
    .sidebar .header {
        padding: 12px 16px;
        height: 56px
    }
    .chat-area .header {
        height: 56px;
        padding: 0 16px
    }
    .input-bar {
        padding: 8px 12px
    }
    .scroll-to-bottom-btn {
        bottom: 90px
    }
}

::-webkit-scrollbar {
    width: 6px
}

::-webkit-scrollbar-track {
    background: #0a0f14
}

::-webkit-scrollbar-thumb {
    background: #2b5278;
    border-radius: 3px
}

::-webkit-scrollbar-thumb:hover {
    background: #3a6a9b
}

.messages::-webkit-scrollbar {
    width: 6px
}

.messages::-webkit-scrollbar-track {
    background: transparent
}

.messages::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px
}

.messages::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2)
}

.input-bar textarea::-webkit-scrollbar {
    width: 4px
}

.input-bar textarea::-webkit-scrollbar-track {
    background: transparent
}

.input-bar textarea::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px
}

#drop-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease
}

#drop-overlay.active {
    opacity: 1
}

.drop-message {
    background: white;
    padding: 24px 32px;
    border-radius: 16px;
    text-align: center;
    color: #333;
    font-weight: 600;
    font-size: 18px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    transform: scale(0.95);
    transition: transform 0.3s ease, box-shadow 0.3s ease
}

#drop-overlay.active .drop-message {
    transform: scale(1)
}

.drop-message::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(45deg, #00bfa5, #4252ee, #ff6b6b);
    border-radius: 16px;
    z-index: -1;
    opacity: 0.1
}

.msg {
    user-select: text;
    -webkit-user-select: text
}

.msg p {
    cursor: text
}

/* استایل‌های مربوط به forward modal */
.forward-list {
    max-height: 300px;
    overflow-y: auto;
    margin-bottom: 16px;
}

.forward-item {
    padding: 12px 16px;
    cursor: pointer;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all 0.2s;
}

.forward-item:hover {
    background: rgba(0,191,165,0.1);
}

.forward-item .avatar {
    width: 36px;
    height: 36px;
    font-size: 14px;
}

.forward-item .user-name {
    font-size: 14px;
    font-weight: 500;
}