* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-primary: #0a0a0f;
    --bg-secondary: #12121a;
    --bg-tertiary: #1a1a25;
    --bg-glass: rgba(20, 20, 30, 0.7);
    --bg-message-in: rgba(30, 30, 45, 0.6);
    --bg-message-out: rgba(255, 120, 50, 0.2);
    --accent-primary: #ff7a32;
    --accent-secondary: #ff9f5e;
    --accent-glow: rgba(255, 120, 50, 0.4);
    --text-primary: #ffffff;
    --text-secondary: #b8b8cc;
    --text-tertiary: #7a7a99;
    --border-light: rgba(255, 255, 255, 0.05);
    --border-glow: rgba(255, 120, 50, 0.3);
    --shadow-3d: 0 5px 0 rgba(0, 0, 0, 0.25);
    --shadow-3d-hover: 0 2px 0 rgba(0, 0, 0, 0.25);
    --glass-blur: blur(20px);
}

body.theme-dark-blue {
    --bg-primary: #000;
    --bg-secondary: #0a0a12;
    --bg-tertiary: #141428;
    --bg-glass: rgba(10, 10, 25, 0.75);
    --bg-message-in: rgba(25, 25, 50, 0.6);
    --bg-message-out: rgba(42, 171, 238, 0.2);
    --accent-primary: #2AABEE;
    --accent-secondary: #5ec8ff;
    --accent-glow: rgba(42, 171, 238, 0.4);
    --border-glow: rgba(42, 171, 238, 0.3);
}

body.theme-light-orange {
    --bg-primary: #f5f0eb;
    --bg-secondary: #fffaf5;
    --bg-tertiary: #ffe8d9;
    --bg-glass: rgba(255, 245, 240, 0.8);
    --bg-message-in: rgba(255, 235, 220, 0.8);
    --bg-message-out: rgba(255, 180, 140, 0.2);
    --accent-primary: #ff8c42;
    --accent-secondary: #ffaa66;
    --accent-glow: rgba(255, 140, 66, 0.3);
    --text-primary: #1a1a2e;
    --text-secondary: #5a5a7a;
    --text-tertiary: #8a8aaa;
    --border-light: rgba(0, 0, 0, 0.04);
    --border-glow: rgba(255, 140, 66, 0.3);
    --shadow-3d: 0 5px 0 rgba(0, 0, 0, 0.08);
    --shadow-3d-hover: 0 2px 0 rgba(0, 0, 0, 0.08);
}

html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', Roboto, 'Noto Sans', Helvetica, Arial, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    transition: background 0.2s ease, color 0.2s ease;
}

button {
    position: relative;
    background: var(--bg-glass);
    backdrop-filter: var(--glass-blur);
    border: 1px solid var(--border-light);
    color: var(--text-primary);
    border-radius: 30px;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.08s linear;
    box-shadow: var(--shadow-3d);
    transform: translateY(-2px);
}

button:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-3d-hover);
    background: var(--bg-tertiary);
    border-color: var(--border-glow);
}

button:active {
    transform: translateY(2px);
    box-shadow: none;
}

.btn-primary,
.create-post-btn,
.send-btn,
.save-profile-btn,
.friend-action-btn,
.confirm-create-group-btn,
#joinGroupByInviteBtn,
#submitCommentBtn,
#doLoginBtn,
#registerBtn {
    background: var(--accent-primary);
    border-color: var(--accent-secondary);
    color: white;
    box-shadow: 0 5px 0 rgba(0, 0, 0, 0.2), 0 0 15px var(--accent-glow);
}

.btn-primary:hover,
.create-post-btn:hover,
.send-btn:hover,
.save-profile-btn:hover,
.friend-action-btn:hover,
.confirm-create-group-btn:hover,
#joinGroupByInviteBtn:hover,
#submitCommentBtn:hover,
#doLoginBtn:hover,
#registerBtn:hover {
    background: var(--accent-secondary);
    box-shadow: 0 2px 0 rgba(0, 0, 0, 0.2), 0 0 20px var(--accent-glow);
    transform: translateY(-3px);
}

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background: var(--bg-glass);
    backdrop-filter: var(--glass-blur);
    border-radius: 28px;
    padding: 26px;
    max-width: 460px;
    width: 90%;
    border: 1px solid var(--border-light);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    max-height: 85vh;
    overflow-y: auto;
}

.auth-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
    border-bottom: 1px solid var(--border-light);
}

