@import url('common.css');

.container {
    max-width: none;
    margin: 0;
    padding: 0;
    height: 100vh;
}

/* Button Component */
.inline-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 0.375rem;
    background: none;
    border: none;
    cursor: pointer;
    color: hsl(var(--sidebar-foreground));
    transition: background-color 0.15s ease;
}

.inline-button:hover {
    background-color: hsl(var(--sidebar-accent));
}

.inline-button:focus-visible {
    outline: 2px solid transparent;
    outline-offset: 2px;
    --tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);
    --tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);
    box-shadow: var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 #0000);
    --tw-ring-color: hsl(var(--ring));
}

.inline-button:disabled {
    pointer-events: none;
    opacity: 0.5;
}

.inline-button.small {
    width: 24px;
    height: 24px;
    border-radius: 4px;
}

/* Input Component */
input[type="text"], textarea {
    display: flex;
    width: 100%;
    background-color: hsl(var(--card));
    color: hsl(var(--foreground));
    padding: 0.5rem 0.75rem;
    font-size: 1rem;
    line-height: 1.5;
    transition-property: color, background-color, border-color, text-decoration-color, fill, stroke;
    transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
    transition-duration: 150ms;
}

/* iOS Style Search Bar */
.search-input {
    border: none !important;
    background-color: hsl(var(--muted)) !important;
    border-radius: 0.75rem !important;
    box-shadow: none !important;
    padding-left: 38px !important; /* Override pl-11 to prevent text overlap with icon */
}

.lucide-search {
    top: 50% !important;
    transform: translateY(-50%) !important;
}

.search-input:focus-visible {
    outline: none !important;
    box-shadow: none !important;
    background-color: hsl(var(--muted)) !important;
}

#chatArea {
    min-width: 0;
}

/* Message Input Container Border */
#messageInputContainer {
    display: flex;
    flex-direction: column;
    border-top: 1px solid hsl(var(--sidebar-border)) !important;
    background-color: hsl(var(--sidebar-background));
    padding-top: 10px;
    padding-bottom: 10px;
}

/* Center chat title and subtitle text */
#chatTitle {
    text-align: center !important;
}

#chatSubtitle {
    text-align: center !important;
}

/* Profile Menu Styles */
.profile-menu {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 0.5rem;
    background-color: hsl(var(--background));
    border: 1px solid hsl(var(--border));
    border-radius: 0.5rem;
    box-shadow: var(--shadow-card);
    z-index: 50;
    min-width: 150px;
}

.profile-menu-item {
    width: 100%;
    padding: 0.75rem 1rem;
    text-align: left;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.875rem;
    transition: background-color 0.15s ease;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.profile-menu-item:hover {
    background-color: hsl(var(--accent));
}

.profile-menu-item:first-child {
    border-radius: 0.5rem 0.5rem 0 0;
}

.profile-menu-item:last-child {
    border-radius: 0 0 0.5rem 0.5rem;
}

.profile-menu-item:only-child {
    border-radius: 0.5rem; /* Full border radius for single item */
}

/* Fix message input width - target both containers */
#messageInputContainer > .flex {
    width: 100% !important;
}

#messageInput {
    flex: 1 !important;
    width: 100% !important;
    min-width: 0 !important;
}

/* Unified Avatar Styles */
.avatar-small {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    flex-shrink: 0;
    overflow: hidden;
    box-shadow: var(--shadow-soft);
    transition: transform 0.1s ease;
}

.avatar-small:hover {
    transform: scale(1.05);
}

.avatar-small img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

/* Avatar sizes by unique ID */
#sidebarCurrentUserAvatar {
    width: 34px;
    height: 34px;
    transition: transform 0.1s ease;
}

#sidebarCurrentUserAvatar:hover {
    transform: scale(1.05);
}

#chatHeaderAvatarContainer {
    width: 34px;
    height: 34px;
    overflow: visible; /* Allow status indicator to show */
    transition: transform 0.1s ease;
}

#chatHeaderAvatarContainer:hover {
    transform: scale(1.05);
}

.avatar-initials {
    display: flex;
    width: 100%;
    height: 100%;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    /* Default colors - overridden by inline styles for user-specific colors */
    background-color: hsl(var(--primary) / 0.1);
    color: hsl(var(--primary));
    font-weight: 600;
    font-size: 18pt;
    font-family: 'Chalkduster';
    cursor: default;
}

.avatar-initials.avatar-personal-notes-chat-list {
    font-size: 19pt;
    background-color: hsl(var(--muted));
}

#sidebarCurrentUserAvatar .avatar-initials {
    font-size: 13pt;
}

#chatHeaderAvatarContainer .avatar-initials {
    font-size: 13pt;
    background-color: hsl(var(--muted));
}

.message-row .avatar-initials {
    font-size: 12pt;
}

/* Avatar sizes by container (repeatable) */
.chat-item .avatar-small {
    width: 3rem;
    height: 3rem;
    font-size: 0.875rem;
    overflow: visible; /* Allow status indicator to show */
}

.user-item .avatar-small {
    width: 3rem;
    height: 3rem;
    font-size: 0.875rem;
}

.message-row .avatar-small {
    width: 2rem;
    height: 2rem;
    font-size: 0.75rem;
}

.message-row .avatar-small.incoming {
    margin-left: 15px;
    margin-right: 10px;
}

.message-row .avatar-small.outgoing {
    margin-left: 10px;
    margin-right: 15px;
}

.message-row .avatar-small[data-clickable="true"] {
    user-select: none;
}

/* Avatar visibility in message groups */
.message-row .avatar-small {
    visibility: visible;
}

.message-row.group-middle .avatar-small,
.message-row.group-last .avatar-small {
    visibility: hidden !important;
}

.message-row.group-first .avatar-small,
.message-row.group-single .avatar-small {
    visibility: visible !important;
}

/* Add shadow to date headers */
.date-header-text {
    box-shadow: var(--shadow-soft);
}

/* Title styling adjustments */
.h-header.bg-sidebar h1.text-2xl,
.user-selection-header h1.text-2xl {
    padding-left: 2px;
}

/* Send Button Animation */
#sendButton {
    transition: opacity 0.2s ease, transform 0.2s ease;
    transform-origin: center;
}

#sendButton.hidden {
    opacity: 0;
    transform: scale(0.8);
    pointer-events: none;
}

#sendButton.visible {
    opacity: 1;
    transform: scale(1);
    pointer-events: auto;
}

/* Emoji Picker Styling */
.emoji-picker {
    position: absolute;
    bottom: calc(100% + 8px);
    right: 0;
    width: 320px;
    height: 400px;
    background: hsl(var(--card));
    border: 1px solid hsl(var(--border));
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.emoji-search {
    width: 100%;
    padding: 8px 12px;
    font-size: 14px;
    outline: none;
    border: none !important;
    border-radius: 0px !important;
    background: hsl(var(--card));
    color: hsl(var(--foreground));
}

.emoji-tabs {
    display: flex;
    padding: 8px 12px;
    gap: 4px;
    background: hsl(var(--muted));
}

.emoji-tab {
    flex: 1;
    padding: 8px 4px;
    border: none;
    background: transparent;
    border-radius: 6px;
    font-size: 18px;
    cursor: pointer;
    transition: background-color 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.emoji-tab:hover {
    background: hsl(var(--sidebar-accent));
}

.emoji-tab.active {
    background: hsl(var(--accent));
    color: hsl(var(--accent-foreground));
}

.emoji-content {
    flex: 1;
    padding: 12px;
    overflow-y: auto;
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 4px;
    align-content: start;
    scrollbar-width: thin;
    border-top: 1px solid hsl(var(--border));
    border-bottom: 1px solid hsl(var(--border));
}

.emoji-item {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    border-radius: 6px;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease;
}

.emoji-item:hover {
    background: hsl(var(--sidebar-foreground) / 0.1);
}

.emoji-item:active {
    background: hsl(var(--sidebar-foreground) / 0.18);
}

/* Message Input Styling */
.message-input {
    border: none !important;
    background-color: transparent !important;
    box-shadow: none !important;
    padding: 0.5rem 0 !important;
    flex: 1 !important;
    width: 100% !important;
    min-width: 0 !important;
    font-family: inherit !important;
    font-size: inherit !important;
    resize: none !important;
    overflow-y: auto !important;
    line-height: 1.5 !important;
    min-height: 40px !important;
    scrollbar-width: thin;
}

.message-input::-webkit-scrollbar {
    width: 4px;
}

.message-input::-webkit-scrollbar-thumb {
    background-color: hsl(var(--muted-foreground) / 0.3);
    border-radius: 4px;
}

.message-input::-webkit-scrollbar-track {
    background: transparent;
}

.message-input:focus-visible {
    outline: none !important;
    box-shadow: none !important;
}

input[type="text"]:focus-visible, textarea:focus-visible {
    outline: 2px solid transparent;
    outline-offset: 2px;
    --tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);
    --tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);
    box-shadow: var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 #0000);
    --tw-ring-color: hsl(var(--ring));
}

