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

html {
    overflow-x: hidden;
}

:root {
    --primary-color: #0088cc;
    --secondary-color: #5c9fc9;
    --bg-color: #1a1a1a;
    --chat-bg: #0d1117;
    --message-out: #005c4b;
    --message-in: #202c33;
    --text-color: #e9edef;
    --text-secondary: #8696a0;
    --border-color: #2a3942;
    --header-bg: #202c33;
    --header-text: #e9edef;
    --pending-bg: #3d3200;
    --pending-border: #ffc107;
    --input-bg: #2a3942;
    --sidebar-bg: #111b21;
    --hover-bg: #2a3942;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background: var(--chat-bg);
    overflow-x: hidden;
    overflow-y: hidden;
    -webkit-tap-highlight-color: transparent;
    max-width: 100vw;
}

.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: 100dvh; /* Dynamic viewport height - accounts for mobile browser UI */
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    max-width: 100vw;
}

.app-header {
    background: var(--header-bg);
    color: var(--header-text);
    padding: 10px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    position: relative;
    z-index: 100;
}

.header-left, .header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-left h1 {
    font-size: 18px;
    font-weight: 500;
}

.header-center {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.header-tabs {
    display: flex;
    gap: 4px;
    background: rgba(0, 0, 0, 0.2);
    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.1);
}

.header-message {
    font-size: 9px;
    color: var(--text-secondary);
    opacity: 0.85;
    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.1);
}

.icon-btn.login-highlight {
    animation: loginPulse 0.5s ease-in-out 3;
    background: rgba(59, 130, 246, 0.3);
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.4);
}

@keyframes loginPulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.4);
    }
    50% {
        transform: scale(1.15);
        box-shadow: 0 0 0 8px rgba(59, 130, 246, 0.2);
    }
}

.header-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
}

.chat-container {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: var(--chat-bg);
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100"><rect fill="%230d1117" width="100" height="100"/><circle fill="%231a2332" cx="10" cy="10" r="1" opacity="0.3"/></svg>');
    position: relative;
}

.floating-date {
    position: fixed;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.5);
    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.2);
    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.5);
    color: white;
    padding: 5px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
    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(255,255,255,0.15);
    border-top: 3px solid var(--primary-color);
    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(0, 0, 0, 0.8);
    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.3);
    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: 8px;
    max-width: 80%;
}

.message-wrapper.in {
    align-self: flex-start;
}

.message-wrapper.out {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.message-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    cursor: pointer;
}

.avatar-initials {
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 16px;
    text-transform: uppercase;
    user-select: none;
}

.message {
    padding: 8px 12px;
    border-radius: 8px;
    word-wrap: break-word;
    position: relative;
    box-shadow: 0 1px 0.5px rgba(0,0,0,0.13);
    flex: 1;
}

.message.out {
    background: var(--message-out);
    border-radius: 8px 8px 0 8px;
}

.message.in {
    background: var(--message-in);
    border-radius: 8px 8px 8px 0;
}

.message {
    position: relative;
}

.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 #ff9800;
    border-left: 4px solid #ff9800;
}

.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, #1e3a5f 0%, #2c5282 100%);
    border-left: 3px solid #4299e1;
}

.message-wrapper.user-message .message::before {
    content: '👤';
    position: absolute;
    top: -8px;
    left: -8px;
    font-size: 14px;
    background: #2c5282;
    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);
}

.message-sender {
    font-size: 13px;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 2px;
}

.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: #005c4b;
    font-weight: 600;
    line-height: 1;
}

.message-time {
    font-size: 11px;
    color: var(--text-secondary);
}

.message-reactions {
    display: flex;
    align-items: center;
    gap: 4px;
}

.reaction-counts {
    display: flex;
    gap: 6px;
}

.reaction-count {
    font-size: 12px;
    padding: 2px 6px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.1);
    cursor: pointer;
    transition: background 0.2s;
}

.reaction-count:hover {
    background: rgba(255, 255, 255, 0.2);
}

.reaction-count.user-reacted {
    background: rgba(0, 136, 204, 0.3);
}

.reaction-buttons {
    display: none;
    gap: 2px;
}

.message-wrapper:hover .reaction-buttons,
.message-wrapper.show-reactions .reaction-buttons {
    display: flex;
}

.reaction-btn {
    background: none;
    border: none;
    font-size: 14px;
    padding: 2px 4px;
    cursor: pointer;
    opacity: 0.5;
    transition: opacity 0.2s, transform 0.2s;
    border-radius: 4px;
}

.reaction-btn:hover {
    opacity: 1;
    transform: scale(1.2);
}

.reaction-btn.active {
    opacity: 1;
    background: rgba(0, 136, 204, 0.2);
}

.message-status {
    font-size: 10px;
    color: var(--text-secondary);
    margin-top: 4px;
    text-align: right;
    font-style: italic;
}

.message-input-wrapper {
    background: var(--bg-color);
    padding: 10px;
    display: flex;
    gap: 8px;
    align-items: flex-end;
    box-shadow: 0 -2px 4px rgba(0,0,0,0.1);
}

.input-container {
    flex: 1;
    position: relative;
}

.input-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    cursor: text;
    display: none;
    z-index: 100;
    border-radius: 20px;
}

.input-overlay.active {
    display: block;
    pointer-events: auto;
}

#messageInput {
    width: 100%;
    box-sizing: border-box;
    padding: 10px 14px;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    font-size: 15px;
    font-family: inherit;
    resize: none;
    max-height: 120px;
    outline: none;
    background: var(--input-bg);
    color: var(--text-color);
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE/Edge */
}