.tab-btn {
    flex: 1;
    padding: 14px;
    background: transparent !important;
    border: none !important;
    color: var(--text-secondary);
    font-size: 16px;
    cursor: pointer;
    font-weight: 500;
    box-shadow: none !important;
    transform: none !important;
}

.tab-btn.active {
    color: var(--accent-primary);
    text-shadow: 0 0 20px var(--accent-glow);
}

.auth-form {
    display: none;
}

.auth-form.active {
    display: block;
}

.auth-form h2 {
    margin-bottom: 24px;
    text-align: center;
    font-weight: 500;
}

.auth-form input {
    width: 100%;
    padding: 16px;
    margin-bottom: 16px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-light);
    border-radius: 16px;
    color: var(--text-primary);
    font-size: 15px;
}

.auth-form input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 20px var(--accent-glow);
}

#doLoginBtn,
#registerBtn {
    width: 100%;
    margin-top: 10px;
    padding: 14px;
    font-size: 16px;
    font-weight: 600;
}

#clearStorageBtn {
    background: var(--bg-tertiary);
    margin-top: 10px;
    width: 100%;
}

.username-status {
    font-size: 13px;
    margin-top: -10px;
    margin-bottom: 12px;
    padding: 6px 12px;
    border-radius: 10px;
}

.username-status.available {
    color: #10b981;
    background: rgba(16, 185, 129, 0.08);
}

.username-status.unavailable {
    color: #EF4444;
    background: rgba(239, 68, 68, 0.08);
}

input, textarea {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-light);
    border-radius: 14px;
    padding: 12px 14px;
    color: var(--text-primary);
    font-size: 15px;
    font-family: inherit;
    transition: 0.2s;
}

input:focus, textarea:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 2px var(--accent-glow);
}

.app-container {
    display: flex;
    width: 100%;
    min-height: 100vh;
    overflow: visible;
}

.chats-panel {
    width: 370px;
    background: var(--bg-glass);
    backdrop-filter: var(--glass-blur);
    border-right: 1px solid var(--border-light);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
    flex-shrink: 0;
    transition: width 0.3s ease;
    height: 100vh;
}

.chats-panel.collapsed {
    width: 0;
    min-width: 0;
    overflow: hidden;
}

.profile-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 15px;
    gap: 12px;
    border-bottom: 1px solid var(--border-light);
}

.profile-click-area {
    display: flex;
    align-items: center;
    gap: 13px;
    flex: 1;
    cursor: pointer;
}

.profile-avatar {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    overflow: hidden;
    flex-shrink: 0;
    box-shadow: 0 4px 12px var(--accent-glow);
}

.profile-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.profile-info {
    flex: 1;
    min-width: 0;
}

.profile-name {
    font-size: 17px;
    font-weight: 600;
    margin-bottom: 3px;
}

.profile-fullname {
    font-size: 12px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.profile-coins {
    font-size: 12px;
    color: var(--accent-primary);
    margin-top: 4px;
}

.panel-buttons {
    display: flex;
    gap: 8px;
}

.toggle-panel-btn, .logout-icon {
    width: 38px;
    height: 38px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

.show-panel-btn {
    position: fixed;
    left: 16px;
    top: 80px;
    z-index: 90;
    background: var(--bg-glass);
    backdrop-filter: var(--glass-blur);
    border: 1px solid var(--border-light);
    color: var(--text-primary);
    font-size: 18px;
    padding: 12px 16px;
    border-radius: 16px;
    cursor: pointer;
    box-shadow: var(--shadow-3d);
    transform: translateY(-2px);
    transition: all 0.1s ease;
    display: none;
}

.show-panel-btn:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-3d-hover);
}

.show-panel-btn:active {
    transform: translateY(2px);
    box-shadow: none;
}