input[type="text"]:disabled, textarea:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

.chat-container {
    display: flex;
    height: 100%;
    background: hsl(var(--background));
    border-radius: 0;
    overflow: hidden;
    box-shadow: none;
}

.chat-list {
    width: 320px;
    border-right: 1px solid hsl(var(--sidebar-border)) !important;
    background: hsl(var(--sidebar-background));
    display: flex;
    flex-direction: column;
}

.chat-list-header {
    padding: 16px 20px;
    border-bottom: 1px solid hsl(var(--sidebar-border));
    background: hsl(var(--sidebar-background));
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.current-user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}


.current-user-details {
    flex: 1;
}

.current-user-name {
    font-size: 1rem;
    font-weight: 600;
    color: #333;
    margin: 0;
    line-height: 1.2;
}

.current-user-status {
    font-size: 0.85rem;
    color: #666;
    margin: 0;
    line-height: 1.2;
}

.menu-button {
    width: 32px;
    height: 32px;
    border: none;
    background: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #666;
    font-size: 16px;
    transition: background-color 0.2s ease;
    position: relative;
}

.menu-button:hover {
    background-color: #f0f0f0;
}

.chat-items {
    flex: 1;
    overflow-y: auto;
    padding: 0;
}

.user-selection-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.3);
    display: none;
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.user-selection-modal.show {
    opacity: 1;
}

.user-selection-content {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 100%;
    max-width: 360px; /* Match sidebar width */
    background: hsl(var(--sidebar-background));
    display: flex;
    flex-direction: column;
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.15);
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.user-selection-modal.show .user-selection-content {
    transform: translateX(0);
}

.user-selection-header {
    height: var(--header-height);
    background: hsl(var(--sidebar-background));
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1rem;
}

/* User search uses same styling as chat search */

.users-list {
    flex: 1;
    overflow-y: auto;
    padding: 0;
    background: hsl(var(--sidebar-background));
}

.user-item {
    width: 100%;
    height: 70px;
    padding: 0 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: transparent;
    border: none;
    cursor: pointer;
    transition-property: color, background-color, border-color, text-decoration-color, fill, stroke;
    transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
    transition-duration: 150ms;
    text-align: left;
}

.user-item:hover {
    background-color: hsl(var(--sidebar-accent));
}


.user-item-info {
    flex: 1 1 0%;
    min-width: 0px;
    text-align: left;
}

.user-item-name {
    font-weight: 600;
    color: hsl(var(--sidebar-foreground));
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.875rem;
    margin-bottom: 0.25rem;
}

.user-item-username {
    font-size: 0.75rem;
    color: hsl(var(--muted-foreground));
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.users-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2.5rem;
    color: hsl(var(--muted-foreground));
}

.users-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    color: #666;
    text-align: center;
}

/* User Info Modal */
.user-info-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.3);
    display: none;
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.user-info-modal.show {
    opacity: 1;
}

.user-info-content {
    position: absolute;
    top: 0;
    right: 0;
    height: 100%;
    width: 100%;
    max-width: 360px;
    background: hsl(var(--sidebar-background));
    display: flex;
    flex-direction: column;
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.15);
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.user-info-modal.show .user-info-content {
    transform: translateX(0);
}

.user-info-header {
    height: var(--header-height);
    background: hsl(var(--sidebar-background));
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1rem;
}

.user-info-header h1.text-2xl {
    padding-left: 2px;
}

.user-info-body {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    padding-top: 0;
    background: hsl(var(--sidebar-background));
}

.user-info-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2.5rem;
    color: hsl(var(--muted-foreground));
}

.user-info-avatar-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.5rem;
    margin-top: 0;
    padding-top: 6px;
}

.user-info-avatar-wrapper {
    position: relative;
    display: inline-block;
    overflow: visible;
}

.user-info-avatar {
    position: relative;
    display: flex;
    overflow: visible;
    height: 250px;
    width: 250px;
    align-items: center;
    justify-content: center;
    transition: transform 0.1s ease;
}

.user-info-avatar:hover {
    transform: scale(1.05);
}

.user-info-avatar .avatar-initials {
    font-size: 86pt;
}

.user-info-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.user-info-name {
    font-size: 1.5rem;
    font-weight: 600;
    color: hsl(var(--sidebar-foreground));
    text-align: center;
    margin-bottom: 0.5rem;
}

.user-info-username {
    font-size: 0.875rem;
    color: hsl(var(--muted-foreground));
    text-align: center;
    margin-bottom: 1.5rem;
}

.user-info-section {
    margin-top: 30px;
    margin-bottom: 30px;
}

.user-info-section-title {
    font-size: 0.75rem;
    font-weight: 600;
    color: hsl(var(--muted-foreground));
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.75rem;
}

.user-info-about {
    color: hsl(var(--sidebar-foreground));
    font-size: 0.875rem;
    line-height: 1.5;
    padding: 0.75rem;
    background: hsl(var(--sidebar-accent));
    border-radius: 0.5rem;
}

.user-info-about.empty {
    color: hsl(var(--muted-foreground));
    font-style: italic;
}

.user-info-meta {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.user-info-meta-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: hsl(var(--sidebar-foreground));
    font-size: 0.875rem;
}

.user-info-meta-item svg {
    width: 16px;
    height: 16px;
    color: hsl(var(--muted-foreground));
    flex-shrink: 0;
}

.info-link {
    color: color-mix(in hsl, hsl(var(--primary)), white 10%);
    text-decoration: none;
    font-weight: 600;
}

.info-link:hover {
    text-decoration: underline;
}

/* Notes info share */
.notes-info-share {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.5rem 0.625rem 0.5rem 0.75rem;
    background: hsl(var(--sidebar-accent));
    border-radius: 0.5rem;
}

.notes-info-share-link {
    flex: 1;
    color: color-mix(in hsl, hsl(var(--primary)), white 10%);
    font-size: 0.8125rem;
    text-decoration: none;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
    border-radius: 3px;
    padding: 1px 2px;
}

.notes-info-share-link:hover {
    text-decoration: underline;
}

@keyframes notes-share-flash {
    0%   { background-color: hsl(var(--sidebar-accent)); }
    30%  { background-color: hsl(0 0% 100% / 0.25); }
    100% { background-color: hsl(var(--sidebar-accent)); }
}

.notes-info-share.flash {
    animation: notes-share-flash 0.5s ease;
}

.notes-info-share-copy {
    flex-shrink: 0;
    color: hsl(var(--muted-foreground));
}

.notes-info-share-copy:hover {
    color: hsl(var(--sidebar-foreground));
}

/* Group chat members grid */
.group-chat-members-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.5rem;
    padding: 0.5rem 0;
}

.group-chat-member-cell {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 0.5rem;
    border-radius: calc(var(--radius) - 2px);
    cursor: pointer;
    transition: background-color 0.15s ease;
    position: relative;
}

.group-chat-member-cell:hover {
    background-color: hsl(var(--muted));
}

.group-chat-member-cell.blocked {
    opacity: 0.6;
}

