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

/* Additional button reset to remove all default button styling */
button {
    background: none;
    border: none;
    padding: 0;
    margin: 0;
    font: inherit;
    color: inherit;
    cursor: pointer;
    outline: none;
}

button:focus {
    outline: none;
}

button::-moz-focus-inner {
    border: 0;
    padding: 0;
}

:root {
    --bg-primary: #ffffff;
    --bg-secondary: #f5f7fa;
    --bg-hover: rgba(108, 92, 231, 0.1);
    --text-primary: #1a1a1a;
    --text-secondary: #666666;
    --border-color: #e0e0e0;
    --accent-color: #6C5CE7;
    --accent-hover: #5f4fd1;
    --message-own: #e3f2fd;
    --message-other: #f5f5f5;
    --online-color: #4caf50;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.15);
}

body.dark-mode {
    --bg-primary: #1a1a1a;
    --bg-secondary: #2d2d2d;
    --bg-hover: rgba(108, 92, 231, 0.2);
    --text-primary: #ffffff;
    --text-secondary: #aaaaaa;
    --border-color: #444444;
    --message-own: #1e3a5f;
    --message-other: #2d2d2d;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.4);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    transition: background-color 0.3s ease, color 0.3s ease;
    height: 100vh;
    overflow: hidden;
}

.app {
    height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Setup Screen */
.setup-screen {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    background: linear-gradient(135deg, var(--accent-color), #a29bfe);
    padding: 20px;
    position: relative;
    z-index: 10;
}

.setup-screen.hidden {
    display: none;
}

.setup-card {
    background: var(--bg-primary);
    border-radius: 16px;
    padding: 40px;
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 400px;
    animation: slideUp 0.5s ease;
}

.setup-card h1 {
    text-align: center;
    margin-bottom: 30px;
    font-size: 32px;
    color: var(--text-primary);
}

.form-group {
    margin-bottom: 20px;
}

.username-input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 16px;
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    transition: border-color 0.3s ease;
}

.username-input:focus {
    outline: none;
    border-color: var(--accent-color);
}

.color-selector {
    margin-bottom: 25px;
}

.color-selector label {
    display: block;
    margin-bottom: 10px;
    font-weight: 600;
    color: var(--text-primary);
}

.color-options {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.color-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 3px solid transparent;
    cursor: pointer;
    transition: transform 0.2s ease, border-color 0.2s ease;
}

.color-btn:hover {
    transform: scale(1.1);
}

.color-btn.selected {
    border-color: var(--text-primary);
}

/* Sound Toggle */
.sound-toggle {
    margin-bottom: 25px;
}

.sound-toggle label {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    color: var(--text-primary);
    cursor: pointer;
}

.sound-toggle input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

/* Buttons */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-primary {
    background-color: var(--accent-color);
    color: white;
    width: 100%;
}

.btn-primary:hover {
    background-color: var(--accent-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.btn-send {
    background-color: var(--accent-color);
    color: white;
    padding: 10px 20px;
    white-space: nowrap;
}

.btn-send:hover {
    background-color: var(--accent-hover);
    transform: translateY(-1px);
}

.btn-icon {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    padding: 8px;
    border-radius: 6px;
    transition: all 0.2s ease;
    color: var(--text-primary);
}

.btn-icon:hover {
    background-color: var(--bg-secondary);
    transform: scale(1.05);
}

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

/* Add a subtle tooltip for the upload button to indicate multiple formats */
#upload-btn {
    position: relative;
}

#upload-btn:hover::after {
    content: "📷 Images • 🎥 Videos • 🎵 Audio";
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-secondary);
    color: var(--text-primary);
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 10px;
    white-space: nowrap;
    margin-bottom: 8px;
    box-shadow: var(--shadow);
    pointer-events: none;
    z-index: 100;
    border: 1px solid var(--border-color);
}

@media (max-width: 768px) {
    #upload-btn:hover::after {
        display: none;
    }
}

/* Chat Screen */
.chat-screen {
    display: flex;
    flex-direction: column;
    height: 100vh;
    background-color: var(--bg-primary);
}

.chat-screen.hidden {
    display: none;
}

.chat-header {
    background-color: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow);
    flex-wrap: wrap;
    gap: 10px;
}