.chats-panel.collapsed ~ .show-panel-btn {
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav-tabs {
    display: flex;
    padding: 12px;
    gap: 8px;
    border-bottom: 1px solid var(--border-light);
}

.nav-tab {
    flex: 1;
    background: transparent;
    border: none;
    padding: 10px 0;
    font-size: 14px;
    border-radius: 40px;
    box-shadow: none;
    transform: none;
}

.nav-tab:hover {
    background: var(--bg-tertiary);
    transform: none;
    box-shadow: none;
}

.nav-tab.active {
    background: var(--accent-primary);
    color: white;
    box-shadow: 0 3px 10px var(--accent-glow);
}

.page-content {
    display: none;
    flex: 1;
    overflow-y: auto;
    padding: 18px;
}

.page-content.active {
    display: block;
}

.create-post {
    background: var(--bg-glass);
    backdrop-filter: var(--glass-blur);
    border-radius: 22px;
    padding: 18px;
    margin-bottom: 22px;
    border: 1px solid var(--border-light);
}

.create-post textarea {
    width: 100%;
    margin-bottom: 14px;
    resize: vertical;
}

.create-post-buttons {
    display: flex;
    gap: 12px;
}

.feed-sort {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
}

.sort-btn {
    padding: 8px 20px;
    border-radius: 40px;
}

.sort-btn.active {
    background: var(--accent-primary);
    color: white;
}

.feed-container {
    display: flex;
    flex-direction: column;
    gap: 18px;
    padding-bottom: 20px;
}

.post-card {
    background: var(--bg-glass);
    backdrop-filter: var(--glass-blur);
    border-radius: 22px;
    padding: 18px;
    border: 1px solid var(--border-light);
    cursor: pointer;
    transition: 0.2s;
}

.post-card:active {
    transform: scale(0.99);
}

.post-header {
    display: flex;
    align-items: center;
    gap: 13px;
    margin-bottom: 13px;
}

.post-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    overflow: hidden;
    flex-shrink: 0;
}

.post-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.post-author {
    font-weight: 600;
    font-size: 15px;
}

.post-time {
    font-size: 11px;
    color: var(--text-tertiary);
    margin-top: 3px;
}

.post-content {
    margin-bottom: 14px;
    line-height: 1.45;
    word-break: break-word;
}

.post-image {
    max-width: 100%;
    border-radius: 16px;
    margin-bottom: 14px;
}

.post-actions {
    display: flex;
    gap: 22px;
    margin-bottom: 13px;
    padding-bottom: 13px;
    border-bottom: 1px solid var(--border-light);
}

.post-action-btn {
    background: transparent;
    border: none;
    padding: 6px 12px;
    border-radius: 30px;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 6px;
    box-shadow: none;
    transform: none;
}

.post-action-btn:hover {
    background: var(--bg-tertiary);
    transform: none;
    box-shadow: none;
}

.post-action-btn.liked {
    color: var(--accent-primary);
}

.delete-post-btn {
    background: transparent;
    border: 1px solid #EF4444;
    color: #EF4444;
    padding: 5px 12px;
    border-radius: 30px;
    font-size: 12px;
    box-shadow: none;
    transform: none;
}

.delete-post-btn:hover {
    background: #EF4444;
    color: white;
}

.search-bar {
    padding: 14px;
    border-bottom: 1px solid var(--border-light);
}

.search-bar input {
    width: 100%;
}

.chats-list {
    flex: 1;
    overflow-y: auto;
    padding-bottom: 20px;
}

.chat-item {
    display: flex;
    align-items: center;
    padding: 14px;
    gap: 14px;
    cursor: pointer;
    transition: 0.2s;
    border-bottom: 1px solid var(--border-light);
    background: transparent;
}

.chat-item:hover {
    background: var(--bg-tertiary);
}

.chat-item.active {
    background: var(--bg-glass);
    border-left: 3px solid var(--accent-primary);
}

.chat-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    overflow: hidden;
    flex-shrink: 0;
}

.chat-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.chat-details {
    flex: 1;
    min-width: 0;
}

.chat-name {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 4px;
}

.chat-last-message {
    font-size: 13px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-meta {
    text-align: right;
}

.chat-time {
    font-size: 11px;
    color: var(--text-tertiary);
    margin-bottom: 4px;
}

.unread-badge {
    background: var(--accent-primary);
    color: white;
    font-size: 11px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 30px;
}

.create-group-btn-container {
    margin-bottom: 22px;
}

.create-group-btn {
    width: 100%;
    padding: 16px;
    font-size: 16px;
    font-weight: 600;
}

.groups-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-bottom: 22px;
    max-height: none;
    overflow-y: visible;
}

.group-card {
    display: flex;
    align-items: center;
    padding: 15px;
    background: var(--bg-glass);
    backdrop-filter: var(--glass-blur);
    border-radius: 20px;
    cursor: pointer;
    border: 1px solid var(--border-light);
}

.group-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    overflow: hidden;
    margin-right: 15px;
    flex-shrink: 0;
}

.group-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.group-info {
    flex: 1;
}

.group-name {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 4px;
}

