:root {
    /* --- Modern Dark Palette --- */
    --bg-app: #09090b;
    /* Pure Black/Zinc base */
    --bg-sidebar: #121212;
    /* Slightly lighter sidebar */
    --bg-header: #181c20;
    /* Distinct header/input bg */
    --bg-card: #27272a;

    --accent: #22c55e;
    /* Snappy Green */
    --accent-dim: #15803d;

    --text-primary: #f4f4f5;
    --text-secondary: #a1a1aa;

    --border: #27272a;

    --msg-out: #166534;
    /* Green message bubble */
    --msg-in: #27272a;
    /* Grey message bubble */

    --header-height: 64px;
}

* {
    box-sizing: border-box;
}

html {
    background-color: var(--bg-color);
}

body {
    margin: 0;
    padding: 0;
    font-family: 'Inter', sans-serif;
    font-weight: 450;
    background-color: var(--bg-app);
    color: var(--text-primary);
    width: 100vw;
    height: 100vh;
    overflow: hidden;
}

/* --- App Container --- */
#app {
    width: 100%;
    height: 100%;
    position: relative;
    display: flex;
}

/* --- Utils --- */
.hidden {
    display: none !important;
}

button {
    font-family: inherit;
    cursor: pointer;
    border: none;
    background: none;
}

h1,
h2,
h3,
p {
    margin: 0;
}

/* =========================================
   1. The Login Page (The Design You Liked)
   ========================================= */
#auth-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at center, #1a1a1a 0%, #000 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.auth-wrapper {
    width: 100%;
    max-width: 420px;
    padding: 20px;
    text-align: center;
    animation: fadeIn 0.4s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.auth-header h1 {
    font-size: 3rem;
    font-weight: 800;
    letter-spacing: -2px;
    margin-bottom: 5px;
    background: linear-gradient(to right, #fff, #999);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.tagline {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: 30px;
    line-height: 1.4;
}

.highlight {
    color: var(--text-primary);
    font-weight: 600;
    text-decoration: underline decoration-var(--accent) 3px;
}

.auth-card {
    background: rgba(24, 24, 27, 0.6);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    padding: 40px 30px;
    border-radius: 24px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
    text-align: left;
}

.auth-card h2 {
    margin-bottom: 20px;
    font-size: 1.5rem;
    text-align: center;
    color: var(--text-primary);
}

.input-group {
    margin-bottom: 20px;
}

.input-group label {
    display: block;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
    font-weight: 500;
}

.input-group input {
    width: 100%;
    background: #000;
    border: 1px solid var(--border);
    padding: 14px;
    border-radius: 12px;
    color: white;
    font-size: 1rem;
    transition: 0.2s;
}

.input-group input:focus {
    border-color: var(--accent);
    outline: none;
    box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.2);
}

.glow-btn {
    width: 100%;
    background: var(--accent);
    color: black;
    font-weight: 700;
    padding: 16px;
    border-radius: 12px;
    font-size: 1rem;
    transition: 0.2s;
}

.glow-btn:hover {
    box-shadow: 0 0 20px rgba(34, 197, 94, 0.4);
    transform: translateY(-1px);
}

.divider {
    text-align: center;
    color: var(--text-secondary);
    margin: 20px 0;
    font-size: 0.9rem;
}

.toggle-link {
    text-align: center;
    color: var(--accent);
    cursor: pointer;
    font-weight: 600;
}

.auth-footer {
    margin-top: 40px;
    color: var(--text-secondary);
    font-size: 0.9rem;
    opacity: 0.7;
}

.auth-footer b {
    color: var(--text-primary);
}

/* Loading Spinner */
.spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 0.8s linear infinite;
    vertical-align: middle;
    margin-right: 6px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

button:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

#auth-error {
    background: rgba(255, 0, 0, 0.1);
    color: #ff6b6b;
    padding: 10px;
    border-radius: 8px;
    margin-bottom: 15px;
    text-align: center;
}

/* =========================================
   2. Main Layout (Sidebar + Chat) 
   ========================================= */
#main-layout {
    display: flex;
    width: 100%;
    height: 100%;
    background: var(--bg-app);
}

/* --- Sidebar --- */
#sidebar {
    width: 320px;
    min-width: 320px;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
}

.pane-header {
    height: var(--header-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-header);
    flex-shrink: 0;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 600;
}

.avatar-circle {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, #333, #555);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 1rem;
}

.actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.action-btn {
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    background: var(--bg-card);
    border: none;
    transition: all 0.2s;
    white-space: nowrap;
}

.action-btn:hover {
    background: #333;
    color: var(--text-primary);
}

.action-btn.primary-text {
    color: var(--accent);
    background: var(--bg-card);
}

.action-btn.primary-text:hover {
    background: #333;
}

.search-bar {
    padding: 12px;
}

.search-bar input {
    width: 100%;
    background: var(--bg-header);
    border: none;
    padding: 10px 14px;
    border-radius: 8px;
    color: var(--text-primary);
}

#conversations-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

.chat-item {
    padding: 12px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    border-bottom: 1px solid transparent;
}

.chat-item:hover {
    background: var(--bg-card);
}

.chat-item.active {
    background: var(--bg-card);
}

/* Online indicator dot */
.online-dot {
    width: 10px;
    height: 10px;
    background: #22c55e;
    border-radius: 50%;
    border: 2px solid #18181b;
    flex-shrink: 0;
}

/* Delete button - shows on hover */
.delete-btn {
    display: none;
    width: 28px;
    height: 28px;
    background: rgba(220, 38, 38, 0.15);
    color: #f87171;
    border: none;
    border-radius: 6px;
    font-size: 1.2rem;
    cursor: pointer;
    flex-shrink: 0;
    margin-left: auto;
}

.delete-btn:hover {
    background: rgba(220, 38, 38, 0.3);
}

.chat-item:hover .delete-btn {
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-item-info {
    flex: 1;
    min-width: 0;
}

.chat-item-top {
    display: flex;
    justify-content: space-between;
    margin-bottom: 4px;
}

.chat-item-name {
    font-weight: 600;
    font-size: 0.95rem;
}

.chat-item-time {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.chat-item-bottom {
    display: flex;
    justify-content: space-between;
}

.chat-item-preview {
    color: var(--text-secondary);
    font-size: 0.85rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.unread-badge {
    background: var(--accent);
    color: black;
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 10px;
    font-weight: bold;
}

/* --- Chat Area (MAJOR OVERHAUL) --- */
#chat-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
    /* WhatsApp-style dark wallpaper background */
    background-color: #0b141a;
    background-image:
        linear-gradient(rgba(11, 20, 26, 0.92), rgba(11, 20, 26, 0.92)),
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='80' height='80' viewBox='0 0 80 80'%3E%3Cg fill='%23ffffff' fill-opacity='0.03'%3E%3Cpath d='M0 0h40v40H0V0zm40 40h40v40H40V40zm0-40h2l-2 2V0zm0 4l4-4h2l-6 6V4zm0 4l8-8h2L40 10V8zm0 4L52 0h2L40 14v-2zm0 4L56 0h2L40 18v-2zm0 4L60 0h2L40 22v-2zm0 4L64 0h2L40 26v-2zm0 4L68 0h2L40 30v-2zm0 4L72 0h2L40 34v-2zm0 4L76 0h2L40 38v-2zm0 4L80 0v2L42 40h-2zm4 0L80 4v2L46 40h-2zm4 0L80 8v2L50 40h-2zm4 0l28-28v2L54 40h-2zm4 0l24-24v2L58 40h-2zm4 0l20-20v2L62 40h-2zm4 0l16-16v2L66 40h-2zm4 0l12-12v2L70 40h-2zm4 0l8-8v2l-6 6h-2zm4 0l4-4v2l-2 2h-2z'/%3E%3C/g%3E%3C/svg%3E");
    overflow: hidden;
}

#no-chat-selected {
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    text-align: center;
    padding: 40px;
}

#no-chat-selected h2 {
    color: var(--text-primary);
    margin-bottom: 10px;
    font-size: 1.8rem;
}

#no-chat-selected p {
    opacity: 0.7;
}

#active-chat-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100%;
}

.chat-header {
    background: var(--bg-header);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    z-index: 10;
    overflow: visible;
}

.chat-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-text h3 {
    font-size: 1rem;
    margin-bottom: 2px;
    color: var(--text-primary);
}