.inline-link-button {
    background: none;
    border: none;
    color: color-mix(in hsl, hsl(var(--primary)), white 10%);
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 700;
    padding: 0;
    margin-left: 0.5rem;
    text-decoration: none;
}

.inline-link-button:hover {
    text-decoration: underline;
}

.group-chat-member-cell .avatar-small {
    width: 48px;
    height: 48px;
    min-width: 48px;
    min-height: 48px;
    flex-shrink: 0;
}

.group-chat-member-cell .avatar-small .avatar-initials {
    width: 100%;
    height: 100%;
    font-size: 18pt;
}

.group-chat-member-name {
    font-size: 0.75rem;
    color: hsl(var(--sidebar-foreground));
    text-align: center;
    word-break: break-word;
    line-height: 1.2;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
}

.group-chat-member-cell .avatar-small.owner {
    outline: 2px solid hsl(var(--primary));
}

.user-info-status {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 0.75rem;
    background: hsl(var(--sidebar-accent));
    border-radius: 9999px;
    font-size: 0.75rem;
    color: hsl(var(--sidebar-foreground));
}

.user-info-status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #22c55e;
}

.user-info-status-indicator.offline {
    background-color: hsl(var(--muted-foreground));
}

/* New Chat Button */
.new-chat-button-container {
    padding: 12px 16px;
    background: hsl(var(--sidebar-background));
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* Settings Modal */
.settings-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.settings-modal.show {
    opacity: 1;
}

.settings-content {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 100%;
    max-width: 360px;
    background: hsl(var(--sidebar-background));
    display: flex;
    flex-direction: column;
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.15);
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.settings-modal.show .settings-content {
    transform: translateX(0);
}

.settings-header {
    height: var(--header-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1rem;
}

.settings-body {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    scrollbar-width: none;
}

.settings-section {
    margin-bottom: 1.5rem;
}

.settings-section:last-child {
    margin-bottom: 0;
}

.settings-group {
    margin-bottom: 0.5rem;
}

.settings-group-title {
    font-size: 0.875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: hsl(var(--muted-foreground));
    margin-bottom: 1.25rem;
}

.settings-label {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: hsl(var(--foreground));
    margin-bottom: 0.5rem;
}

.settings-select {
    width: 100%;
    padding: 0.4rem 0.625rem;
    font-size: 0.875rem;
    background: hsl(var(--muted));
    color: hsl(var(--foreground));
    border: 1px solid hsl(var(--border));
    border-radius: 0.5rem;
    cursor: pointer;
    outline: none;
    transition: border-color 0.15s ease;
}

.settings-select:focus {
    border-color: hsl(var(--primary));
}

.settings-divider {
    height: 1px;
    background: hsl(var(--border));
    margin: 1.25rem 0 1.75rem;
}

/* Appearance mode toggle */
.settings-mode-toggle {
    display: flex;
    background: hsl(var(--muted));
    border-radius: 0.5rem;
    padding: 3px;
    gap: 2px;
}

.settings-mode-btn {
    flex: 1;
    padding: 0.4rem 0;
    font-size: 0.875rem;
    font-weight: 500;
    border: none;
    background: transparent;
    color: hsl(var(--muted-foreground));
    border-radius: calc(0.5rem - 3px);
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.settings-mode-btn.active {
    background: hsl(var(--sidebar-background));
    color: hsl(var(--foreground));
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.settings-color-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.75rem;
    padding: 1rem 0;
}

.settings-color-swatch {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
    cursor: pointer;
}

.settings-color-swatch-circle {
    width: 44px;
    height: 44px;
    border-radius: 9999px;
    transition: transform 0.15s ease, outline-color 0.15s ease;
    outline: 2px solid transparent;
    outline-offset: 3px;
}

.settings-color-swatch:hover .settings-color-swatch-circle {
    transform: scale(1.1);
}

.settings-color-swatch.active .settings-color-swatch-circle {
    outline-color: var(--swatch-color);
}

.settings-color-swatch-label {
    font-size: 0.7rem;
    color: hsl(var(--muted-foreground));
    text-align: center;
}

/* Journal settings dropdowns */
.settings-dropdown {
    width: 100%;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: hsl(var(--foreground));
    background: hsl(var(--muted));
    border: 1px solid hsl(var(--border));
    border-radius: 0.5rem;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    padding-right: 2rem;
    transition: border-color 0.15s ease;
}

.settings-dropdown:focus {
    outline: none;
    border-color: hsl(var(--ring));
}

.settings-dropdown option {
    background: hsl(var(--background));
    color: hsl(var(--foreground));
}

/* Custom font dropdown */
.settings-font-select {
    position: relative;
    width: 100%;
}

.settings-font-trigger {
    width: 100%;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: hsl(var(--foreground));
    background: hsl(var(--muted));
    border: 1px solid hsl(var(--border));
    border-radius: 0.5rem;
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    padding-right: 2rem;
    transition: border-color 0.15s ease;
    box-sizing: border-box;
}

.settings-font-trigger.open {
    border-color: hsl(var(--primary));
}

.settings-font-dropdown {
    display: none;
    position: absolute;
    left: 0;
    right: 0;
    top: calc(100% + 4px);
    max-height: 260px;
    overflow-y: auto;
    background: hsl(var(--background));
    border: 1px solid hsl(var(--border));
    border-radius: 0.5rem;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    z-index: 10;
    scrollbar-width: thin;
}

.settings-font-dropdown.show {
    display: block;
}

.settings-font-group-label {
    padding: 0.4rem 0.75rem 0.2rem;
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: hsl(var(--muted-foreground));
    pointer-events: none;
}

.settings-font-divider {
    height: 1px;
    background: hsl(var(--border));
    margin: 0.35rem 0.5rem;
}

.settings-font-item {
    padding: 0.4rem 0.75rem;
    font-size: 0.9375rem;
    color: hsl(var(--foreground));
    cursor: pointer;
    transition: background-color 0.1s ease;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.settings-font-item:hover {
    background: hsl(var(--muted));
}

.settings-font-item.active {
    color: hsl(var(--primary-hsl));
    font-weight: 600;
    background: hsl(var(--muted));
}

/* Dashboard Panel */
.settings-header-buttons {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.dashboard-info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.4rem 0;
}

.dashboard-info-label {
    font-size: 0.875rem;
    color: hsl(var(--muted-foreground));
}

.dashboard-info-value {
    font-size: 0.875rem;
    color: hsl(var(--foreground));
    font-weight: 500;
}

.dashboard-loading,
.dashboard-error {
    font-size: 0.875rem;
    color: hsl(var(--muted-foreground));
}

.dashboard-actions {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.dashboard-button {
    width: 100%;
    padding: 0.625rem;
    font-size: 0.875rem;
    font-weight: 500;
    border: 1px solid hsl(var(--border));
    border-radius: 0.5rem;
    background: hsl(var(--muted));
    color: hsl(var(--foreground));
    cursor: pointer;
    transition: background 0.15s ease;
}

.dashboard-button:hover {
    background: hsl(var(--accent));
}

.dashboard-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.dashboard-button-warning {
    background: hsl(0 60% 50% / 0.15);
    border-color: hsl(0 60% 50% / 0.3);
    color: hsl(0 60% 60%);
}

.dashboard-button-warning:hover {
    background: hsl(0 60% 50% / 0.25);
}

.dashboard-log {
    margin: 0;
    margin-top: 0.75rem;
    padding: 0.75rem;
    font-size: 0.75rem;
    font-family: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, monospace;
    color: hsl(var(--muted-foreground));
    background: hsl(var(--muted));
    border: 1px solid hsl(var(--border));
    border-radius: 0.5rem;
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 12rem;
    overflow-y: auto;
}

.dashboard-log-error {
    color: hsl(0 60% 60%);
    background: hsl(0 60% 50% / 0.08);
    border-color: hsl(0 60% 50% / 0.2);
}

.dashboard-log-success {
    color: hsl(140 60% 60%);
    background: hsl(140 60% 50% / 0.08);
    border-color: hsl(140 60% 50% / 0.2);
}

/* Server message textarea */
.settings-message-textarea,
.settings-input {
    width: 100%;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    color: hsl(var(--foreground));
    background: hsl(var(--muted));
    border: 1px solid hsl(var(--border));
    border-radius: 0.5rem;
    font-family: inherit;
    transition: border-color 0.15s ease;
    box-sizing: border-box;
}

.settings-message-textarea {
    resize: vertical;
    min-height: 4.5rem;
    line-height: 1.5;
}

.settings-message-textarea:focus,
.settings-input:focus {
    outline: none;
    border-color: hsl(var(--ring));
}

/* Server message banner */
.server-message-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 9999;
    height: var(--header-height);
    background: hsl(var(--muted));
    border-bottom: 1px solid hsl(var(--border));
    padding: 0 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    opacity: 0;
    transform: translateY(-100%);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.server-message-banner.show {
    opacity: 1;
    transform: translateY(0);
}

.server-message-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: hsl(var(--muted-foreground));
}

.server-message-text {
    flex: 1;
    font-size: 0.875rem;
    color: hsl(var(--foreground));
}

.server-message-dismiss {
    background: none;
    border: none;
    color: hsl(var(--muted-foreground));
    cursor: pointer;
    padding: 0.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.7;
    transition: opacity 0.15s ease;
}

.server-message-dismiss:hover {
    opacity: 1;
}

/* Group Chat Modal */
.group-chat-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.3);
    display: none;
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.group-chat-modal.show {
    opacity: 1;
}

.group-chat-content {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 100%;
    max-width: 360px;
    background: hsl(var(--sidebar-background));
    display: flex;
    flex-direction: column;
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.15);
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.group-chat-modal.show .group-chat-content {
    transform: translateX(0);
}

/* Right-side positioning for add users mode */
.group-chat-content.slide-from-right {
    left: auto;
    right: 0;
    transform: translateX(100%);
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.15);
}

.group-chat-modal.show .group-chat-content.slide-from-right {
    transform: translateX(0);
}

.group-chat-header {
    height: var(--header-height);
    background: hsl(var(--sidebar-background));
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1rem;
}

.group-chat-header > div:first-child {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.group-chat-body {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

/* Group Chat Avatar */
.group-chat-avatar-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px;
}

.group-chat-avatar-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.group-chat-avatar {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    background: hsl(var(--muted));
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    transition: transform 0.1s ease;
}

.group-chat-avatar:hover {
    transform: scale(1.05);
}

.group-chat-avatar svg {
    color: hsl(var(--muted-foreground));
}

.group-chat-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.group-chat-avatar-remove {
    position: absolute;
    top: 0;
    right: 0;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: hsl(var(--destructive));
    color: hsl(var(--destructive-foreground));
    border: 2px solid hsl(var(--sidebar-background));
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.15s ease;
}

.group-chat-avatar-remove:hover {
    transform: scale(1.1);
}

.group-chat-avatar-progress {
    position: absolute;
    top: -4px;
    left: -4px;
    width: 158px;
    height: 158px;
    transform: rotate(-90deg);
    pointer-events: none;
}

.group-chat-avatar-progress-bg {
    fill: none;
    stroke: hsl(var(--muted));
    stroke-width: 3;
}

.group-chat-avatar-progress-bar {
    fill: none;
    stroke: hsl(var(--primary));
    stroke-width: 3;
    stroke-linecap: round;
    stroke-dasharray: 301.6;
    stroke-dashoffset: 301.6;
    transition: stroke-dashoffset 0.1s ease;
}

/* Group Chat Name Input */
.group-chat-name-section {
    padding: 0px;
}

.group-chat-name-input {
    width: 100%;
    padding: 8px 0 !important;
    font-size: 1.5rem !important;
    font-weight: 500;
    border: none !important;
    background: transparent !important;
    color: hsl(var(--foreground));
    outline: none;
    text-align: center;
    box-shadow: none !important;
}

.group-chat-name-input::placeholder {
    color: hsl(var(--muted-foreground));
}

/* Group Chat Users List */
.group-chat-users-list {
    flex: 1;
    overflow-y: auto;
    min-height: 200px;
    background: hsl(var(--sidebar-background));
}

.group-user-item {
    width: 100%;
    height: 70px;
    padding: 0 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: transparent;
    border: none;
    cursor: pointer;
}

.group-user-item:hover {
    background-color: hsl(var(--sidebar-accent));
}

.group-user-item.selected {
    background-color: hsl(var(--sidebar-accent));
}

.group-user-item .avatar-small {
    width: 3rem;
    height: 3rem;
    font-size: 0.875rem;
}

/* iOS-style round checkbox */
.group-user-checkbox {
    width: 22px;
    height: 22px;
    border: 2px solid hsl(var(--muted-foreground) / 0.4);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.15s ease;
    margin-left: auto;
}

.group-user-checkbox.checked {
    background: hsl(var(--primary));
    border-color: hsl(var(--primary));
    color: hsl(var(--primary-foreground));
}

/* Group Chat Actions */
.group-chat-actions {
    padding: 16px;
    background: hsl(var(--sidebar-background));
}

.group-chat-selected-count {
    text-align: center;
    font-size: 0.875rem;
    color: hsl(var(--muted-foreground));
    margin-bottom: 12px;
}

.group-chat-create-btn {
    width: 100%;
    padding: 12px 16px;
    background: hsl(var(--primary));
    color: hsl(var(--primary-foreground));
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.15s ease, opacity 0.15s ease;
}

.group-chat-create-btn:hover:not(:disabled) {
    background: hsl(var(--primary) / 0.9);
}

.group-chat-create-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Current User Profile Modal Styles */
.user-profile-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.3);
    display: none;
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.user-profile-modal.show {
    opacity: 1;
}

.user-profile-content {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 100%;
    max-width: 360px;
    background: hsl(var(--sidebar-background));
    display: flex;
    flex-direction: column;
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.15);
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.user-profile-modal.show .user-profile-content {
    transform: translateX(0);
}

.user-profile-header {
    height: var(--header-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1rem;
}

.user-profile-body {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    padding-top: 0;
    scrollbar-width: none;
}

.user-profile-loading,
.user-profile-error {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2.5rem;
    color: hsl(var(--muted-foreground));
}

.user-profile-error {
    color: #ef4444;
}

.user-profile-error:not(:empty) {
    padding: 0.75rem 1rem;
    background: rgba(239, 68, 68, 0.1);
    border-radius: 0.5rem;
    font-size: 0.875rem;
}

.user-profile-success {
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
    background: hsl(var(--primary) / 0.1);
    color: hsl(var(--primary));
    border-radius: 0.5rem;
    font-size: 0.875rem;
    text-align: center;
}

.user-profile-avatar-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.5rem;
    margin-top: 0;
    padding-top: 0;
}

.user-profile-avatar-wrapper {
    position: relative;
    display: inline-block;
    overflow: visible;
}

.user-profile-avatar {
    position: relative;
    display: flex;
    overflow: visible;
    border-radius: 9999px;
    height: 250px;
    width: 250px;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    box-shadow: none;
    transition: opacity 0.3s ease;
}

.user-profile-avatar .avatar-initials {
    font-size: 86pt;
}

.user-profile-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.user-profile-avatar-progress {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 250px;
    height: 250px;
    z-index: 10;
    pointer-events: none;
}

.user-profile-avatar-progress-bg {
    fill: none;
    stroke: hsl(var(--muted));
    stroke-width: 4;
}

.user-profile-avatar-progress-bar {
    fill: none;
    stroke: hsl(var(--primary));
    stroke-width: 4;
    stroke-linecap: round;
    stroke-dasharray: 302;
    stroke-dashoffset: 302;
    transform: rotate(-90deg);
    transform-origin: 50% 50%;
    transition: stroke-dashoffset 0.3s ease-out;
}

.ellipsis-button {
    font-size: 1.35rem;
    line-height: 1;
    letter-spacing: -0.125rem;
    color: hsl(var(--muted-foreground));
    transform: translateY(-1px);
    gap: 0.5rem;
    background: transparent;
    cursor: pointer;
    border: none;
    align-items: center;
    justify-content: center;
    /* transform: rotate(90deg); */
}

/* User profile avatar menu button */
#userProfileAvatarMenuButton {
    position: absolute;
    bottom: 4px;
    right: 4px;
    border: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: opacity 0.2s ease;
    opacity: 0;
}

.user-profile-avatar-wrapper:hover #userProfileAvatarMenuButton {
    opacity: 1;
}