.group-description {
    font-size: 13px;
    color: var(--text-secondary);
}

.group-meta {
    font-size: 12px;
    color: var(--accent-primary);
    margin-top: 4px;
}

.join-group-section {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--border-light);
}

.join-group-section h3 {
    font-size: 15px;
    margin-bottom: 14px;
    font-weight: 500;
}

.join-group-input {
    display: flex;
    gap: 12px;
}

.join-group-input input {
    flex: 1;
}

.friend-requests-section, .friends-section, .search-friends-section {
    margin-bottom: 28px;
}

.friend-requests-section h3, .friends-section h3, .search-friends-section h3 {
    font-size: 16px;
    margin-bottom: 14px;
    font-weight: 500;
}

.friend-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px;
    background: var(--bg-glass);
    backdrop-filter: var(--glass-blur);
    border-radius: 18px;
    margin-bottom: 10px;
    border: 1px solid var(--border-light);
}

.friend-info {
    display: flex;
    align-items: center;
    gap: 14px;
    cursor: pointer;
    flex: 1;
}

.friend-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    overflow: hidden;
}

.friend-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.friend-name {
    font-weight: 500;
}

.accept-friend-btn {
    background: #10b981;
    border: none;
    padding: 8px 18px;
    border-radius: 30px;
    color: white;
}

.chat-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: transparent;
    min-width: 0;
    width: 100%;
    height: 100vh;
    overflow: hidden;
}

.chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 18px;
    background: var(--bg-glass);
    backdrop-filter: var(--glass-blur);
    border-bottom: 1px solid var(--border-light);
    flex-wrap: wrap;
    gap: 10px;
}

.chat-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 0;
}