.header-content {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.chat-header h1 {
    margin: 0;
    font-size: 24px;
    color: var(--accent-color);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background-color: var(--bg-primary);
    border-radius: 6px;
}

.username-display {
    font-weight: 600;
    color: var(--text-primary);
}

.online-indicator {
    width: 10px;
    height: 10px;
    background-color: var(--online-color);
    border-radius: 50%;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.6; transform: scale(0.9); }
}

.header-actions {
    display: flex;
    gap: 10px;
}

.online-users-container {
    background-color: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    padding: 10px 20px;
    font-size: 12px;
    color: var(--text-secondary);
}

.online-users {
    display: flex;
    align-items: center;
    gap: 10px;
}

.online-count {
    font-weight: 600;
}

/* Voice Call Styles */
.call-controls {
    margin-bottom: 10px;
    padding: 8px 12px;
    background: var(--bg-secondary);
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.call-btn {
    padding: 8px 16px;
    background: var(--accent-color);
    border: none;
    border-radius: 20px;
    color: white;
    cursor: pointer;
    transition: transform 0.2s ease, background 0.2s ease;
    font-size: 14px;
    font-weight: 500;
}

.call-btn:hover {
    transform: scale(1.02);
    background: var(--accent-hover);
}

.online-count {
    font-size: 12px;
    color: var(--text-secondary);
    margin-left: auto;
}

/* Modal styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    animation: fadeIn 0.2s ease;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: var(--bg-primary);
    border-radius: 24px;
    padding: 24px;
    width: 350px;
    max-width: 90%;
    box-shadow: var(--shadow-lg);
    animation: slideUp 0.3s ease;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.modal-header h3 {
    margin: 0;
    color: var(--text-primary);
}

.close-modal {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-secondary);
    transition: color 0.2s ease;
}

.close-modal:hover {
    color: var(--text-primary);
}

.call-icon {
    font-size: 64px;
    text-align: center;
    margin: 20px 0;
}

.call-status {
    text-align: center;
    font-size: 18px;
    margin-bottom: 8px;
    color: var(--text-primary);
    font-weight: 500;
}

.call-timer {
    text-align: center;
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 20px;
}

.call-actions {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin: 20px 0;
}

.call-action-btn {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    font-size: 24px;
    transition: transform 0.2s ease, background 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.call-action-btn:hover {
    transform: scale(1.05);
}

.call-action-btn.end {
    background: #ff4444;
    color: white;
}

.call-action-btn.accept {
    background: #4CAF50;
    color: white;
    width: auto;
    border-radius: 40px;
    padding: 10px 24px;
    font-size: 16px;
}

.call-action-btn.reject {
    background: #ff4444;
    color: white;
    width: auto;
    border-radius: 40px;
    padding: 10px 24px;
    font-size: 16px;
}

.incoming-actions {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin-top: 20px;
}

.user-list-container {
    max-height: 400px;
    overflow-y: auto;
}

.user-list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: background 0.2s ease;
}

.user-list-item:hover {
    background: var(--bg-hover);
}

.user-list-item:last-child {
    border-bottom: none;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: white;
}

.user-info-text {
    flex: 1;
    margin-left: 12px;
}

.user-name {
    font-weight: bold;
    color: var(--text-primary);
    font-size: 14px;
}

.user-status {
    font-size: 11px;
    color: #4CAF50;
    margin-top: 2px;
}

.call-user-btn {
    padding: 6px 14px;
    background: var(--accent-color);
    border: none;
    border-radius: 20px;
    color: white;
    cursor: pointer;
    transition: transform 0.2s ease;
    font-size: 13px;
}

.call-user-btn:hover {
    transform: scale(1.02);
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes ring {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.ring-animation {
    animation: ring 0.5s ease infinite;
}

/* Dark mode adjustments for modals */
body.dark-mode .modal-content {
    background: #1a1a2e;
}

body.dark-mode .call-action-btn.mute,
body.dark-mode .call-action-btn.speaker {
    background: #2a2a3e;
    color: #fff;
}

/* Responsive adjustments for call features */
@media (max-width: 600px) {
    .call-controls {
        padding: 6px 10px;
    }
    
    .call-btn {
        padding: 6px 12px;
        font-size: 12px;
    }
    
    .modal-content {
        padding: 20px;
        width: 320px;
    }
    
    .call-icon {
        font-size: 48px;
    }
    
    .call-status {
        font-size: 16px;
    }
    
    .call-action-btn {
        width: 48px;
        height: 48px;
        font-size: 20px;
    }
    
    .user-list-item {
        padding: 10px;
    }
    
    .call-user-btn {
        padding: 5px 12px;
        font-size: 12px;
    }
}

/* Chat Messages */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    contain: content;
    will-change: scroll-position;
}