.status-text {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.status-text.online {
    color: var(--accent);
}

/* Typing Indicator */
.typing-text {
    font-size: 0.8rem;
    color: var(--accent);
    font-style: italic;
    animation: typingPulse 1.5s ease-in-out infinite;
}

@keyframes typingPulse {

    0%,
    100% {
        opacity: 0.6;
    }

    50% {
        opacity: 1;
    }
}

/* Messages Container */
#messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 16px 5%;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

#messages-list {
    margin-top: auto;
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding-bottom: 8px;
}

/* Date Separator */
.date-separator {
    align-self: center;
    background: #182229;
    color: #8696a0;
    font-size: 12.5px;
    padding: 5px 12px;
    border-radius: 7.5px;
    margin: 10px 0;
    box-shadow: 0 1px 0.5px rgba(11, 20, 26, .13);
}

/* Message Bubbles - WhatsApp Style (Exact Match) */
.message {
    max-width: 65%;
    padding: 6px 7px 8px 9px;
    border-radius: 7.5px;
    font-size: 14.2px;
    line-height: 19px;
    position: relative;
    word-wrap: break-word;
    box-shadow: 0 1px 0.5px rgba(11, 20, 26, .13);
    /* Disable copy/share context menu on long press */
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
}

.message.sent {
    align-self: flex-end;
    background: #3b4a54;
    color: #e9edef;
    border-top-right-radius: 0;
}

.message.received {
    align-self: flex-start;
    background: #1f2c34;
    color: #e9edef;
    border-top-left-radius: 0;
}

.message.pending {
    opacity: 1;
}

/* Message text wrapper */
.msg-text {
    display: inline;
    word-break: break-word;
}

/* Clickable links in messages */
.message-link {
    color: #84d9ff;
    text-decoration: underline;
    word-break: break-all;
}

.message-link:hover {
    color: #b4ebff;
}

/* Timestamp - inline floating right, WhatsApp exact style */
.msg-meta {
    display: inline-flex;
    align-items: center;
    float: right;
    margin: -2px 0 -2px 12px;
    position: relative;
    top: 4px;
    font-size: 11px;
    color: hsla(0, 0%, 100%, .6);
    gap: 3px;
    white-space: nowrap;
}

.message.received .msg-meta {
    color: #8696a0;
}

.msg-meta .ticks {
    font-size: 0.9rem;
    margin-left: 3px;
    color: rgba(255, 255, 255, 0.5);
}

.msg-meta .ticks.read {
    color: #53bdeb;
}

/* Input Area - Clean Modern Style */
.chat-input-area {
    padding: 12px 16px;
    background: var(--bg-header);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    flex-shrink: 0;
    padding-bottom: max(12px, env(safe-area-inset-bottom));
}

#message-form {
    display: flex;
    gap: 10px;
    width: 100%;
    align-items: center;
}

#message-input {
    flex: 1;
    background: #2a3942;
    border: none;
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 1rem;
    padding: 12px 16px;
    transition: background 0.2s;
}

#message-input:focus {
    outline: none;
    background: #323f48;
}

#message-input::placeholder {
    color: #8696a0;
}

#send-btn {
    width: 44px;
    height: 44px;
    background: var(--accent);
    color: #111b21;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.15s, background 0.2s;
    flex-shrink: 0;
}

#send-btn:hover {
    transform: scale(1.08);
    background: #25d366;
}

#send-btn:active {
    transform: scale(0.95);
}

/* Emoji Button */
.icon-btn {
    width: 40px;
    height: 40px;
    background: transparent;
    border: none;
    font-size: 1.4rem;
    cursor: pointer;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.icon-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Emoji Picker Panel */
.emoji-picker {
    position: absolute;
    bottom: 100%;
    left: 10px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 10px;
    margin-bottom: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    z-index: 100;
}

.emoji-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 4px;
}

.emoji-item {
    font-size: 1.5rem;
    padding: 6px;
    cursor: pointer;
    border-radius: 6px;
    text-align: center;
    transition: background 0.15s;
}

.emoji-item:hover {
    background: rgba(255, 255, 255, 0.1);
}

.chat-input-area {
    position: relative;
}

#send-btn svg {
    width: 20px;
    height: 20px;
}

/* --- Modals --- */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3000;
}

.modal-content {
    background: var(--bg-card);
    padding: 24px;
    width: 90%;
    max-width: 360px;
    border-radius: 16px;
    border: 1px solid var(--border);
}

.modal-content input {
    width: 100%;
    padding: 12px;
    background: #000;
    border: 1px solid var(--border);
    color: white;
    border-radius: 8px;
    margin: 16px 0;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.modal-actions button {
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 600;
}

.primary {
    background: var(--accent);
    color: black;
}

.secondary {
    color: var(--text-secondary);
}

.danger {
    background: #dc2626;
    color: white;
}

.danger:hover {
    background: #ef4444;
}

.modal-desc {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin: 10px 0 20px;
    line-height: 1.4;
}

.error-text {
    color: #f87171;
    font-size: 0.85rem;
    margin-bottom: 10px;
}

/* Chat Item Delete Button */
.chat-item-actions {
    display: none;
    margin-left: auto;
}

.chat-item:hover .chat-item-actions,
.chat-item.show-actions .chat-item-actions {
    display: flex;
}

.delete-chat-btn {
    padding: 6px 10px;
    background: rgba(220, 38, 38, 0.2);
    color: #f87171;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 500;
}

.delete-chat-btn:hover {
    background: rgba(220, 38, 38, 0.4);
}

/* --- Mobile Responsive --- */
.mobile-only {
    display: none;
}

@media (max-width: 768px) {
    #sidebar {
        width: 100%;
        border-right: none;
    }

    #chat-area {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        z-index: 100;
        transform: translateX(100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        background: var(--bg-app);
    }

    /* When chat is active */
    body.show-chat #chat-area {
        transform: translateX(0);
    }

    body.show-chat #sidebar {
        display: none;
    }

    .mobile-only {
        display: block;
        font-size: 1.5rem;
        margin-right: 12px;
        color: var(--text-primary);
    }
}

/* =========================================
   GIF Feature Styles
   ========================================= */

/* GIF Button */
.gif-button {
    background: transparent;
    border: 1.5px solid var(--accent);
    color: var(--accent);
    font-size: 0.75rem;
    font-weight: 700;
    padding: 6px 10px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
}

.gif-button:hover {
    background: var(--accent);
    color: #111b21;
}

/* GIF Picker Fullscreen */
.gif-picker {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-app);
    display: flex;
    flex-direction: column;
    z-index: 200;
    animation: fadeIn 0.2s ease-out;
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.gif-picker.hidden {
    display: none;
}

.gif-picker-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    padding-top: max(20px, env(safe-area-inset-top));
    background: var(--bg-header);
    border-bottom: 1px solid var(--border);
    font-weight: 600;
    color: var(--text-primary);
}

.gif-close {
    background: none;
    border: none;
    color: #ef4444;
    font-size: 1.4rem;
    font-weight: bold;
    cursor: pointer;
    padding: 4px 10px;
    border-radius: 4px;
}

.gif-close:hover {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
}

.gif-picker input {
    margin: 12px 16px;
    padding: 10px 14px;
    background: var(--bg-header);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 0.95rem;
}

.gif-picker input:focus {
    outline: none;
    border-color: var(--accent);
}

.gif-picker input::placeholder {
    color: var(--text-secondary);
}

/* GIF Results Grid */
.gif-grid {
    flex: 1;
    overflow-y: auto;
    padding: 8px 12px 12px;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.gif-grid img {
    width: 100%;
    height: 100px;
    object-fit: cover;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.15s, opacity 0.15s;
    background: var(--bg-header);
}

.gif-grid img:hover {
    transform: scale(1.05);
    opacity: 0.9;
}

.gif-grid .gif-loading,
.gif-grid .gif-empty {
    grid-column: 1 / -1;
    text-align: center;
    color: var(--text-secondary);
    padding: 20px;
    font-size: 0.9rem;
}

/* GIF Messages in Chat */
.message-gif {
    max-width: 250px;
    border-radius: 8px;
    display: block;
}

.message.sent .message-gif,
.message.received .message-gif {
    max-width: 100%;
}

/* =========================================
   Image Sharing Feature
   ========================================= */

/* Image Button */
.img-button {
    background: transparent;
    border: 1.5px solid var(--accent);
    color: var(--accent);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.img-button:hover {
    background: var(--accent);
    color: #111b21;
}

/* Image Picker Modal */
.image-picker {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-card);
    display: flex;
    flex-direction: column;
    z-index: 200;
    animation: fadeIn 0.2s ease-out;
}

.image-picker.hidden {
    display: none;
}

.image-picker-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    padding-top: max(28px, env(safe-area-inset-top));
    border-bottom: 1px solid var(--border);
    font-weight: 600;
    color: var(--text-primary);
    background: var(--bg-card);
}