.chat-header-right {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.theme-switcher {
    display: flex;
    gap: 5px;
    background: var(--bg-tertiary);
    padding: 4px;
    border-radius: 40px;
    border: 1px solid var(--border-light);
}

.theme-btn {
    width: 32px;
    height: 32px;
    border-radius: 40px;
    cursor: pointer;
    border: 2px solid transparent;
    padding: 0;
    box-shadow: none;
    transform: none;
}

.theme-btn.active {
    border-color: var(--accent-primary);
    box-shadow: 0 0 12px var(--accent-glow);
}

.theme-dark-orange {
    background: linear-gradient(135deg, #0a0a0f, #ff7a32);
}

.theme-dark-blue {
    background: linear-gradient(135deg, #000, #2AABEE);
}

.theme-light-orange {
    background: linear-gradient(135deg, #f5f0eb, #ff8c42);
}

.chat-contact {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.contact-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    overflow: hidden;
    flex-shrink: 0;
}

.contact-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.contact-info {
    min-width: 0;
}

.contact-name {
    font-size: 16px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.contact-status {
    font-size: 12px;
    color: var(--text-tertiary);
}

.call-btn, .group-info-btn, .invite-btn {
    padding: 8px 14px;
    font-size: 13px;
}

.no-chat-selected {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 24px;
}

.no-chat-icon {
    font-size: 72px;
    margin-bottom: 24px;
    opacity: 0.6;
}

.messages-area {
    flex: 1;
    overflow-y: auto;
    padding: 18px;
    width: 100%;
    -webkit-overflow-scrolling: touch;
}

.messages-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
}

.message {
    display: flex;
    margin-bottom: 10px;
    max-width: 100%;
}

.message.outgoing {
    justify-content: flex-end;
}

.message.incoming {
    justify-content: flex-start;
}

.message-bubble {
    max-width: 75%;
    padding: 10px 15px;
    border-radius: 22px;
    font-size: 14px;
    line-height: 1.45;
    word-wrap: break-word;
    backdrop-filter: blur(10px);
}

.message.outgoing .message-bubble {
    background: var(--bg-message-out);
    border: 1px solid var(--border-light);
    border-bottom-right-radius: 6px;
}

.message.incoming .message-bubble {
    background: var(--bg-message-in);
    border: 1px solid var(--border-light);
    border-bottom-left-radius: 6px;
}

.message-sender {
    font-size: 12px;
    color: var(--accent-primary);
    margin-bottom: 4px;
    font-weight: 600;
    cursor: pointer;
}

.message-time {
    font-size: 10px;
    color: var(--text-tertiary);
    margin-top: 4px;
    text-align: right;
}

.message-media {
    max-width: 250px;
    max-height: 250px;
    border-radius: 16px;
    cursor: pointer;
    object-fit: cover;
    margin-top: 8px;
}

.message-video {
    max-width: 280px;
    max-height: 250px;
    border-radius: 16px;
    display: block;
    margin-top: 8px;
}

.message-video-circle {
    width: 180px;
    height: 180px;
    border-radius: 50%;
    object-fit: cover;
    cursor: pointer;
    display: block;
    margin-top: 8px;
    border: 2px solid var(--accent-primary);
    background: #000;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.message-audio {
    max-width: 230px;
    height: 40px;
    border-radius: 20px;
    margin-top: 8px;
}

.message-file {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(255, 255, 255, 0.05);
    padding: 8px 12px;
    border-radius: 14px;
    cursor: pointer;
    margin-top: 8px;
    border: 1px solid var(--border-light);
}

.message-file:hover {
    background: rgba(255, 255, 255, 0.1);
}

.file-icon {
    font-size: 24px;
}

.file-info {
    flex: 1;
    min-width: 0;
}

.file-name {
    font-size: 12px;
    font-weight: 500;
    word-break: break-all;
}

.file-size {
    font-size: 10px;
    opacity: 0.7;
}

.msg-delete-btn {
    opacity: 0.5;
    transition: opacity 0.2s;
    background: none;
    border: none;
    color: #EF4444;
    cursor: pointer;
    font-size: 14px;
    margin-left: 8px;
    padding: 0 5px;
    box-shadow: none;
    transform: none;
}

.msg-delete-btn:hover {
    opacity: 1;
}

.message-input-area {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: var(--bg-glass);
    backdrop-filter: var(--glass-blur);
    border-top: 1px solid var(--border-light);
    flex-shrink: 0;
}

.message-input-area input {
    font-size: 16px;
}

.input-icon {
    background: transparent;
    border: none;
    font-size: 22px;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 8px;
    border-radius: 50%;
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: none;
    transform: none;
}

.input-icon:hover {
    background: var(--bg-tertiary);
    color: var(--accent-primary);
    transform: none;
    box-shadow: none;
}

.message-input-area input {
    flex: 1;
    padding: 12px 16px;
    border-radius: 30px;
    min-width: 0;
}

.send-btn {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    padding: 0;
}

.profile-avatar-large {
    width: 110px;
    height: 110px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
    margin: 0 auto 24px;
    overflow: hidden;
    cursor: pointer;
    position: relative;
    box-shadow: 0 8px 24px var(--accent-glow);
}

.profile-avatar-large img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.avatar-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    text-align: center;
    font-size: 22px;
    padding: 6px;
    opacity: 0;
    transition: opacity 0.2s;
}

.profile-avatar-large:hover .avatar-overlay {
    opacity: 1;
}

.profile-field {
    text-align: left;
    margin-bottom: 18px;
}

.profile-field label {
    display: block;
    font-size: 13px;
    color: var(--text-tertiary);
    margin-bottom: 6px;
    font-weight: 500;
}

.profile-field span {
    display: block;
    font-size: 16px;
    padding: 8px 0;
}

.profile-field input,
.profile-field textarea {
    width: 100%;
}

.change-avatar-btn, .save-profile-btn {
    width: 100%;
    padding: 12px;
}

.storage-upgrade-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 8px;
}

.storage-btn {
    background: var(--bg-tertiary);
    padding: 10px 14px;
    font-size: 13px;
}

.wave-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    height: 50px;
}

.wave-bar {
    width: 5px;
    height: 24px;
    background: var(--accent-primary);
    border-radius: 3px;
    box-shadow: 0 0 10px var(--accent-glow);
    transition: height 0.1s ease;
}

@keyframes wave {
    0% { height: 12px; }
    50% { height: 36px; }
    100% { height: 12px; }
}

.wave-bar {
    animation: wave 0.8s ease infinite alternate;
}

.wave-bar:nth-child(2) { animation-delay: 0.1s; }
.wave-bar:nth-child(3) { animation-delay: 0.2s; }
.wave-bar:nth-child(4) { animation-delay: 0.3s; }
.wave-bar:nth-child(5) { animation-delay: 0.4s; }

#notificationContainer {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1100;
}

.notification {
    background: var(--bg-glass);
    backdrop-filter: var(--glass-blur);
    padding: 14px 22px;
    border-radius: 18px;
    margin-bottom: 12px;
    border: 1px solid var(--border-light);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        transform: translateX(120%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--bg-tertiary);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent-primary);
}