.message {
    display: flex;
    animation: messageIn 0.3s ease;
    max-width: 70%;
    gap: 8px;
    position: relative;
}

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

.message.other {
    align-self: flex-start;
}

@keyframes messageIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 14px;
    flex-shrink: 0;
    box-shadow: var(--shadow);
}

.message-bubble {
    flex: 1;
    padding: 10px 14px;
    border-radius: 12px;
    word-wrap: break-word;
    max-width: 100%;
    position: relative;
}

.message.own .message-bubble {
    background-color: var(--message-own);
    color: var(--text-primary);
    border-bottom-right-radius: 4px;
}

.message.other .message-bubble {
    background-color: var(--message-other);
    color: var(--text-primary);
    border-bottom-left-radius: 4px;
}

.message-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
    font-size: 12px;
    flex-wrap: wrap;
}

.message-username {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 13px;
}

.message.own .message-username {
    color: var(--accent-color);
}

.message-timestamp {
    font-size: 10px;
    color: var(--text-secondary);
    opacity: 0.7;
}

/* ============================================ */
/* IMPROVED ACTION BUTTONS - NO WHITE SQUARES */
/* ============================================ */

/* Message Actions Container */
.message-actions {
    display: flex;
    gap: 4px;
    margin-left: auto;
    align-items: center;
}

/* Force all action buttons to have no background, border, or outline */
.reply-btn, 
.edit-btn, 
.delete-btn, 
.add-reaction-btn,
.message-actions button {
    background: none !important;
    background-color: transparent !important;
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    appearance: none !important;
    cursor: pointer !important;
    font-size: 12px;
    padding: 4px 6px;
    border-radius: 4px;
    opacity: 0.6;
    transition: all 0.2s ease;
    color: var(--text-secondary);
    line-height: 1;
    margin: 0;
}

/* Specific styling for reaction button */
.add-reaction-btn {
    font-size: 14px;
    padding: 4px 6px;
    margin-left: 2px;
}

/* Hover states - only add a subtle background, no white */
.reply-btn:hover, 
.edit-btn:hover, 
.delete-btn:hover, 
.add-reaction-btn:hover,
.message-actions button:hover {
    opacity: 1;
    background-color: rgba(0, 0, 0, 0.08) !important;
    transform: scale(1.05);
}

/* Active/click state */
.reply-btn:active, 
.edit-btn:active, 
.delete-btn:active, 
.add-reaction-btn:active,
.message-actions button:active {
    transform: scale(0.95);
}

/* Focus states - no white square, only subtle ring for accessibility */
.reply-btn:focus,
.edit-btn:focus,
.delete-btn:focus,
.add-reaction-btn:focus,
.message-actions button:focus {
    outline: none !important;
    box-shadow: none !important;
}

/* Focus visible - for keyboard navigation (accessibility) */
.reply-btn:focus-visible,
.edit-btn:focus-visible,
.delete-btn:focus-visible,
.add-reaction-btn:focus-visible,
.message-actions button:focus-visible {
    outline: 2px solid var(--accent-color) !important;
    outline-offset: 2px !important;
    border-radius: 4px !important;
}

/* Dark mode adjustments */
body.dark-mode .reply-btn:hover,
body.dark-mode .edit-btn:hover,
body.dark-mode .delete-btn:hover,
body.dark-mode .add-reaction-btn:hover,
body.dark-mode .message-actions button:hover {
    background-color: rgba(255, 255, 255, 0.1) !important;
}

/* Own messages (right side) - adjust hover background */
.message.own .reply-btn:hover,
.message.own .edit-btn:hover,
.message.own .delete-btn:hover,
.message.own .add-reaction-btn:hover,
.message.own .message-actions button:hover {
    background-color: rgba(255, 255, 255, 0.15) !important;
}