.image-close {
    background: none;
    border: none;
    color: #ef4444;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 4px 8px;
}

.image-picker-options {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 40px;
    padding: 40px;
}

/* --- Header & Layout --- */
.pane-header {
    height: auto;
    min-height: 60px;
    /* Reduced min-height slightly */
    display: flex;
    align-items: center;
    padding: 8px 16px;
    padding-top: max(24px, env(safe-area-inset-top));
    /* Adjusted for status bar clearance */
    background: var(--bg-header);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.image-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    background: var(--bg-header);
    border: 2px solid var(--border);
    border-radius: 16px;
    padding: 30px 40px;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--text-primary);
}

.image-option:hover {
    border-color: var(--accent);
    background: var(--bg-sidebar);
}

.image-option svg {
    fill: var(--accent);
}

.image-option span {
    font-size: 1rem;
    font-weight: 500;
}

/* Image Preview Container */
.image-preview-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 20px;
    background: var(--bg-app);
    overflow: hidden;
}

.image-preview-container.hidden {
    display: none;
}

#image-preview {
    flex: 1;
    min-height: 0;
    max-height: calc(100vh - 200px);
    object-fit: contain;
    border-radius: 8px;
    background: #000;
}

.image-preview-actions {
    display: flex;
    justify-content: center;
    gap: 20px;
    padding: 16px 0;
    flex-shrink: 0;
}

.image-discard {
    background: #374151;
    color: #fff;
    border: none;
    padding: 12px 24px;
    border-radius: 24px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    transition: all 0.2s;
}

.image-discard:hover {
    background: #4b5563;
}

.image-send {
    background: var(--accent);
    color: #111b21;
    border: none;
    padding: 12px 32px;
    border-radius: 24px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: all 0.2s;
}

.image-send:hover {
    background: #1aa06d;
}

/* Image Messages in Chat */
.message-image {
    max-width: 280px;
    border-radius: 8px;
    display: block;
    cursor: pointer;
}

.message.sent .message-image,
.message.received .message-image {
    max-width: 100%;
}

/* Image Lightbox */
.image-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 300;
    cursor: zoom-out;
}

.image-lightbox.hidden {
    display: none;
}

.image-lightbox img {
    max-width: 95%;
    max-height: 95%;
    object-fit: contain;
}

/* =========================================
   Reply Preview (above input)
   ========================================= */
.reply-preview {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #1f2c34;
    border-left: 4px solid #00a884;
    padding: 8px 12px;
    margin-bottom: 8px;
    border-radius: 6px;
}

.reply-preview.hidden {
    display: none;
}

.reply-content {
    flex: 1;
    overflow: hidden;
}

.reply-name {
    display: block;
    color: #00a884;
    font-size: 0.8rem;
    font-weight: 600;
    margin-bottom: 2px;
}

.reply-text {
    display: block;
    color: #8696a0;
    font-size: 0.85rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.reply-close {
    background: none;
    border: none;
    color: #8696a0;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 4px 8px;
    margin-left: 8px;
}

.reply-close:hover {
    color: #e9edef;
}

/* Quoted Reply inside message bubble */
.message-quote {
    background: rgba(0, 0, 0, 0.2);
    border-left: 3px solid #00a884;
    padding: 6px 10px;
    margin-bottom: 6px;
    border-radius: 4px;
    font-size: 0.85rem;
}

.message.received .message-quote {
    border-left-color: #7f66ff;
}

.quote-name {
    display: block;
    color: #00a884;
    font-weight: 600;
    font-size: 0.75rem;
    margin-bottom: 2px;
}

.message.received .quote-name {
    color: #7f66ff;
}

.quote-text {
    color: rgba(255, 255, 255, 0.7);
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
}

/* =========================================
   Swipe Animation for Messages
   ========================================= */
.message {
    transition: transform 0.15s ease-out;
    touch-action: pan-y;
}

.message.swiping {
    transition: none;
}

.message .swipe-reply-icon {
    position: absolute;
    left: -40px;
    top: 50%;
    transform: translateY(-50%);
    opacity: 0;
    font-size: 1.2rem;
    transition: opacity 0.15s;
}

.message.swiping .swipe-reply-icon {
    opacity: 1;
}

/* =========================================
   Reaction Picker Popup
   ========================================= */
.reaction-picker {
    position: fixed;
    display: flex;
    gap: 4px;
    background: #1f2c34;
    border-radius: 24px;
    padding: 6px 10px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    z-index: 200;
    animation: popIn 0.15s ease-out;
}

@keyframes popIn {
    from {
        transform: scale(0.8);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

.reaction-picker.hidden {
    display: none;
}

.reaction-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    padding: 6px;
    cursor: pointer;
    border-radius: 50%;
    transition: transform 0.15s, background 0.15s;
}

.reaction-btn:hover {
    transform: scale(1.3);
    background: rgba(255, 255, 255, 0.1);
}

/* =========================================
   Message Reactions Display
   ========================================= */
.message-reactions {
    display: flex;
    gap: 2px;
    margin-top: 4px;
    flex-wrap: wrap;
}

.reaction-badge {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 12px;
    padding: 2px 6px;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 2px;
    cursor: pointer;
}

.reaction-badge:hover {
    background: rgba(0, 0, 0, 0.5);
}

.reaction-emoji {
    font-size: 1rem;
}

.reaction-count {
    font-size: 0.7rem;
    color: #8696a0;
}

/* =========================================
   Desktop Hover Menu (Reply/React buttons)
   ========================================= */
.message-hover-menu {
    position: absolute;
    top: -8px;
    display: none;
    gap: 4px;
    background: #1f2c34;
    border-radius: 8px;
    padding: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
    z-index: 50;
}

.message.sent .message-hover-menu {
    left: -80px;
}

.message.received .message-hover-menu {
    right: -80px;
}

/* Show on hover (desktop only) */
@media (hover: hover) and (pointer: fine) {
    .message:hover .message-hover-menu {
        display: flex;
    }
}

.hover-btn {
    background: none;
    border: none;
    color: #8696a0;
    font-size: 1rem;
    padding: 6px 8px;
    cursor: pointer;
    border-radius: 4px;
    transition: background 0.15s, color 0.15s;
}

.hover-btn:hover {
    background: rgba(0, 168, 132, 0.2);
    color: #00a884;
}

/* =========================================
   Voice Notes Feature
   ========================================= */

/* Voice Button */
.voice-button {
    background: transparent;
    border: 1.5px solid var(--accent);
    color: var(--accent);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.voice-button:hover {
    background: var(--accent);
    color: #111b21;
}

.voice-button.recording {
    background: #ef4444;
    border-color: #ef4444;
    color: white;
    animation: pulse 1s ease-in-out infinite;
}

@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
    }
}

/* Voice Recording Modal */
.voice-modal {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-header);
    padding: 20px;
    padding-bottom: max(20px, env(safe-area-inset-bottom));
    z-index: 300;
    border-top: 1px solid var(--border);
    animation: slideUp 0.2s ease-out;
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
    }

    to {
        transform: translateY(0);
    }
}

.voice-modal.hidden {
    display: none;
}

.voice-modal-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 600px;
    margin: 0 auto;
}

.voice-recording-indicator {
    display: flex;
    align-items: center;
    gap: 16px;
    flex: 1;
}

/* Waveform Animation */
.voice-waveform {
    display: flex;
    align-items: center;
    gap: 3px;
    height: 32px;
}

.voice-waveform span {
    width: 4px;
    background: #ef4444;
    border-radius: 2px;
    animation: waveform 0.5s ease-in-out infinite;
}

.voice-waveform span:nth-child(1) {
    height: 12px;
    animation-delay: 0s;
}

.voice-waveform span:nth-child(2) {
    height: 20px;
    animation-delay: 0.1s;
}

.voice-waveform span:nth-child(3) {
    height: 28px;
    animation-delay: 0.2s;
}

.voice-waveform span:nth-child(4) {
    height: 20px;
    animation-delay: 0.3s;
}

.voice-waveform span:nth-child(5) {
    height: 12px;
    animation-delay: 0.4s;
}

@keyframes waveform {

    0%,
    100% {
        transform: scaleY(0.5);
    }

    50% {
        transform: scaleY(1);
    }
}