.mobile-menu-btn {
    display: none;
    position: fixed;
    top: 14px;
    left: 14px;
    z-index: 99;
    width: 44px;
    height: 44px;
    padding: 0;
    font-size: 22px;
}

.overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 95;
}

@supports (padding: max(0px)) {
    .chat-header {
        padding-top: max(12px, env(safe-area-inset-top));
        padding-left: max(18px, env(safe-area-inset-left));
        padding-right: max(18px, env(safe-area-inset-right));
    }
    
    .message-input-area {
        padding-bottom: max(12px, env(safe-area-inset-bottom));
        padding-left: max(16px, env(safe-area-inset-left));
        padding-right: max(16px, env(safe-area-inset-right));
    }
    
    .mobile-menu-btn {
        top: max(14px, env(safe-area-inset-top));
        left: max(14px, env(safe-area-inset-left));
    }
    
    .show-panel-btn {
        top: max(80px, calc(env(safe-area-inset-top) + 60px));
        left: max(16px, env(safe-area-inset-left));
    }
    
    .profile-header {
        padding-top: max(18px, env(safe-area-inset-top));
    }
}

@media (max-width: 812px) and (orientation: portrait) {
    .chat-header {
        padding-top: calc(12px + constant(safe-area-inset-top));
        padding-top: calc(12px + env(safe-area-inset-top));
    }
    
    .message-input-area {
        padding-bottom: calc(12px + constant(safe-area-inset-bottom));
        padding-bottom: calc(12px + env(safe-area-inset-bottom));
    }
    
    .mobile-menu-btn {
        top: calc(14px + constant(safe-area-inset-top));
        top: calc(14px + env(safe-area-inset-top));
    }
}

@media (max-width: 768px) {
    .mobile-menu-btn {
        display: flex;
    }
    
    .chats-panel {
        position: fixed;
        left: -370px;
        top: 0;
        height: 100vh;
        z-index: 100;
        width: 340px;
        transition: left 0.3s ease;
    }
    
    .chats-panel.open {
        left: 0;
    }
    
    .overlay.active {
        display: block;
    }
    
    .show-panel-btn {
        display: none !important;
    }
    
    .chat-header {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: space-between;
        padding: 10px 14px;
    }
    
    .chat-header-left {
        flex: 1;
        min-width: 0;
    }
    
    .chat-header-right {
        display: flex;
        gap: 8px;
        align-items: center;
        flex-shrink: 0;
        margin-left: auto;
    }
    
    .theme-btn {
        width: 28px;
        height: 28px;
    }
    
    .call-btn, .group-info-btn, .invite-btn {
        padding: 8px 12px;
        font-size: 14px;
        white-space: nowrap;
    }
    
    .message-bubble {
        max-width: 85%;
        padding: 9px 13px;
    }
    
    .message-media {
        max-width: 200px;
        max-height: 200px;
    }
    
    .message-video-circle {
        width: 140px;
        height: 140px;
    }
    
    .post-avatar {
        width: 38px;
        height: 38px;
    }
    
    .chat-avatar {
        width: 42px;
        height: 42px;
    }
    
    .friend-avatar {
        width: 38px;
        height: 38px;
    }
    
    .group-avatar {
        width: 42px;
        height: 42px;
    }
    
    .contact-avatar {
        width: 38px;
        height: 38px;
    }
    
    .message-input-area input {
        font-size: 16px;
    }
}

@media (max-width: 480px) {
    .chat-header {
        flex-direction: column;
        align-items: stretch;
    }
    
    .chat-header-left {
        width: 100%;
        justify-content: space-between;
    }
    
    .chat-header-right {
        width: 100%;
        justify-content: flex-end;
        margin-top: 8px;
    }
    
    .call-btn, .group-info-btn, .invite-btn {
        padding: 6px 10px;
        font-size: 12px;
    }
    
    .message-input-area {
        flex-wrap: wrap;
        padding: 10px 12px;
    }
    
    .message-input-area input {
        order: -1;
        width: 100%;
        margin-bottom: 8px;
    }
    
    .send-btn {
        margin-left: auto;
    }
    
    .message-video-circle {
        width: 120px;
        height: 120px;
    }
}

@media (max-width: 380px) {
    .chat-header-right {
        flex-wrap: wrap;
        justify-content: flex-end;
    }
    
    .call-btn, .group-info-btn, .invite-btn {
        padding: 5px 8px;
        font-size: 11px;
    }
}