/* Override any potential button styles from other elements */
button.add-reaction-btn,
button.reply-btn,
button.edit-btn,
button.delete-btn {
    background: transparent !important;
    border: none !important;
}

/* Remove any default button background in all states */
button.add-reaction-btn:active,
button.add-reaction-btn:focus,
button.reply-btn:active,
button.reply-btn:focus,
button.edit-btn:active,
button.edit-btn:focus,
button.delete-btn:active,
button.delete-btn:focus {
    background: transparent !important;
    background-color: transparent !important;
}

/* Reaction Badges */
.message-reactions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.reaction-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    background: var(--bg-secondary);
    border-radius: 24px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s ease;
    border: 1px solid var(--border-color);
}

.reaction-badge:hover {
    transform: scale(1.05);
    background: var(--bg-hover);
}

.reaction-badge.reacted {
    background: rgba(108, 92, 231, 0.2);
    border-color: var(--accent-color);
}

.reaction-badge span:first-child {
    font-size: 16px;
}

.reaction-badge span:last-child {
    font-size: 12px;
    color: var(--text-secondary);
}

.remove-reaction {
    margin-left: 4px;
    font-size: 12px;
    opacity: 0.6;
    transition: opacity 0.2s ease;
}

.remove-reaction:hover {
    opacity: 1;
}

/* Reaction Picker */
.reaction-picker {
    position: fixed;
    background: var(--bg-secondary);
    border-radius: 28px;
    padding: 8px 12px;
    box-shadow: var(--shadow-lg);
    display: flex;
    gap: 8px;
    z-index: 10000;
    border: 1px solid var(--border-color);
    animation: fadeInUp 0.2s ease;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.reaction-picker button {
    background: transparent;
    border: none;
    font-size: 24px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 24px;
    transition: transform 0.1s ease, background 0.2s ease;
}

.reaction-picker button:hover {
    transform: scale(1.2);
    background: var(--bg-hover);
}

/* Emoji Modal */
.emoji-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 20000;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.emoji-modal > div {
    background: var(--bg-primary);
    border-radius: 12px;
    padding: 20px;
    max-width: 400px;
    width: 90%;
    max-height: 500px;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}

.emoji-modal h3 {
    margin: 0 0 16px 0;
    color: var(--text-primary);
    font-size: 18px;
}

.emoji-modal .emoji-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 8px;
}