/* Avatar menu uses absolute positioning */
.user-profile-avatar-wrapper .context-menu {
    position: absolute;
    bottom: 48px;
    right: 8px;
    z-index: 30;
}

/* Group chat avatar menu button */
#groupChatAvatarMenuButton {
    position: absolute;
    bottom: 4px;
    right: 4px;
    border: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: opacity 0.2s ease;
    opacity: 0;
}

.user-info-avatar-wrapper:hover #groupChatAvatarMenuButton {
    opacity: 1;
}

.user-profile-avatar-chevron {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: transparent;
    color: hsl(var(--foreground));
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 15;
    transition: transform 0.2s ease, opacity 0.2s ease;
    box-shadow: none;
}

.user-profile-avatar-chevron-left {
    left: -35px;
}

.user-profile-avatar-chevron-right {
    right: -35px;
}

.user-profile-avatar-chevron:hover {
    transform: translateY(-50%) scale(1.1);
    opacity: 0.7;
}

.user-profile-avatar-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
    margin-top: 1rem;
}

.user-profile-avatar-pagination-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    border: none;
    background-color: hsl(var(--foreground) / 0.15);
    cursor: pointer;
    transition: background-color 0.2s ease;
    padding: 0;
}

.user-profile-avatar-pagination-dot:hover {
    background-color: hsl(var(--foreground) / 0.25);
}