.voice-timer {
    font-size: 1.2rem;
    font-weight: 600;
    color: #ef4444;
    min-width: 50px;
}

.voice-actions {
    display: flex;
    gap: 16px;
}

.voice-cancel,
.voice-send {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.voice-cancel {
    background: #374151;
    color: white;
}

.voice-cancel:hover {
    background: #4b5563;
}

.voice-send {
    background: var(--accent);
    color: #111b21;
}

.voice-send:hover {
    background: #16a34a;
}

/* Voice Message in Chat */
.voice-message {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    min-width: 200px;
}

.voice-play-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.2s;
}

.voice-play-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.voice-progress-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.voice-progress {
    height: 4px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
    overflow: hidden;
    cursor: pointer;
}

.voice-progress-bar {
    height: 100%;
    background: white;
    width: 0%;
    transition: width 0.1s linear;
}

.voice-duration {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.7);
}

/* =========================================
   Shared Wallpaper Feature
   ========================================= */

/* Wallpaper Button in Header */
.wallpaper-button {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 8px;
    cursor: pointer;
    border-radius: 50%;
    transition: all 0.2s;
    margin-left: auto;
}

.wallpaper-button:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--accent);
}

/* Wallpaper Modal */
.wallpaper-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-app);
    z-index: 300;
    display: flex;
    flex-direction: column;
    animation: fadeIn 0.2s ease-out;
}

.wallpaper-modal.hidden {
    display: none;
}

.wallpaper-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    padding-top: max(28px, env(safe-area-inset-top));
    background: var(--bg-header);
    border-bottom: 1px solid var(--border);
    font-weight: 600;
    color: var(--text-primary);
}

.wallpaper-close {
    background: none;
    border: none;
    color: #ef4444;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 4px 8px;
}

.wallpaper-modal-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 20px;
    gap: 20px;
    overflow: auto;
}

/* Wallpaper Preview */
.wallpaper-preview {
    flex: 1;
    min-height: 200px;
    max-height: 300px;
    background: var(--bg-card);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-size: cover;
    background-position: center;
    border: 2px dashed var(--border);
}

.wallpaper-preview-text {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.wallpaper-preview.has-image .wallpaper-preview-text {
    display: none;
}

/* Wallpaper Controls */
.wallpaper-controls {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.wallpaper-file-label {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px 20px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.wallpaper-file-label:hover {
    background: var(--bg-sidebar);
    border-color: var(--accent);
}

.wallpaper-file-label input {
    display: none;
}

.opacity-control {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.opacity-control label {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.opacity-control input[type="range"] {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: var(--bg-card);
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

.opacity-control input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--accent);
    cursor: pointer;
}

/* Wallpaper Actions */
.wallpaper-actions {
    display: flex;
    gap: 12px;
    padding-bottom: max(12px, env(safe-area-inset-bottom));
}

.wallpaper-btn-clear,
.wallpaper-btn-apply {
    flex: 1;
    padding: 14px;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
}

.wallpaper-btn-clear {
    background: #374151;
    color: white;
}

.wallpaper-btn-clear:hover {
    background: #4b5563;
}

.wallpaper-btn-apply {
    background: var(--accent);
    color: #111b21;
}

.wallpaper-btn-apply:hover {
    background: #16a34a;
}

/* Wallpaper Preview Dummy Messages */
.wallpaper-dummy-messages {
    display: none;
    flex-direction: column;
    gap: 8px;
    width: 100%;
    padding: 12px;
}

.wallpaper-preview.has-image .wallpaper-dummy-messages {
    display: flex;
}

.dummy-msg {
    max-width: 75%;
    padding: 8px 12px;
    border-radius: 12px;
    font-size: 13px;
    line-height: 1.4;
}

.dummy-msg.sent {
    background: #005c4b;
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

.dummy-msg.received {
    background: #202c33;
    color: white;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}

/* Chat Wallpaper Background - GPU accelerated */
#messages-container.has-wallpaper {
    position: relative;
    will-change: scroll-position;
    transform: translateZ(0);
    contain: layout style;
}

#messages-container.has-wallpaper::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-size: cover;
    background-position: center;
    pointer-events: none;
    z-index: 0;
    will-change: transform;
    transform: translateZ(0);
}

/* =========================================
   Redesigned Input Bar
   ========================================= */

/* Override old button styles */
.img-button,
.gif-button,
.voice-button {
    display: none !important;
}

/* Form Layout */
#message-form {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 16px;
    padding-right: 12px;
    background: var(--bg-header);
    padding-bottom: max(10px, env(safe-area-inset-bottom));
}

/* Android Edge-to-Edge: Input bar extends behind navigation bar */
body.platform-android #message-form {
    padding-bottom: max(10px, env(safe-area-inset-bottom));
}

/* Input Wrapper - Contains input + media buttons */
.input-wrapper {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    background: #2a3942;
    border-radius: 24px;
    padding: 6px 12px;
    min-height: 44px;
}

/* Text Input */
#message-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-size: 15px;
    padding: 8px 12px;
    min-width: 0;
}

#message-input::placeholder {
    color: var(--text-secondary);
}

/* Media Buttons Container */
.media-buttons {
    display: flex;
    align-items: center;
    gap: 4px;
    transition: opacity 0.2s, width 0.2s, margin 0.2s;
    overflow: hidden;
}

/* Individual Media Button */
.media-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: all 0.2s;
    flex-shrink: 0;
}

.media-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--accent);
}

.media-btn.gif-text {
    font-size: 11px;
    font-weight: 700;
    color: var(--accent);
    width: auto;
    padding: 0 8px;
}

/* Hide media buttons when typing */
.input-wrapper.has-text .media-buttons {
    opacity: 0;
    width: 0;
    margin: 0;
    pointer-events: none;
}

/* Send Button */
#send-btn {
    background: var(--accent);
    color: #111b21;
    border: none;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

#send-btn:hover {
    background: #16a34a;
    transform: scale(1.05);
}

/* =========================================
   Profile Picture Feature
   ========================================= */

/* Clickable Avatar */
.avatar-circle.clickable {
    cursor: pointer;
    position: relative;
}

.avatar-circle.clickable:hover {
    opacity: 0.8;
}

.avatar-edit-icon {
    display: none;
    position: absolute;
    bottom: -2px;
    right: -2px;
    background: var(--accent);
    border-radius: 50%;
    padding: 2px 4px;
    font-size: 10px;
}

.avatar-circle.clickable:hover .avatar-edit-icon {
    display: block;
}

/* Profile Picture Modal */
.profile-pic-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-app);
    z-index: 200;
    display: flex;
    flex-direction: column;
    animation: fadeIn 0.2s ease-out;
}

.profile-pic-modal.hidden {
    display: none;
}

.profile-pic-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    padding-top: max(20px, env(safe-area-inset-top));
    background: var(--bg-header);
    border-bottom: 1px solid var(--border);
    font-weight: 600;
    color: var(--text-primary);
}

.profile-pic-close {
    background: none;
    border: none;
    color: #ef4444;
    font-size: 1.4rem;
    font-weight: bold;
    cursor: pointer;
}

.profile-pic-modal-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 24px;
    gap: 20px;
}

.profile-pic-preview {
    width: 180px;
    height: 180px;
    border-radius: 50%;
    background: var(--bg-card);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border: 3px solid var(--border);
    background-size: cover;
    background-position: center;
}

.profile-pic-placeholder {
    color: var(--text-secondary);
    font-size: 14px;
    text-align: center;
    padding: 20px;
}

.profile-pic-preview.has-image .profile-pic-placeholder {
    display: none;
}

.profile-pic-controls {
    display: flex;
    gap: 12px;
}

.profile-pic-file-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: var(--accent);
    color: #111b21;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.profile-pic-file-label:hover {
    background: #16a34a;
}

.profile-pic-file-label input {
    display: none;
}

.profile-pic-actions {
    display: flex;
    gap: 12px;
    margin-top: auto;
    padding-bottom: max(12px, env(safe-area-inset-bottom));
}

.profile-pic-btn-remove,
.profile-pic-btn-apply {
    padding: 14px 28px;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
}

.profile-pic-btn-remove {
    background: #374151;
    color: white;
}

.profile-pic-btn-remove:hover {
    background: #4b5563;
}

.profile-pic-btn-apply {
    background: var(--accent);
    color: #111b21;
}

.profile-pic-btn-apply:hover {
    background: #16a34a;
}