#messageInput::-webkit-scrollbar {
    display: none; /* Chrome/Safari/Opera */
}

#messageInput::placeholder {
    color: var(--text-secondary);
}

#messageInput:focus {
    border-color: var(--primary-color);
}

#attachBtn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: transparent;
    color: var(--text-secondary);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

#attachBtn:hover {
    color: var(--text-color);
}

#fileInput {
    display: none;
}

.voice-btn,
.send-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--primary-color);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.voice-btn {
    background: transparent;
    color: var(--text-secondary);
}

.voice-btn:hover {
    color: var(--text-color);
}

.send-btn:hover {
    background: var(--secondary-color);
}

.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;
    border-radius: 50%;
    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;
}

.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(0, 136, 204, 0.08);
}

.room-item.active {
    background: rgba(0, 136, 204, 0.12);
    border-left-color: var(--primary-color);
}

.room-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary-color);
    color: white;
    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(0, 136, 204, 0.08);
}

.dm-item.active {
    background: rgba(0, 136, 204, 0.12);
    border-left-color: var(--primary-color);
}

.dm-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    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: var(--primary-color);
    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(255,255,255,0.1);
}

.back-to-main-btn svg {
    stroke: var(--primary-color);
}

.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-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: white;
    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: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
}

.auth-error {
    background: #3d1a1a;
    color: #ff6b6b;
    padding: 12px;
    border-radius: 8px;
    margin-top: 12px;
    font-size: 14px;
}

.twofa-title {
    color: #e0e0e0;
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 8px;
    text-align: center;
}

.twofa-message {
    color: #aaa;
    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;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--primary-color);
}

.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: white;
}

.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;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--primary-color);
}

.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: var(--bg-color);
    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: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    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: var(--bg-secondary);
}

.profile-avatar-large {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    overflow: hidden;
    border: 3px solid var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    font-weight: 600;
    background: var(--bg-tertiary);
}

.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: white;
    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: var(--text-secondary);
    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: 20px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.95);
    border: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition: all 0.3s ease;
    z-index: 50;
}

.scroll-to-bottom-btn:hover {
    background: #fff;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px 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);
}

.menu-unread-dot.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: #1a1a2e;
}

.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(255, 255, 255, 0.15);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    transition: all 0.2s ease;
}

.voice-play-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: scale(1.05);
}

.voice-play-btn:active {
    transform: scale(0.95);
}

.voice-message.playing .voice-play-btn {
    background: rgba(255, 255, 255, 0.25);
}

.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(255, 255, 255, 0.4);
    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(255, 255, 255, 0.7);
    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(255, 255, 255, 0.12);
}

.message.in .waveform-bar {
    background: rgba(255, 255, 255, 0.35);
}

.message.in .voice-duration {
    color: rgba(255, 255, 255, 0.6);
}

/* Outgoing message voice style */
.message.out .voice-message {
    background: transparent;
}

.message.out .voice-play-btn {
    background: rgba(255, 255, 255, 0.2);
}

.message.out .waveform-bar {
    background: rgba(255, 255, 255, 0.5);
}

.message.out .voice-duration {
    color: rgba(255, 255, 255, 0.8);
}

/* 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(255, 255, 255, 0.1);
}

.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: white;
    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(0, 0, 0, 0.95);
    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(255, 255, 255, 0.1);
    border: none;
    color: white;
    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(255, 255, 255, 0.2);
}

.posts-modal-title {
    color: white;
    font-size: 16px;
    font-weight: 600;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}

.posts-new-btn {
    background: var(--primary-color);
    color: white;
    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(255, 255, 255, 0.1);
    border: none;
    color: white;
    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(255, 255, 255, 0.2);
}

.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: var(--text-secondary);
    font-size: 14px;
}

.post-story-header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.post-story-counter {
    color: var(--text-secondary);
    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: var(--text-secondary);
    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: var(--text-secondary);
    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(255, 255, 255, 0.05);
    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(255, 255, 255, 0.1);
}

.link-preview-image {
    width: 100%;
    max-height: 180px;
    overflow: hidden;
    background: #1a1a2e;
}

.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;
    -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;
    -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, #1a1a2e);
    border-radius: 16px;
    padding: 30px 24px;
    max-width: 340px;
    width: 100%;
    text-align: center;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.inapp-browser-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.inapp-browser-content h3 {
    color: #fff;
    font-size: 20px;
    margin: 0 0 12px 0;
}

.inapp-browser-content p {
    color: #aaa;
    font-size: 14px;
    line-height: 1.5;
    margin: 0 0 20px 0;
}

.inapp-browser-steps {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 20px;
}

.inapp-browser-steps .step {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #fff;
    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(255, 255, 255, 0.2);
    color: #888;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.inapp-browser-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

/* 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, #1a1a2e);
    border-radius: 16px;
    padding: 30px 24px;
    max-width: 340px;
    width: 100%;
    text-align: center;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    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: #FFD700;
    font-size: 18px;
    margin: 0 0 12px 0;
    font-weight: 600;
}

.pwa-install-description {
    color: #ccc;
    font-size: 14px;
    line-height: 1.6;
    margin: 0 0 24px 0;
}

.pwa-install-description strong {
    color: #fff;
}

.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: #888;
    padding: 12px 24px;
    font-size: 14px;
    cursor: pointer;
    transition: color 0.2s;
}

.pwa-install-close-btn:hover {
    color: #fff;
}

.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;
}