.user-profile-avatar-pagination-dot.active {
    background-color: hsl(var(--primary));
}

.user-profile-avatar-error {
    margin-top: 1rem;
    padding: 0.75rem 1rem;
    background-color: hsl(var(--destructive) / 0.1);
    border: 1px solid hsl(var(--destructive) / 0.3);
    border-radius: 0.5rem;
    text-align: center;
    max-width: 300px;
}

.user-profile-avatar-error-message {
    color: hsl(var(--destructive));
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
}

.user-profile-avatar-retry-btn {
    background-color: hsl(var(--destructive));
    color: hsl(var(--destructive-foreground));
    border: none;
    border-radius: 0.375rem;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s ease;
}

.user-profile-avatar-retry-btn:hover {
    opacity: 0.9;
}

/* Full Screen Avatar Viewer */
.media-viewer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.media-viewer-content {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: default;
}

.media-viewer-top-bar {
    width: 100%;
    height: 60px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    z-index: 10001;
    background-color: rgba(0, 0, 0, 0.4);
}

.media-viewer-top-bar-left {
    flex: 1;
    min-width: 0;
}

.media-viewer-top-bar-center {
    flex: 0 1 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 0;
    text-align: center;
}

.media-viewer-message-preview {
    color: white;
    font-size: 0.875rem;
    font-weight: 500;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 400px;
}

.media-viewer-date {
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.75rem;
    line-height: 1.3;
}

.media-viewer-top-bar-right {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.5rem;
}

.media-viewer-action-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.1);
    color: white;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.media-viewer-action-btn:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

.media-viewer-close {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.1);
    color: white;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.media-viewer-close:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

.media-viewer-content-container {
    position: relative;
    width: 100%;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 2rem;
    min-height: 0;
    overflow: hidden;
}

.media-viewer-media {
    display: flex;
    align-items: center;
    justify-content: center;
    max-width: 100%;
    max-height: 100%;
    width: 100%;
    height: 100%;
}

.media-viewer-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 0.5rem;
}

.media-viewer-video {
    max-width: 100%;
    max-height: 100%;
    border-radius: 0.5rem;
    outline: none;
}

.media-viewer-chevron {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.1);
    color: white;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10001;
    transition: background-color 0.2s ease, transform 0.2s ease;
}

.media-viewer-chevron:hover {
    background-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-50%) scale(1.1);
}

.media-viewer-chevron-left {
    left: 2rem;
}

.media-viewer-chevron-right {
    right: 2rem;
}

.media-viewer-bottom-bar {
    width: 100%;
    height: 60px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10001;
    background-color: rgba(0, 0, 0, 0.4);
}

.media-viewer-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 7.5px;
}

.media-viewer-pagination-dot {
    width: 7.5px;
    height: 7.5px;
    border-radius: 50%;
    border: none;
    background-color: hsl(0 0% 100% / 0.3);
    cursor: pointer;
    transition: background-color 0.2s ease;
    padding: 0;
}

.media-viewer-pagination-dot:hover {
    background-color: hsl(0 0% 100% / 0.5);
}

.media-viewer-pagination-dot.active {
    background-color: hsl(0 0% 100%);
}

.user-profile-section {
    margin-bottom: 1.5rem;
}

.user-profile-section-title {
    font-size: 0.75rem;
    font-weight: 600;
    color: hsl(var(--muted-foreground));
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.75rem;
}

.user-profile-name-input {
    width: 100%;
    padding: 10px 0px !important;
    background: transparent !important;
    border: none;
    border-bottom: 2px solid hsl(var(--border));
    border-radius: 0;
    color: hsl(var(--sidebar-foreground));
    font-size: 0.875rem;
    font-family: inherit;
    transition: border-color 0.2s ease;
}

.user-profile-name-input:focus {
    outline: none;
    border-color: hsl(var(--primary));
}

/* Group name input container with inline save button */
.group-name-input-container {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
}

.group-name-input-container .user-profile-name-input,
.group-name-input-container .user-profile-about-input {
    flex: 1;
}

.group-name-save-btn {
    display: none;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    margin-left: -30px;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: hsl(var(--foreground));
    cursor: pointer;
    transition: all 0.2s ease, opacity 0.3s ease, transform 0.3s ease;
    flex-shrink: 0;
    opacity: 1;
}

.group-name-save-btn:hover:not(:disabled) {
    background: hsl(var(--sidebar-accent-foreground) / 0.1);
    transform: scale(1.05);
}

.group-name-save-btn:disabled {
    cursor: not-allowed;
}

.group-name-save-btn .checkmark-save-icon {
    display: none;
}

/* Idle/default state - show checkmark */
.group-name-save-btn:not(.saving):not(.success) .checkmark-save-icon:not(.checkmark-save-icon-saving) {
    display: block;
}

/* Saving state - show spinner */
.group-name-save-btn.saving .checkmark-save-icon-saving {
    display: block;
    animation: spin 1s linear infinite;
}

/* Success state - show green filled checkmark */
.group-name-save-btn.success {
    background: hsl(var(--primary));
    color: white;
}

.group-name-save-btn.success .checkmark-save-icon:not(.checkmark-save-icon-saving) {
    display: block;
}