/* Avatar with profile picture */
.avatar-circle.has-pic {
    background-size: cover;
    background-position: center;
}

.avatar-circle.has-pic::after {
    content: none;
}

/* =========================================
   Sidebar Footer with Notification Toggle
   ========================================= */
.sidebar-footer {
    padding: 12px 16px;
    padding-bottom: max(12px, env(safe-area-inset-bottom));
    background: var(--bg-header);
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}

.notification-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
}

.notification-icon {
    font-size: 18px;
}

.toggle-label {
    font-size: 13px;
    color: var(--text-secondary);
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
    width: 44px;
    height: 24px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #374151;
    transition: 0.3s;
    border-radius: 24px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
}

.toggle-switch input:checked+.toggle-slider {
    background-color: var(--accent);
}

.toggle-switch input:checked+.toggle-slider:before {
    transform: translateX(20px);
}

/* =========================================
   Reaction Picker Styles
   ========================================= */
.reaction-picker {
    position: fixed;
    z-index: 9999;
    background: #1e1e1e;
    border-radius: 24px;
    padding: 8px 12px;
    display: flex;
    gap: 4px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    animation: popIn 0.15s ease-out;
}

@keyframes popIn {
    from {
        transform: scale(0.8);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

.reaction-btn {
    width: 40px;
    height: 40px;
    font-size: 24px;
    border: none;
    background: transparent;
    border-radius: 50%;
    cursor: pointer;
    transition: transform 0.1s, background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.reaction-btn:hover {
    transform: scale(1.2);
    background: rgba(255, 255, 255, 0.1);
}

.reaction-btn.reaction-more {
    font-size: 20px;
    color: #8896a4;
    font-weight: bold;
}

/* =========================================
   Full Emoji Picker Modal
   ========================================= */
.emoji-picker-modal {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 10000;
    background: #1e1e1e;
    border-radius: 20px 20px 0 0;
    max-height: 50vh;
    display: flex;
    flex-direction: column;
    animation: slideUp 0.2s ease-out;
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
    }

    to {
        transform: translateY(0);
    }
}

.emoji-picker-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid #333;
    font-weight: 600;
}

.emoji-close {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #333;
    color: white;
    font-size: 16px;
    cursor: pointer;
}

.emoji-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 4px;
    padding: 12px;
    overflow-y: auto;
    max-height: 300px;
}

.emoji-btn {
    width: 100%;
    aspect-ratio: 1;
    font-size: 24px;
    border: none;
    background: transparent;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s;
}

.emoji-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* =========================================
   Reply Media Thumbnail
   ========================================= */
.reply-preview {
    position: relative;
}

.reply-media {
    width: 40px;
    height: 40px;
    border-radius: 6px;
    overflow: hidden;
    margin-left: 10px;
    flex-shrink: 0;
}

.reply-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* =========================================
   Magic Words Animations
   ========================================= */