.emoji-modal button {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    font-size: 28px;
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.emoji-modal button:hover {
    transform: scale(1.05);
    background: var(--bg-hover);
}

/* Media Messages */
.message-image {
    max-width: 100%;
    max-height: 400px;
    border-radius: 12px;
    margin-top: 8px;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.message-image:hover {
    transform: scale(1.02);
}

.message-video,
.message-audio {
    width: 100%;
    max-width: 330px;
    margin-top: 6px;
    border-radius: 8px;
}

.message-text {
    word-wrap: break-word;
    white-space: pre-wrap;
    line-height: 1.4;
}

.message-text a {
    color: var(--accent-color);
    text-decoration: underline;
    word-break: break-all;
}

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

/* Deleted message styling */
.deleted-message {
    font-style: italic;
    color: var(--text-secondary);
    opacity: 0.7;
}

/* Edited badge styling */
.edited-badge {
    font-size: 9px;
    color: var(--text-secondary);
    margin-left: 5px;
    font-style: italic;
    opacity: 0.6;
}

/* Animation for message update */
@keyframes highlightUpdate {
    0% {
        background-color: rgba(108, 92, 231, 0.3);
        transform: scale(1);
    }
    50% {
        transform: scale(1.01);
    }
    100% {
        background-color: transparent;
        transform: scale(1);
    }
}

.message-updated {
    animation: highlightUpdate 0.5s ease;
}

/* Mention highlighting */
.mention {
    background-color: rgba(108, 92, 231, 0.2);
    border-radius: 4px;
    padding: 0 2px;
    font-weight: bold;
}

body.dark-mode .mention {
    background-color: rgba(108, 92, 231, 0.3);
}

/* Reply system */
.message-reply {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 8px;
    padding: 8px 10px;
    background-color: rgba(108, 92, 231, 0.08);
    border-left: 3px solid var(--accent-color);
    border-radius: 6px;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.message-reply:hover {
    background-color: rgba(108, 92, 231, 0.15);
    transform: translateX(2px);
}

body.dark-mode .message-reply {
    background-color: rgba(108, 92, 231, 0.15);
}

body.dark-mode .message-reply:hover {
    background-color: rgba(108, 92, 231, 0.25);
}

.reply-line {
    width: 2px;
    height: 16px;
    background-color: var(--accent-color);
    border-radius: 1px;
    flex-shrink: 0;
}

.reply-info {
    flex: 1;
    min-width: 0;
}

.reply-username {
    font-weight: bold;
    color: var(--accent-color);
    margin-right: 4px;
    font-size: 11px;
}

.reply-preview {
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 10px;
}

/* Current Reply Preview */
.current-reply-preview {
    margin: 0 10px 8px 10px;
    padding: 8px 12px;
    background-color: rgba(108, 92, 231, 0.1);
    border: 1px solid rgba(108, 92, 231, 0.3);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    animation: slideDown 0.2s ease;
}

.current-reply-preview:hover {
    background-color: rgba(108, 92, 231, 0.15);
    transform: translateX(2px);
}

body.dark-mode .current-reply-preview {
    background-color: rgba(108, 92, 231, 0.2);
    border-color: rgba(108, 92, 231, 0.4);
}

/* Current Edit Preview */
.current-edit-preview {
    margin: 0 10px 8px 10px;
    padding: 8px 12px;
    background-color: rgba(255, 193, 7, 0.1);
    border: 1px solid rgba(255, 193, 7, 0.3);
    border-radius: 8px;
    animation: slideDown 0.2s ease;
}

body.dark-mode .current-edit-preview {
    background-color: rgba(255, 193, 7, 0.15);
    border-color: rgba(255, 193, 7, 0.4);
}

.reply-content, .edit-content {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
}

.reply-label {
    color: var(--text-secondary);
}

.edit-label {
    color: #ffc107;
    font-weight: 600;
}

.reply-text, .edit-text {
    color: var(--text-secondary);
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cancel-reply, .cancel-edit {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 14px;
    color: var(--text-secondary);
    padding: 2px;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.cancel-reply:hover, .cancel-edit:hover {
    background-color: rgba(0, 0, 0, 0.1);
    color: var(--text-primary);
    transform: scale(1.1);
}

body.dark-mode .cancel-reply:hover,
body.dark-mode .cancel-edit:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background-color: var(--message-other);
    border-radius: 16px;
    width: fit-content;
    font-size: 12px;
    color: var(--text-secondary);
    margin: 0 20px 10px 20px;
    animation: slideUp 0.2s ease;
}

.typing-indicator.hidden {
    display: none;
}

.typing-dots {
    display: flex;
    gap: 4px;
}

.typing-dots div {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: var(--text-secondary);
    animation: typingAnimation 1.4s infinite;
}

.typing-dots div:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dots div:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typingAnimation {
    0%, 60%, 100% {
        opacity: 0.3;
        transform: translateY(0);
    }
    30% {
        opacity: 1;
        transform: translateY(-6px);
    }
}

/* Input Area */
.input-area {
    background-color: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    padding: 16px 20px;
    display: flex;
    gap: 12px;
    align-items: center;
}

.message-input-wrapper {
    flex: 1;
}

.message-input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    transition: all 0.2s ease;
}

.message-input:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(108, 92, 231, 0.1);
}

.input-controls {
    display: flex;
    gap: 8px;
    align-items: center;
}

.voice-recording {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background-color: var(--message-other);
    border-radius: 20px;
    font-size: 12px;
    color: var(--text-secondary);
    animation: recordingPulseBorder 1s infinite;
}

.voice-recording.hidden {
    display: none !important;
}

.recording-dot {
    width: 10px;
    height: 10px;
    background-color: #ff4444;
    border-radius: 50%;
    animation: recordingPulse 1s infinite;
}

@keyframes recordingPulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(1.2); }
}

@keyframes recordingPulseBorder {
    0%, 100% { border-color: rgba(255, 68, 68, 0.3); }
    50% { border-color: rgba(255, 68, 68, 0.8); }
}

#recording-time {
    font-weight: 600;
    min-width: 35px;
    font-family: monospace;
}