/* Hiding state - fade out */
.group-name-save-btn.hiding {
    opacity: 0;
    transform: scale(0.8);
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.user-profile-username {
    color: hsl(var(--sidebar-foreground));
    font-size: 0.875rem;
    padding: 10px 0px;
    border: none;
    border-bottom: 2px solid hsl(var(--border));
    border-radius: 0;
}

.user-profile-about-input {
    width: 100%;
    min-height: 50px;
    padding: 10px 0px;
    border: none;
    border-bottom: 2px solid hsl(var(--border));
    border-radius: 0;
    color: hsl(var(--sidebar-foreground));
    font-size: 0.875rem;
    font-family: inherit;
    resize: vertical;
    transition: border-color 0.2s ease;
    background: transparent !important;
}

.user-profile-about-input:focus {
    outline: none;
    border-color: hsl(var(--primary));
}

.user-profile-actions {
    display: flex;
    flex-direction: column;
    gap: 40px;
    margin-top: 2rem;
}

.user-profile-save-btn {
    padding: 0.75rem 1.5rem;
    background: hsl(var(--primary));
    color: hsl(var(--primary-foreground));
    border: none;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s ease;
}

.user-profile-save-btn:hover {
    opacity: 0.9;
}

.user-profile-logout-btn {
    background: transparent;
    padding: 0.75rem 1.5rem;
    border: 0px solid;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.user-profile-logout-icon {
    flex-shrink: 0;
}

/* Change Password Styles */
.change-password-form {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.user-profile-save-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Chat Item Styles */
.chat-item {
    width: 100%;
    padding: 1rem;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    background: transparent;
    border: none;
    transition-property: color, background-color, border-color, text-decoration-color, fill, stroke;
    transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
    transition-duration: 150ms;
    text-align: left;
}

.chat-item:hover {
    background-color: hsl(var(--sidebar-accent));
}

.chat-item.active {
    background-color: hsl(var(--sidebar-accent));
}

.chat-item.active .chat-status-indicator,
.chat-item:hover .chat-status-indicator {
    border-color: hsl(var(--sidebar-accent));
}


.chat-status-indicator {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 0.75rem;
    height: 0.75rem;
    background-color: #22c55e;
    border: 2px solid hsl(var(--sidebar-background));
    border-radius: 9999px;
}

/* Chat header status indicator */
.chat-header-status-indicator {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 0.75rem;
    height: 0.75rem;
    background-color: #22c55e;
    border: 2px solid hsl(var(--sidebar-background));
    border-radius: 9999px;
    z-index: 20; /* Ensure it appears above other elements */
}

.chat-info {
    flex: 1 1 0%;
    min-width: 0px;
    text-align: left;
    padding-top: 4px;
}

.chat-header-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.25rem;
}

.chat-name {
    font-weight: 600;
    color: hsl(var(--sidebar-foreground));
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.875rem;
}

.chat-time {
    font-size: 0.75rem;
    color: hsl(var(--muted-foreground));
    flex-shrink: 0;
}

.chat-filters {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.chat-filter-pill {
    padding: 4px 12px;
    border-radius: 13px;
    height: 26px;
    font-size: 0.75rem;
    font-weight: 500;
    color: hsl(var(--muted-foreground));
    background-color: hsl(var(--muted));
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.chat-filter-pill:hover {
    background-color: hsl(var(--muted) / 0.8);
}

.chat-filter-pill.active {
    background-color: rgb(82, 82, 86);
    color: hsl(var(--primary-foreground));
}

.chat-message-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.chat-last-message {
    font-size: 0.875rem;
    color: hsl(var(--muted-foreground));
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chat-last-message.unread {
    font-weight: 600;
    color: hsl(var(--foreground));
}

.chat-muted-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    background-color: hsl(var(--muted));
    border-radius: 11px;
    height: 22px;
    font-size: 10px;
    font-weight: 600;
    color: hsl(var(--muted-foreground));
    white-space: nowrap;
    border-width: 2px;
    border-style: solid;
    border-color: hsl(var(--primary-foreground));
}

.chat-muted-text {
    line-height: 1;
}

.chat-badge {
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: 600;
    background-color: hsl(var(--primary));
    color: hsl(var(--primary-foreground));
    box-shadow: var(--shadow-soft);
    flex-shrink: 0;
    min-width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: hsl(var(--background));
}

.chat-header {
    padding: 8px 16px;
    background: hsl(var(--sidebar-background));
    height: 60px;
    display: flex;
    align-items: center;
    gap: 12px;
}


.chat-header-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.chat-header h2 {
    font-size: 1.2rem;
    color: hsl(var(--sidebar-foreground));
    margin: 0 0 2px 0;
}

.chat-header p {
    color: hsl(var(--sidebar-foreground) / 0.6);
    font-size: 0.9rem;
    margin: 0;
}

.messages-container {
    padding-bottom: 25px;
    min-height: 100%;
    display: flex;
    flex-direction: column;
}

.messages-container:has(.no-messages),
.messages-container:has(.no-chat-selected) {
    justify-content: center;
    align-items: center;
}

.message-author {
    font-weight: 600;
    font-size: 0.8rem;
    margin-bottom: 4px;
    color: #666;
    padding: 0 5px;
}

/* Override space-y-2 utility class for message spacing */
#messagesContainer > .message-row {
    margin-top: 12px !important; /* Default gap between groups */
    margin-bottom: 0 !important;
}

#messagesContainer > .message-row:first-child {
    margin-top: 0 !important;
}

/* Tighter spacing for connected bubbles within groups */
#messagesContainer > .message-row.group-middle,
#messagesContainer > .message-row.group-last {
    margin-top: 2px !important; /* Small gap within group */
}

.message-row-content.menu-active {
    background-color: hsl(var(--muted));
}

.message-row-content {
    display: flex;
}

.message-content-wrapper {
    max-width: 45%;
}

.message-row.own .message-row-content {
    flex-direction: row-reverse;
    margin-left: auto;
}

/* Spacing for message groups */
.message-row.group-first {
    margin-top: 1rem; /* Space before new group starts */
}

.message-row.group-single {
    margin-top: 1rem; /* Space before single message */
    margin-bottom: 1rem; /* Space after single message */
}

.message-row.group-last {
    margin-bottom: 1rem; /* Space after group ends */
}

.message-bubble {
    max-width: 100%;
    background-color: hsl(var(--chat-bubble-received));
    color: hsl(var(--chat-bubble-received-foreground));
    box-shadow: var(--shadow-soft);
    overflow: hidden;
    border: 1px solid hsl(var(--chat-bubble-received));
    display: flex;
    flex-direction: column;
    min-height: 35px;
}

.message-author-name {
    font-size: 0.75rem;
    color: hsl(var(--muted-foreground));
    margin-bottom: 0.25rem;
}

.message-row.own .message-author-name {
    display: none; /* Hide author name for own messages */
}

/* Author name visibility: show only for first message in group */
.message-row .message-author-name {
    display: block; /* Default visible */
}

/* Hide author name for middle and last messages in group */
.message-row.group-middle .message-author-name,
.message-row.group-last .message-author-name {
    display: none;
}

/* Explicitly ensure first and single messages show author name */
.message-row.group-first .message-author-name,
.message-row.group-single .message-author-name {
    display: block;
}

.message-text-container {
    display: flex;
    align-items: flex-end;
    background-color: transparent;
}

.message-row.own .message-bubble {
    background: linear-gradient(-10deg, hsl(var(--primary)), hsl(var(--primary) / 1.0));
    color: hsl(var(--primary-foreground));
    border-color: hsl(var(--primary));
}

/* Message grouping corner radius styles with higher specificity */
/* Border-radius order: top-left, top-right, bottom-right, bottom-left */

/* Regular messages (left side - avatar on left) */
.message-row.group-first .message-bubble {
    /* First in group: normal top corners, small bottom corner near avatar (connects to next message) */
    border-radius: var(--bubble-border-radius) var(--bubble-border-radius) var(--bubble-border-radius) 5px !important;
}

.message-row.group-middle .message-bubble {
    /* Middle: small corners near avatar (connects to prev/next), normal far corners */
    border-radius: 5px var(--bubble-border-radius) var(--bubble-border-radius) 5px !important;
}

.message-row.group-last .message-bubble {
    /* Last in group: small top corner near avatar (connects to prev), normal bottom corners */
    border-radius: 5px var(--bubble-border-radius) var(--bubble-border-radius) var(--bubble-border-radius) !important;
}

.message-row.group-single .message-bubble {
    /* Single message: all corners normal */
    border-radius: var(--bubble-border-radius) !important;
}

/* Own messages (right side - avatar on right) */
.message-row.own.group-first .message-bubble {
    /* First in group: normal top corners, small bottom corner near avatar (connects to next message) */
    border-radius: var(--bubble-border-radius) var(--bubble-border-radius) 5px var(--bubble-border-radius) !important;
}

.message-row.own.group-middle .message-bubble {
    /* Middle: small corners near avatar (connects to prev/next), normal far corners */
    border-radius: var(--bubble-border-radius) 5px 5px var(--bubble-border-radius) !important;
}

.message-row.own.group-last .message-bubble {
    /* Last in group: small top corner near avatar (connects to prev), normal bottom corners */
    border-radius: var(--bubble-border-radius) 5px var(--bubble-border-radius) var(--bubble-border-radius) !important;
}

.message-row.own.group-single .message-bubble {
    /* Single message: all corners normal */
    border-radius: var(--bubble-border-radius) !important;
}

.message-text {
    white-space: pre-wrap;
    word-wrap: break-word;
    align-self: flex-start; /* Align text to top of bubble */
    font-size: 1rem;
    flex: 1;
    display: flex;
    align-items: center;
    padding: 6px 10px;
    margin: 1px;
}

.message-timestamp-area {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-end;
    flex-shrink: 0;
}

.message-row.own .message-time {
    color: hsl(var(--primary-foreground) / 0.9);
}

.message-status-icon {
    color: hsl(var(--primary-foreground) / 0.9);
}

.message-sending-icon {
    color: hsl(var(--primary-foreground) / 0.9);
}

.message-status-area {
    width: 17px;
    display: flex;
    justify-content: center;
    padding-right: 4px;
}

.message-status-read-mark {
    position: relative;
}

/* Popup Toolbar */
.popup-toolbar {
    position: fixed;
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 3px;
    background-color: hsl(var(--popover));
    border: none;
    border-radius: 0.375rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    animation: context-menu-fade-in 0.18s ease forwards;
    box-sizing: border-box;
}

.popup-toolbar .inline-button {
    width: calc(2.25rem - 6px);
    height: calc(2.25rem - 6px);
    border-radius: calc(0.375rem - 2px);
    flex-shrink: 0;
}

.popup-toolbar .inline-button svg {
    width: 16px;
    height: 16px;
}

/* Context Menu - Unified menu styles */
@keyframes context-menu-fade-in {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.context-menu {
    position: fixed;
    background-color: hsl(var(--popover));
    border: 1px solid hsl(var(--border));
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    padding: 6px;
    z-index: 1000;
    min-width: 160px;
    display: flex;
    flex-direction: column;
    animation: context-menu-fade-in 0.18s ease forwards;
}

.context-menu-separator {
    height: 1px;
    background-color: hsl(var(--border));
    margin: 6px 0;
}

.context-menu-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    cursor: pointer;
    border-radius: 8px;
    color: hsl(var(--popover-foreground));
    font-size: 0.875rem;
    transition: background-color 0.15s ease;
    text-align: left;
    background: transparent;
    border: none;
    width: 100%;
}

.context-menu-item:hover {
    background-color: hsl(var(--muted));
}

.context-menu-item svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    color: hsl(var(--popover-foreground));
}