.msg-text.magic-love {
    background: linear-gradient(90deg, #ff6b6b, #ee5a9f, #ff6b6b);
    background-size: 200% 100%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 600;
    animation: magicGradient 2s ease infinite;
}

.msg-text.magic-fire {
    background: linear-gradient(90deg, #ff512f, #f09819, #ff512f);
    background-size: 200% 100%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 600;
    animation: magicGradient 1.5s ease infinite;
}

.msg-text.magic-birthday {
    background: linear-gradient(90deg, #a855f7, #ec4899, #f97316, #a855f7);
    background-size: 300% 100%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 600;
    animation: magicGradient 3s ease infinite;
}

.msg-text.magic-congrats {
    background: linear-gradient(90deg, #fbbf24, #f97316, #fbbf24);
    background-size: 200% 100%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 600;
    animation: magicGradient 2s ease infinite;
}

@keyframes magicGradient {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

/* Magic Animation Fullscreen Container */
.magic-animation-fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 9999;
    overflow: hidden;
}

.magic-particle {
    position: absolute;
    font-size: 2rem;
    will-change: transform, opacity;
}

/* Animation Variants */
.magic-particle.move-rise {
    animation: particlesRise 4s ease-out forwards;
}

.magic-particle.move-float {
    animation: particlesFloat 5s ease-in-out forwards;
}

.magic-particle.move-confetti {
    animation: particlesConfetti 4s linear forwards;
}

.magic-particle.move-explode {
    animation: particlesExplode 1s ease-out forwards;
}

.magic-particle.move-twinkle {
    animation: particlesTwinkle 3s ease-in-out forwards;
}

/* Keyframes */
@keyframes particlesRise {
    0% {
        transform: translateY(0) scale(0.5) rotate(0deg);
        opacity: 0;
    }

    10% {
        opacity: 1;
    }

    100% {
        transform: translateY(-120vh) scale(1) rotate(360deg);
        opacity: 0;
    }
}

@keyframes particlesFloat {
    0% {
        transform: translateY(0) translateX(0) scale(0.5);
        opacity: 0;
    }

    10% {
        opacity: 1;
    }

    50% {
        transform: translateY(-50vh) translateX(20px) scale(1);
    }

    100% {
        transform: translateY(-120vh) translateX(-20px) scale(0.8);
        opacity: 0;
    }
}

@keyframes particlesConfetti {
    0% {
        transform: translateY(0) rotate(0deg);
        opacity: 1;
    }

    100% {
        transform: translateY(120vh) rotate(720deg);
        opacity: 0;
    }
}

@keyframes particlesExplode {
    0% {
        transform: scale(0.5);
        opacity: 1;
    }

    50% {
        transform: scale(1.5);
        opacity: 1;
    }

    100% {
        transform: scale(2);
        opacity: 0;
    }
}

@keyframes particlesTwinkle {
    0% {
        transform: scale(0.5);
        opacity: 0;
    }

    50% {
        transform: scale(1.2) rotate(180deg);
        opacity: 1;
    }

    100% {
        transform: scale(0.5) rotate(360deg);
        opacity: 0;
    }
}


/* =========================================
   Android / Mobile Input Bar Fixes
   ========================================= */
@media (max-width: 768px) {
    .chat-input-area {
        padding: 6px 8px;
        /* Reduce generic padding */
        padding-bottom: max(6px, env(safe-area-inset-bottom));
    }

    .input-bar-instagram {
        gap: 6px;
        width: 100%;
        max-width: 100%;
    }

    .input-icon-btn {
        width: 42px;
        height: 42px;
        min-width: 42px;
        padding: 8px;
        z-index: 10;
        /* Ensure clickable */
    }

    .input-wrapper-ig {
        height: 42px;
        padding: 0 14px;
        flex: 1;
        min-width: 0;
        /* Flexbox overflow fix */
    }

    .input-wrapper-ig input {
        font-size: 16px;
        padding: 0;
        height: 100%;
    }

    .send-btn-ig {
        width: 42px;
        height: 42px;
        min-width: 42px;
        z-index: 10;
    }
}

/* Fix for Android WebKit Gradients */
.msg-text.magic-love,
.msg-text.effect-love,
.msg-text.magic-fire,
.msg-text.effect-fire,
.msg-text.magic-birthday,
.msg-text.effect-rainbow,
.msg-text.effect-gift,
.msg-text.effect-confetti {
    -webkit-background-clip: text !important;
    background-clip: text !important;
    -webkit-text-fill-color: transparent !important;
    color: transparent !important;
    /* Fallback */
    display: inline;
    /* Required for chrome/android sometimes */
}

/* Message Reactions Display */
.message-reactions {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 4px;
}

.reaction-badge {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    background: rgba(0, 0, 0, 0.3);
    padding: 2px 6px;
    border-radius: 12px;
    font-size: 14px;
    cursor: pointer;
}

.reaction-badge:hover {
    background: rgba(0, 0, 0, 0.5);
}

.reaction-count {
    font-size: 11px;
    color: var(--text-secondary);
}

/* =========================================
   Message Quote (Reply) Styles
   ========================================= */
.message-quote {
    background: rgba(0, 0, 0, 0.2);
    border-left: 3px solid var(--accent);
    border-radius: 4px;
    padding: 6px 10px;
    margin-bottom: 6px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.quote-name {
    font-size: 12px;
    font-weight: 600;
    color: var(--accent);
}

.quote-text {
    font-size: 13px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
}

.quote-media {
    width: 50px;
    height: 50px;
    border-radius: 4px;
    object-fit: cover;
    margin-top: 4px;
}

/* =========================================
   Instagram-Style Input Bar
   ========================================= */
.input-bar-instagram {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 0;
}

.input-icon-btn {
    width: 44px;
    height: 44px;
    min-width: 44px;
    border-radius: 50%;
    background: transparent;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
}

.input-icon-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.input-icon-btn.gif-text {
    font-size: 13px;
    font-weight: 700;
    color: var(--accent);
}

.input-icon-btn.gif-text:hover {
    background: rgba(34, 197, 94, 0.1);
}

.input-wrapper-ig {
    flex: 1;
    background: #2a3942;
    border-radius: 22px;
    padding: 0 16px;
    display: flex;
    align-items: center;
}

.input-wrapper-ig input {
    width: 100%;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 15px;
    padding: 12px 0;
    outline: none;
}

.input-wrapper-ig input::placeholder {
    color: #8696a0;
}

.right-icons {
    display: flex;
    align-items: center;
    gap: 0;
    transition: opacity 0.2s, transform 0.2s;
}

.right-icons.hidden {
    display: none;
}

.send-btn-ig {
    width: 44px;
    height: 44px;
    min-width: 44px;
    border-radius: 50%;
    background: var(--accent);
    color: #111b21;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.15s, background 0.2s;
    flex-shrink: 0;
    animation: popIn 0.15s ease-out;
}

.send-btn-ig:hover {
    transform: scale(1.08);
    background: #25d366;
}

.send-btn-ig:active {
    transform: scale(0.95);
}

.send-btn-ig.hidden {
    display: none;
}

/* Hide legacy send button styling conflicts */
#send-btn:not(.send-btn-ig) {
    display: none;
}

/* =========================================
   Text Effects Modal
   ========================================= */
.effects-modal {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 10000;
    background: #1e1e1e;
    border-radius: 20px 20px 0 0;
    max-height: 70vh;
    display: flex;
    flex-direction: column;
    animation: slideUp 0.25s ease-out;
}

.effects-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid #333;
    font-weight: 600;
    font-size: 16px;
}

.effects-close {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #333;
    color: white;
    font-size: 16px;
    cursor: pointer;
    border: none;
}

.effects-preview {
    padding: 24px 20px;
    text-align: center;
    background: #111;
    margin: 16px;
    border-radius: 12px;
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.preview-text {
    font-size: 20px;
    font-weight: 500;
    transition: all 0.3s;
}

.effects-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    padding: 12px 16px;
    overflow-y: auto;
    max-height: 200px;
}

.effect-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 12px 8px;
    border-radius: 12px;
    background: #2a2a2a;
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.2s;
}

.effect-btn:hover {
    background: #333;
}

.effect-btn.selected {
    border-color: var(--accent);
    background: rgba(34, 197, 94, 0.1);
}

.effect-icon {
    font-size: 24px;
}

.effect-name {
    font-size: 11px;
    color: var(--text-secondary);
}

.effects-actions {
    padding: 16px;
    padding-bottom: max(16px, env(safe-area-inset-bottom));
}

.effects-send-btn {
    width: 100%;
    padding: 14px;
    background: var(--accent);
    color: #111;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.effects-send-btn:hover {
    background: #25d366;
}

/* Effect Preview Styles */
.preview-text.effect-rainbow,
.msg-text.effect-rainbow {
    background: linear-gradient(90deg, #ff0000, #ff8000, #ffff00, #00ff00, #00ffff, #0080ff, #8000ff, #ff0000);
    background-size: 400% 100%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: rainbowFlow 3s linear infinite;
}

@keyframes rainbowFlow {
    0% {
        background-position: 0% 50%;
    }

    100% {
        background-position: 400% 50%;
    }
}

.preview-text.effect-fire,
.msg-text.effect-fire {
    background: linear-gradient(90deg, #ff512f, #f09819, #ff512f);
    background-size: 200% 100%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: magicGradient 1.5s ease infinite;
    font-weight: 700;
}

.preview-text.effect-love,
.msg-text.effect-love {
    background: linear-gradient(90deg, #ff6b6b, #ee5a9f, #ff6b6b);
    background-size: 200% 100%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: magicGradient 2s ease infinite;
    font-weight: 600;
}

.preview-text.effect-glow,
.msg-text.effect-glow {
    color: #00ffff;
    text-shadow: 0 0 10px #00ffff, 0 0 20px #00ffff, 0 0 30px #00ffff;
    animation: glowPulse 1.5s ease-in-out infinite;
}

@keyframes glowPulse {

    0%,
    100% {
        text-shadow: 0 0 10px #00ffff, 0 0 20px #00ffff;
    }

    50% {
        text-shadow: 0 0 20px #00ffff, 0 0 40px #00ffff, 0 0 60px #00ffff;
    }
}

.preview-text.effect-shake,
.msg-text.effect-shake {
    color: #ff4444;
    font-weight: 700;
    animation: shake 0.5s ease-in-out infinite;
}

@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-3px);
    }

    75% {
        transform: translateX(3px);
    }
}

.preview-text.effect-gift,
.msg-text.effect-gift {
    background: linear-gradient(90deg, #ffd700, #ff69b4, #ffd700);
    background-size: 200% 100%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: magicGradient 2s ease infinite;
    font-weight: 600;
}

.preview-text.effect-confetti,
.msg-text.effect-confetti {
    background: linear-gradient(90deg, #ff6b6b, #feca57, #48dbfb, #ff9ff3, #ff6b6b);
    background-size: 400% 100%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: rainbowFlow 2s linear infinite;
    font-weight: 600;
}

/* Effect demo icons in the grid */
.effect-demo-rainbow {
    background: linear-gradient(90deg, #ff0000, #00ff00, #0000ff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.effect-demo-glow {
    text-shadow: 0 0 8px #00ffff;
}

/* =========================================
   Premium Text Effects Polish
   ========================================= */

/* Refined Glow Effect - Cleaner & Premium */
.preview-text.effect-glow,
.msg-text.effect-glow {
    color: #e0f2fe !important;
    text-shadow: 0 0 5px rgba(14, 165, 233, 0.5),
        0 0 10px rgba(14, 165, 233, 0.3),
        0 0 15px rgba(14, 165, 233, 0.2) !important;
    animation: glowPulsePremium 2s ease-in-out infinite alternate !important;
}

@keyframes glowPulsePremium {
    from {
        text-shadow: 0 0 5px rgba(14, 165, 233, 0.5),
            0 0 10px rgba(14, 165, 233, 0.3);
    }

    to {
        text-shadow: 0 0 10px #0ea5e9,
            0 0 20px #0ea5e9,
            0 0 30px rgba(14, 165, 233, 0.5);
    }
}

/* Smoother Rainbow Flow */
.preview-text.effect-rainbow,
.msg-text.effect-rainbow {
    background: linear-gradient(120deg, #ff0080, #ff8c00, #40e0d0, #ff0080) !important;
    background-size: 200% auto !important;
    -webkit-background-clip: text !important;
    background-clip: text !important;
    -webkit-text-fill-color: transparent !important;
    color: transparent !important;
    animation: rainbowFlowPremium 4s linear infinite !important;
    display: inline-block;
}

@keyframes rainbowFlowPremium {
    0% {
        background-position: 0% 50%;
    }

    100% {
        background-position: 200% 50%;
    }
}

/* =========================================
   Compact Media Picker Modal
   ========================================= */
#image-picker-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.85);
    /* Dark overlay */
    z-index: 10001;
    /* Above everything */
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
}

#image-picker-modal:not(.hidden) {
    opacity: 1;
    pointer-events: auto;
}

#image-picker-modal .modal-content {
    background: #1e1e1e;
    border-radius: 24px;
    width: 280px;
    /* Small width */
    max-width: 90%;
    padding: 32px 24px 24px;
    /* Top padding for close button */
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    animation: scaleUp 0.2s ease-out;
}

@keyframes scaleUp {
    from {
        transform: scale(0.9);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

/* Hide default full-screen elements if any */
#image-picker-modal h3 {
    display: none;
}

/* Close Button (Red X) */
.picker-close-btn {
    position: absolute;
    top: -10px;
    right: -10px;
    width: 28px;
    height: 28px;
    background: #ef4444;
    /* Red */
    color: white;
    border-radius: 50%;
    border: 3px solid #1e1e1e;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 20;
}

/* Grid Layout for Icons */
.picker-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.picker-option-btn {
    background: #2a2a2a;
    border-radius: 16px;
    padding: 16px 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    transition: background 0.2s;
    border: 1px solid #333;
}

.picker-option-btn:hover {
    background: #333;
}

.picker-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    margin-top: 4px;
}

/* =========================================
   Quick Fix: Larger Close Button
   ========================================= */
.picker-close-btn {
    width: 40px !important;
    height: 40px !important;
    top: -15px !important;
    right: -15px !important;
    font-size: 20px !important;
}

/* =========================================
   Partial Highlighting & Magic Words
   ========================================= */
.magic-word {
    display: inline-block;
    position: relative;
    z-index: 1;
}

/* Love - Pink Gradient & Bounce */
.magic-word.magic-love {
    background: linear-gradient(90deg, #ff6b6b, #ee5a9f, #ff6b6b);
    background-size: 200% 100%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 800;
    animation: magicGradient 2s ease infinite, bounce 1.5s ease-in-out infinite;
    text-shadow: 0 0 10px rgba(236, 72, 153, 0.3);
}

/* Angry - Red, Shaky, Hot */
.magic-word.magic-angry {
    color: #ef4444;
    font-weight: 900;
    text-transform: uppercase;
    animation: shake 0.4s cubic-bezier(.36, .07, .19, .97) both infinite;
    text-shadow: 2px 2px 0px #000, 0 0 15px rgba(255, 0, 0, 0.6);
    letter-spacing: 1px;
}

/* Keyframes */
@keyframes shake {

    10%,
    90% {
        transform: translate3d(-1px, 1px, 0);
    }

    20%,
    80% {
        transform: translate3d(2px, -1px, 0);
    }

    30%,
    50%,
    70% {
        transform: translate3d(-3px, 2px, 0);
    }

    40%,
    60% {
        transform: translate3d(3px, -2px, 0);
    }
}

@keyframes bounce {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-4px);
    }
}

/* =========================================
   Gift Box Effect
   ========================================= */
.gift-container {
    position: relative;
    display: inline-block;
    min-width: 140px;
    min-height: 60px;
    cursor: pointer;
    margin: 4px 0;
    transition: transform 0.2s;
}

.gift-container:active {
    transform: scale(0.98);
}

/* The Lid / Cover */
.gift-lid {
    position: absolute;
    top: -5px;
    bottom: -5px;
    left: -10px;
    right: -10px;
    background: linear-gradient(135deg, #ec4899, #be185d);
    border-radius: 16px;
    z-index: 10;
    box-shadow: 0 4px 15px rgba(236, 72, 153, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    border: 2px solid rgba(255, 255, 255, 0.2);
}

/* Text on the lid */
.gift-box {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 11;
    color: white;
    font-weight: bold;
    font-size: 14px;
    pointer-events: none;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    white-space: nowrap;
    transition: opacity 0.3s;
}

/* The hidden content */
.gift-content {
    opacity: 0;
    transform: scale(0.9);
    transition: all 0.4s ease-out;
    filter: blur(10px);
}

/* Open State */
.gift-container.open .gift-lid {
    transform: translateY(-80px) rotate(10deg) scale(0.8);
    opacity: 0;
    pointer-events: none;
}

.gift-container.open .gift-box {
    opacity: 0;
}

.gift-container.open .gift-content {
    opacity: 1;
    transform: scale(1);
    filter: blur(0);
}

/* =========================================
   Message Metadata (Time & Ticks)
   ========================================= */
.msg-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 4px;
    margin-top: 2px;
    line-height: 1;
    position: relative;
    float: right;
    margin-left: 8px;
    margin-bottom: -4px;
}

.timestamp {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.6);
    font-weight: normal;
}

.message.received .timestamp {
    color: var(--text-secondary);
}

.message.sent .timestamp {
    color: rgba(233, 237, 239, 0.8);
}

.ticks {
    font-size: 14px;
    /* Slightly larger for visibility */
    color: rgba(255, 255, 255, 0.6);
    display: inline-flex;
}

.ticks.read {
    color: #53bdeb;
    /* Bright Blue for Read */
}

/* Ensure ticks in footer are aligned */
.msg-footer .ticks {
    margin-left: 2px;
}

/* =========================================
   Keyboard Open Adjustments
   ========================================= */
body.keyboard-open #message-form {
    padding-bottom: 0 !important;
}

/* =========================================
   Magic Animation Fullscreen Container
   ========================================= */
.magic-animation-fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 9999;
    overflow: hidden;
}