/* Media Embeds */
.media-embed {
    margin-top: 8px;
    border-radius: 8px;
    overflow: hidden;
    max-width: 100%;
}

.youtube-embed {
    position: relative;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
    height: 0;
    overflow: hidden;
    background-color: #000;
    border-radius: 8px;
}

.youtube-embed iframe,
.youtube-embed .youtube-player-container,
.youtube-embed div[id^="youtube-container-"] {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

.image-embed {
    max-width: 100%;
    margin-top: 8px;
}

.embedded-image {
    max-width: 100%;
    max-height: 400px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: var(--shadow);
}

.embedded-image:hover {
    transform: scale(1.02);
    box-shadow: var(--shadow-lg);
}

.embed-error {
    padding: 12px;
    background-color: rgba(255, 68, 68, 0.1);
    border-radius: 8px;
    color: #ff4444;
    font-size: 12px;
    text-align: center;
    margin-top: 8px;
}

/* Hidden utility */
.hidden {
    display: none !important;
}

/* Scrollbar */
.chat-messages::-webkit-scrollbar {
    width: 8px;
}

.chat-messages::-webkit-scrollbar-track {
    background: var(--bg-secondary);
    border-radius: 4px;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: var(--accent-color);
    border-radius: 4px;
    opacity: 0.5;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: var(--accent-hover);
}

/* Animations */
@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Loading state for buttons */
.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Responsive Design */
@media (max-width: 768px) {
    .message {
        max-width: 85%;
    }

    .setup-card {
        padding: 30px 20px;
        margin: 20px;
    }

    .chat-header {
        padding: 12px 16px;
    }

    .chat-header h1 {
        font-size: 20px;
    }

    .message-avatar {
        width: 32px;
        height: 32px;
        font-size: 12px;
    }

    .message-image {
        max-width: 250px;
        max-height: 250px;
    }
    
    .embedded-image {
        max-height: 300px;
    }
    
    .input-area {
        padding: 12px 15px;
    }
    
    .btn-send {
        padding: 8px 16px;
    }
    
    .btn-icon {
        padding: 6px;
        font-size: 18px;
    }
    
    .reaction-picker {
        padding: 6px 10px;
    }
    
    .reaction-picker button {
        font-size: 20px;
        padding: 3px 6px;
    }
}

@media (max-width: 480px) {
    .message {
        max-width: 95%;
    }

    .setup-card {
        padding: 25px 15px;
    }

    .input-area {
        gap: 8px;
    }

    .header-actions .btn-icon {
        padding: 6px;
        font-size: 16px;
    }

    .message-bubble {
        padding: 8px 12px;
    }

    .color-options {
        gap: 8px;
    }

    .color-btn {
        width: 35px;
        height: 35px;
    }
    
    .reply-btn, .edit-btn, .delete-btn, .add-reaction-btn {
        font-size: 10px;
        padding: 2px 3px;
    }
    
    .message-actions {
        gap: 2px;
    }
    
    .current-edit-preview,
    .current-reply-preview {
        margin: 0 8px 6px 8px;
        padding: 6px 10px;
    }
    
    .edit-label, .reply-label {
        font-size: 10px;
    }
    
    .edit-text, .reply-text {
        font-size: 10px;
    }
    
    .embedded-image {
        max-height: 250px;
    }
    
    .message-avatar {
        width: 28px;
        height: 28px;
        font-size: 11px;
    }
    
    .message-image {
        max-height: 200px;
    }
    
    .reaction-picker {
        gap: 4px;
        padding: 4px 8px;
    }
    
    .reaction-picker button {
        font-size: 18px;
        padding: 2px 5px;
    }
    
    .reaction-badge {
        padding: 2px 6px;
        font-size: 12px;
    }
    
    .reaction-badge span:first-child {
        font-size: 14px;
    }
}

/* Print styles */
@media print {
    .input-area,
    .chat-header,
    .online-users-container,
    .typing-indicator,
    .btn-icon,
    .reaction-picker,
    .add-reaction-btn,
    .call-controls,
    .modal {
        display: none;
    }
    
    .message {
        break-inside: avoid;
    }
    
    .chat-messages {
        overflow: visible;
    }
}

/* Focus styles for accessibility */
button:focus-visible,
input:focus-visible {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
}

/* Smooth transitions */
* {
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease, transform 0.1s ease;
}