.context-menu-item span {
    flex: 1;
}

.context-menu-item[data-action="delete"] {
    color: hsl(var(--destructive));
}

.context-menu-item[data-action="delete"]:hover {
    background-color: hsl(var(--destructive) / 0.1);
}

.context-menu-item[data-action="delete"] svg {
    color: hsl(var(--destructive));
}

/* Date Header Styles */
.date-header {
    display: flex;
    justify-content: center;
    padding-top: 15px;
}

.date-header-text {
    background-color: hsl(var(--muted));
    color: hsl(var(--muted-foreground));
    padding: 0.25rem 0.75rem;
    border-radius: 1rem;
    font-size: 0.75rem;
}

/* Date header inside message element */
.message-date-header {
    display: flex;
    justify-content: center;
    align-items: center;
    padding-top: 15px;
    padding-bottom: 10px;
    width: 100%;
}

.message-text a {
    color: inherit;
    text-decoration: underline;
    word-break: break-all;
}

.message-text a:hover {
    text-decoration: none;
    opacity: 0.8;
}

.message.own .message-text a {
    color: rgba(255, 255, 255, 0.9);
}

.message.own .message-text a:hover {
    color: white;
}

.message-time {
    font-size: 8.5pt;
    padding: 1px;
    padding-right: 4px;
    color: hsl(var(--foreground) / 0.5);
}

.no-chat-selected {
    color: hsl(var(--muted-foreground));
    font-size: 1rem;
    text-align: center;
}

.no-messages {
    color: hsl(var(--muted-foreground));
    font-size: 1rem;
    text-align: center;
}

.blocked-chat-load-btn {
    color: hsl(var(--primary));
    cursor: pointer;
}

.no-chats-container {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    height: 100%;
}

.find-users-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: hsl(var(--muted-foreground));
    text-decoration: none;
    font-size: 1rem;
    padding: 12px 20px;
    border-radius: 8px;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.find-users-link:hover {
    background-color: hsl(var(--accent));
    color: hsl(var(--accent-foreground));
}

.no-chats-label {
    color: hsl(var(--muted-foreground));
    font-size: 1rem;
    padding: 12px 20px;
}

.message-error {
    color: #e74c3c;
    font-size: 16px;
    margin-right: 8px;
    cursor: pointer;
    align-self: flex-end;
    padding-bottom: 3px;
    flex-shrink: 0;
}

@media (max-width: 768px) {
    .container {
        padding: 0;
        height: 100vh;
    }
    
    .chat-container {
        border-radius: 0;
    }
    
    .chat-list {
        width: 100%;
        position: absolute;
        left: 0;
        top: 0;
        height: 100%;
        z-index: 10;
        transition: transform 0.3s ease;
    }
    
    .chat-list.hidden {
        transform: translateX(-100%);
    }
    
    .chat-content {
        width: 100%;
    }
    
    .chat-item .avatar-small {
        width: 2.5rem;
        height: 2.5rem;
        font-size: 0.75rem;
    }
    
    .message-row .avatar-small {
        width: 1.75rem;
        height: 1.75rem;
        font-size: 0.6875rem;
    }
    
    .user-selection-content {
        width: 100%;
        max-width: 100%;
    }
}

/* Attachment Preview Area */
#messageInputContainer {
    display: flex;
    flex-direction: column;
}

#mediaPanelContainer {
    margin-bottom: 10px;
    width: 100%;
    overflow: hidden;
}

.media-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.media-panel-tabs {
    display: flex;
    gap: 12px;
}

.media-panel-tab {
    font-size: 0.75rem;
    font-weight: 600;
    color: hsl(var(--muted-foreground) / 0.8);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: none;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: color 0.15s, background-color 0.15s;
}

.media-panel-tab.active {
    color: hsl(var(--foreground) / 0.8);
}

.media-panel-items-row {
    padding-top: 10px;
    width: 100%;
    display: flex;
    flex-direction: row;
    gap: 10px;
    align-items: flex-end;
    overflow-x: auto;
    scrollbar-width: thin;
}

.media-panel-empty {
    padding: 6px 0 10px 0;
    font-size: 0.875rem;
    color: hsl(var(--muted-foreground));
}

.attachment-preview-item {
    position: relative;
    height: 130px;
    min-width: 100px;
    border-radius: 5px;
    overflow: hidden;
    background-color: hsl(var(--muted));
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.attachment-preview-item img {
    height: 100%;
}

.attachment-preview-loading {
    color: hsl(var(--muted-foreground));
    font-size: 0.875rem;
}

.attachment-preview-video-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    color: hsl(var(--muted-foreground));
}

.attachment-close-button {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background-color: hsl(var(--background) / 0.9);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: hsl(var(--foreground));
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: background-color 0.2s;
}

.attachment-close-button:hover {
    background-color: hsl(var(--destructive));
    color: hsl(var(--destructive-foreground));
}

.attachment-small-button {
    min-width: 34px;
}

.attachment-plus-button {
    border: 2px dashed hsl(var(--border));
    background-color: transparent;
    cursor: pointer;
    color: hsl(var(--muted-foreground));
    transition: all 0.2s;
    align-self: stretch;
}

.attachment-plus-button:hover:not(:disabled) {
    background-color: hsl(var(--accent));
    color: hsl(var(--accent-foreground));
    border-color: hsl(var(--accent));
}

.attachment-plus-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.attachment-upload-progress {
    position: absolute;
    bottom: 4px;
    right: 4px;
    width: 24px;
    height: 24px;
    z-index: 10;
    pointer-events: none;
}