/* Magic Particle Base */
.magic-particle {
    position: absolute;
    pointer-events: none;
    will-change: transform, opacity;
}

/* Movement Animations */
.move-rise {
    animation: magicRise linear forwards;
}

.move-float {
    animation: magicFloat ease-in-out forwards;
}

.move-confetti {
    animation: magicConfetti ease-out forwards;
}

.move-explode {
    animation: magicExplode ease-out forwards;
}

.move-twinkle {
    animation: magicTwinkle ease-in-out forwards;
}

@keyframes magicRise {
    0% {
        transform: translateY(0) scale(1);
        opacity: 1;
    }

    100% {
        transform: translateY(-110vh) scale(0.5);
        opacity: 0;
    }
}

@keyframes magicFloat {
    0% {
        transform: translateY(0) translateX(0) rotate(0deg);
        opacity: 1;
    }

    50% {
        transform: translateY(-50vh) translateX(30px) rotate(180deg);
        opacity: 0.8;
    }

    100% {
        transform: translateY(-100vh) translateX(-20px) rotate(360deg);
        opacity: 0;
    }
}

@keyframes magicConfetti {
    0% {
        transform: translateY(0) rotateZ(0deg);
        opacity: 1;
    }

    100% {
        transform: translateY(110vh) rotateZ(720deg);
        opacity: 0;
    }
}

@keyframes magicExplode {
    0% {
        transform: scale(0) rotate(0deg);
        opacity: 1;
    }

    50% {
        transform: scale(1.5) rotate(180deg);
        opacity: 1;
    }

    100% {
        transform: scale(0.5) translateY(-50px) rotate(360deg);
        opacity: 0;
    }
}

@keyframes magicTwinkle {

    0%,
    100% {
        opacity: 0;
        transform: scale(0.5);
    }

    25% {
        opacity: 1;
        transform: scale(1.2);
    }

    50% {
        opacity: 0.5;
        transform: scale(1);
    }

    75% {
        opacity: 1;
        transform: scale(1.1);
    }
}

/* =========================================
   Kiss Animation Special
   ========================================= */
.kiss-big {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    font-size: 8rem;
    animation: kissBigPop 1.5s ease-out forwards;
    z-index: 10;
}

@keyframes kissBigPop {
    0% {
        transform: translate(-50%, -50%) scale(0) rotate(-20deg);
        opacity: 0;
    }

    30% {
        transform: translate(-50%, -50%) scale(1.5) rotate(10deg);
        opacity: 1;
    }

    60% {
        transform: translate(-50%, -50%) scale(1.2) rotate(-5deg);
        opacity: 1;
    }

    100% {
        transform: translate(-50%, -50%) scale(0.3) rotate(0deg);
        opacity: 0;
    }
}

/* =========================================
   Unique Bubble Styles Per Effect (Premium)
   ========================================= */
/* Base style override - remove borders, add glow */
.msg-content[class*="effect-"] {
    border: none !important;
    border-radius: 18px;
}

/* Kiss - Pink/Rose gradient */
.msg-content.effect-kiss {
    background: linear-gradient(135deg, #ec4899, #f472b6) !important;
    box-shadow: 0 4px 20px rgba(236, 72, 153, 0.5);
}

/* Sparkle - Purple shimmer */
.msg-content.effect-sparkle {
    background: linear-gradient(135deg, #8b5cf6, #a78bfa) !important;
    box-shadow: 0 4px 20px rgba(139, 92, 246, 0.5);
}

/* Thunder - Electric blue */
.msg-content.effect-thunder {
    background: linear-gradient(135deg, #1e40af, #3b82f6) !important;
    box-shadow: 0 4px 20px rgba(59, 130, 246, 0.6);
}

/* Ice - Icy blue */
.msg-content.effect-ice {
    background: linear-gradient(135deg, #0ea5e9, #67e8f9) !important;
    box-shadow: 0 4px 20px rgba(14, 165, 233, 0.5);
}

/* Galaxy - Deep purple */
.msg-content.effect-galaxy {
    background: linear-gradient(135deg, #1e1b4b, #4c1d95, #7c3aed) !important;
    box-shadow: 0 4px 25px rgba(76, 29, 149, 0.6);
}

/* Music - Vibrant pink/orange */
.msg-content.effect-music {
    background: linear-gradient(135deg, #f43f5e, #fb923c) !important;
    box-shadow: 0 4px 20px rgba(244, 63, 94, 0.5);
}

/* Celebrate - Gold festive */
.msg-content.effect-celebrate {
    background: linear-gradient(135deg, #eab308, #fde047) !important;
    box-shadow: 0 4px 20px rgba(234, 179, 8, 0.5);
    color: #1f2937 !important;
}

/* Sad - Grey melancholy */
.msg-content.effect-sad {
    background: linear-gradient(135deg, #475569, #64748b) !important;
    box-shadow: 0 4px 15px rgba(71, 85, 105, 0.5);
}

/* Scary - Dark spooky */
.msg-content.effect-scary {
    background: linear-gradient(135deg, #1f1f1f, #4a1d6b) !important;
    box-shadow: 0 4px 25px rgba(74, 29, 107, 0.6);
}

/* Angel - Heavenly white/gold */
.msg-content.effect-angel {
    background: linear-gradient(135deg, #fef9c3, #fef3c7) !important;
    box-shadow: 0 4px 20px rgba(254, 243, 199, 0.6);
    color: #78350f !important;
}

/* Devil - Dark red */
.msg-content.effect-devil {
    background: linear-gradient(135deg, #7f1d1d, #dc2626) !important;
    box-shadow: 0 4px 20px rgba(220, 38, 38, 0.5);
}

/* Crown - Royal gold */
.msg-content.effect-crown {
    background: linear-gradient(135deg, #854d0e, #ca8a04, #eab308) !important;
    box-shadow: 0 4px 25px rgba(202, 138, 4, 0.6);
}

/* Money - Green */
.msg-content.effect-money {
    background: linear-gradient(135deg, #14532d, #22c55e) !important;
    box-shadow: 0 4px 20px rgba(34, 197, 94, 0.5);
}

/* Nature - Floral green */
.msg-content.effect-nature {
    background: linear-gradient(135deg, #166534, #4ade80) !important;
    box-shadow: 0 4px 20px rgba(74, 222, 128, 0.4);
}

/* Zen - Calm lavender/teal */
.msg-content.effect-zen {
    background: linear-gradient(135deg, #5eead4, #a5b4fc) !important;
    box-shadow: 0 4px 20px rgba(94, 234, 212, 0.4);
    color: #1f2937 !important;
}

/* Magic - Mystical purple */
.msg-content.effect-magic {
    background: linear-gradient(135deg, #6366f1, #a855f7, #ec4899) !important;
    box-shadow: 0 4px 25px rgba(168, 85, 247, 0.5);
}

/* Rainbow effect */
.msg-content.effect-rainbow {
    background: linear-gradient(90deg, #ef4444, #f97316, #eab308, #22c55e, #3b82f6, #8b5cf6) !important;
    box-shadow: 0 4px 25px rgba(139, 92, 246, 0.5);
}

/* Fire effect */
.msg-content.effect-fire {
    background: linear-gradient(135deg, #dc2626, #f97316, #fbbf24) !important;
    box-shadow: 0 4px 20px rgba(220, 38, 38, 0.5);
}

/* Love effect */
.msg-content.effect-love {
    background: linear-gradient(135deg, #be185d, #ec4899) !important;
    box-shadow: 0 4px 20px rgba(236, 72, 153, 0.5);
}

/* Glow effect */
.msg-content.effect-glow {
    background: linear-gradient(135deg, #0284c7, #38bdf8) !important;
    box-shadow: 0 4px 30px rgba(56, 189, 248, 0.6);
}

/* Confetti/Party effect */
.msg-content.effect-confetti {
    background: linear-gradient(135deg, #7c3aed, #c026d3) !important;
    box-shadow: 0 4px 20px rgba(192, 38, 211, 0.5);
}

/* Shake effect */
.msg-content.effect-shake {
    background: linear-gradient(135deg, #b91c1c, #991b1b) !important;
    box-shadow: 0 4px 20px rgba(185, 28, 28, 0.5);
    animation: bubbleShake 0.5s ease-in-out;
}

@keyframes bubbleShake {

    0%,
    100% {
        transform: translateX(0);
    }

    10%,
    30%,
    50%,
    70%,
    90% {
        transform: translateX(-5px);
    }

    20%,
    40%,
    60%,
    80% {
        transform: translateX(5px);
    }
}

/* Effects Grid Scrollable */
.effects-grid {
    max-height: 300px;
    overflow-y: auto;
}
/* =========================================
   WhatsApp-Style Header Actions & Kebab Menu
   ========================================= */
.chat-header-actions { display: flex; align-items: center; gap: 12px; }
.header-action-btn { background: none; border: none; color: var(--text-color); padding: 6px; border-radius: 50%; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: background-color 0.2s; }
.header-action-btn:hover { background-color: rgba(255,255,255,0.1); }
.kebab-menu-container { position: relative; display: inline-block; }
.kebab-dropdown { position: fixed; right: 8px; top: 56px; background-color: #233138; border: 1px solid rgba(255,255,255,0.1); border-radius: 8px; box-shadow: 0 8px 16px rgba(0,0,0,0.5); min-width: 160px; z-index: 9999; display: flex; flex-direction: column; transform-origin: top right; animation: scaleIn 0.2s ease-out forwards; }
.kebab-dropdown.hidden { display: none; }
.kebab-item { padding: 12px 16px; display: flex; align-items: center; gap: 12px; cursor: pointer; color: var(--text-color); transition: background-color 0.2s; }
.kebab-item:hover { background-color: var(--hover-color); }

/* =========================================
   Call Overlays
   ========================================= */
.call-screen { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; z-index: 9999; color: white; display: flex; flex-direction: column; justify-content: space-between; overflow: hidden; background-color: #000; }
.call-screen.hidden { display: none !important; }
.call-screen-bg { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: #121212; background-image: radial-gradient(circle at center, #1e1e1e 0%, #000 100%); z-index: -2; }
.call-video-full { position: absolute; top: 0; left: 0; width: 100%; height: 100%; object-fit: cover; z-index: -1; background: #000; }
.call-video-pip { position: absolute; bottom: 120px; right: 20px; width: 100px; height: 140px; object-fit: cover; border-radius: 12px; border: 2px solid rgba(255,255,255,0.2); box-shadow: 0 4px 12px rgba(0,0,0,0.5); z-index: 10; transition: transform 0.3s; }
.call-info { text-align: center; padding: 60px 20px 20px; z-index: 5; background: linear-gradient(180deg, rgba(0,0,0,0.7) 0%, transparent 100%); }
.call-info h2 { font-size: 28px; font-weight: 500; margin: 16px 0 8px; text-shadow: 0 2px 4px rgba(0,0,0,0.5); }
.call-info p { font-size: 16px; color: rgba(255,255,255,0.7); }
.active-call-top { display: flex; align-items: center; gap: 16px; padding: 20px; text-align: left; background: linear-gradient(180deg, rgba(0,0,0,0.8) 0%, transparent 100%); }
.active-call-top h2 { font-size: 20px; margin: 0; }
.active-call-top p { font-size: 14px; margin: 0; }
.active-call-top .avatar-circle { width: 40px; height: 40px; }
.call-actions { display: flex; justify-content: space-evenly; align-items: center; padding: 40px 20px 60px; z-index: 5; background: linear-gradient(0deg, rgba(0,0,0,0.7) 0%, transparent 100%); }
.call-btn { width: 60px; height: 60px; border-radius: 50%; border: none; display: flex; align-items: center; justify-content: center; cursor: pointer; box-shadow: 0 4px 12px rgba(0,0,0,0.3); transition: transform 0.2s, background-color 0.2s; color: white; }
.call-btn:active { transform: scale(0.9); }
.btn-accept { background-color: #25D366; width: 72px; height: 72px; }
.btn-decline { background-color: #EF4444; width: 72px; height: 72px; }
.btn-secondary { background-color: rgba(255,255,255,0.2); backdrop-filter: blur(10px); }
.btn-secondary.muted { background-color: white; color: #121212; }
@keyframes scaleIn { from { opacity: 0; transform: scale(0.95); } to { opacity: 1; transform: scale(1); } }
.ringing .avatar-circle { animation: pulse-ring 2s infinite; }
@keyframes pulse-ring { 0% { box-shadow: 0 0 0 0 rgba(37, 211, 102, 0.4); } 70% { box-shadow: 0 0 0 20px rgba(37, 211, 102, 0); } 100% { box-shadow: 0 0 0 0 rgba(37, 211, 102, 0); } }