.attachment-upload-error {
    position: absolute;
    bottom: 4px;
    right: 4px;
    width: 24px;
    height: 24px;
    z-index: 10;
    pointer-events: auto;
    color: hsl(var(--destructive));
    filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.4));
}

.attachment-progress-circle {
    width: 100%;
    height: 100%;
}

.attachment-progress-bg {
    fill: hsl(var(--background) / 0.5);
}

.attachment-progress-bar {
    fill: white;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.3));
    transition: d 0.1s linear;
}

/* Message Attachments */
.message-content.has-attachment {
    flex-direction: column;
    align-items: stretch;
}

.message-attachment-container {
    position: relative;
    border-radius: 4px;
    overflow: hidden;
    box-sizing: border-box;
    display: block;
    background-color: hsl(var(--muted));
}

.message-attachment-image {
    width: 100%;
    height: 375px;
    object-fit: cover;
    display: block;
    min-width: 200px;
    box-sizing: border-box;
}

.message-attachment-video-wrapper {
    position: relative;
    width: 100%;
    height: 375px;
    min-width: 200px;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    background: black;
}

.video-camera-icon {
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    line-height: 0;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.5));
}

.media-overlay-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 30px;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.3), transparent);
    display: flex;
    align-items: end;
    gap: 4px;
    z-index: 5;
    pointer-events: none;
    padding-bottom: 3px;
}

.media-overlay-bar > * {
    pointer-events: auto;
}

.video-info-left {
    display: flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    flex-shrink: 0;
    padding-left: 8px;
}

.video-duration {
    color: white;
    font-size: 9pt;
    line-height: 16px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.media-overlay-pagination {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    gap: 6px;
    pointer-events: auto;
}

.media-overlay-bar .message-timestamp-area {
    margin-left: auto;
}

.media-overlay-bar .message-time {
    color: white;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.media-overlay-bar .message-status-icon,
.media-overlay-bar .message-sending-icon {
    color: white;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.5));
}

.media-overlay-bar .message-edited-icon {
    color: white;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.message-attachment-video {
    height: 100%;
    object-fit: cover;
    display: block;
}

.message-attachment-chevron {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    transition: opacity 0.2s;
    z-index: 10;
    opacity: 0.85;
    padding: 4px;
}

.message-attachment-chevron svg {
    width: 18px;
    height: 18px;
    filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.7));
}

.message-attachment-chevron-left {
    left: 4px;
}

.message-attachment-chevron-right {
    right: 4px;
}

.message-attachment-chevron:hover {
    opacity: 1;
}

.message-attachment-pagination-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    border: none;
    background-color: hsl(0 0% 100% / 0.5);
    cursor: pointer;
    transition: background-color 0.2s;
    padding: 0;
}

.message-attachment-pagination-dot:hover {
    background-color: hsl(0 0% 100% / 0.75);
}

.message-attachment-pagination-dot.active {
    background-color: hsl(0 0% 100%);
}

/* Edit message styles */
#editPreviewContainer {
    display: none;
    flex-direction: row;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    background-color: hsl(var(--muted));
    border-radius: calc(var(--radius) - 2px);
    width: 100%;
}

.edit-preview-content {
    flex: 1;
    min-width: 0;
}

.edit-preview-header {
    font-size: 0.75rem;
    font-weight: 600;
    color: hsl(var(--muted-foreground));
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.25rem;
}

.edit-preview-text {
    font-size: 0.875rem;
    color: hsl(var(--foreground));
    word-break: break-word;
    white-space: pre-wrap;
    max-height: 60px;
    overflow-y: auto;
}

.message-edited-icon {
    display: inline-flex;
    align-items: center;
    margin-right: 2px;
    opacity: 0.5;
    vertical-align: middle;
}

.message-row.own .message-edited-icon {
    opacity: 0.9;
}

.message-reply-preview {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 5px;
    background-color: hsl(var(--foreground) / 0.05);
    color: hsl(var(--foreground) / 0.9);
    font-style: italic;
    font-size: 0.8rem;
    border-radius: 4px;
    border-bottom: 1px solid hsl(var(--foreground) / 0.05);
    overflow: hidden;
    width: 100%;
}

.message-reply-preview [data-reply-to] {
    padding: 3px 1px 0 3px;
}

.reply-preview-text {
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    min-width: 0;
}

.message-row.own .message-reply-preview {
    background-color: hsl(var(--primary-foreground) / 0.1);
    color: hsl(var(--primary-foreground) / 0.9);
    border-bottom: 1px solid hsl(var(--primary-foreground) / 0.1);
}

.message-highlight {
    animation: message-highlight-fade 1.5s ease;
}

@keyframes message-highlight-fade {
    0%, 30% { background-color: hsl(var(--primary) / 0.15); }
    100% { background-color: transparent; }
}

.message-deleted {
    font-style: italic;
    opacity: 0.6;
    font-size: 0.95rem;
}

/* ── Personal Notes ─────────────────────────────────────────────────────────── */

.personal-note-row {
    display: flex;
    flex-direction: column;
    align-items: center;
}

#messagesContainer > .personal-note-row:first-child {
    margin-top: 0;
}

.personal-note-date-header {
    font-size: 0.8rem;
    font-weight: 500;
    color: hsl(var(--muted-foreground));
    margin-top: 25px;
    margin-bottom: 10px;
    text-align: center;
    user-select: none;
}

.personal-note-published-icon {
    display: inline-flex;
    align-items: center;
    margin-top: 2.4px;
    margin-left: 4px;
    vertical-align: top;
    cursor: pointer;
    color: inherit;
    text-decoration: none;
}

.personal-note-published-icon:hover {
    color: hsl(var(--primary));
}

.personal-note-content {
    width: 100%;
    display: flex;
    justify-content: center;
}

.personal-note-bubble {
    width: 94%;
    max-width: 500px;
    background-color: hsl(var(--chat-bubble-received));
    color: hsl(var(--chat-bubble-received-foreground));
    box-shadow: var(--shadow-soft);
    border: 1px solid hsl(var(--chat-bubble-received));
    border-radius: var(--bubble-border-radius);
    overflow: hidden;
}

.personal-note-text-container {
    flex-direction: column;
    align-items: center;
}

.personal-note-body-wrapper {
    width: 100%;
    padding: 10px;
}

.personal-note-title {
    font-weight: bold;
    font-size: 1rem;
    text-align: center;
    white-space: pre-wrap;
    word-wrap: break-word;
    margin-bottom: 10px;
}

.personal-note-body {
    font-size: 1rem;
}

.recent-media-select-circle {
    position: absolute;
    bottom: 4px;
    right: 4px;
    width: 24px;
    height: 24px;
    cursor: pointer;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.4));
    z-index: 10;
}

/* ── Inline Media Popup ──────────────────────────────────────────────────────── */

.inline-media-wrapper {
    position: relative;
    display: inline;
}

.inline-media-popup {
    position: fixed;
    z-index: 9999;
    background: hsl(var(--background));
    border: 1px solid hsl(var(--primary));
    border-radius: 10px;
    padding: 0px;
    box-shadow: 0 6px 30px rgba(0, 0, 0, 0.35);
    overflow: hidden;
    max-width: 300px;
    max-height: 300px;
}

.inline-media-popup-content {
    display: block;
    border-radius: 4px;
}

.inline-media-popup-content.video {
    width: 100%;
    height: auto;
}

.notes-header-center {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
}

.notes-header-title {
    font-size: 1rem;
    color: hsl(var(--foreground));
    line-height: 1.3;
}

.notes-header-subtitle {
    font-size: 0.75rem;
    color: hsl(var(--muted-foreground));
    line-height: 1.3;
}

.notes-header-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    margin-left: auto;
}

.notes-header-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.notes-header-left-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
}

.notes-header-left-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.notes-user-info-modal .user-info-content {
    right: auto;
    left: 0;
    transform: translateX(-100%);
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.15);
}

.notes-user-info-modal.show .user-info-content {
    transform: translateX(0);
}

.notes-loading {
    text-align: center;
    color: hsl(var(--muted-foreground));
    padding: 20px;
    font-size: 0.875rem;
}