/**
 * SecureChat Styles
 * Dark theme with minimal design
 */

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

:root {
    --bg-primary: #0d0d0d;
    --bg-secondary: #1a1a1a;
    --bg-tertiary: #252525;
    --bg-hover: #2a2a2a;
    --text-primary: #ffffff;
    --text-secondary: #888888;
    --text-muted: #555555;
    --accent: #3b82f6;
    --accent-hover: #2563eb;
    --danger: #ef4444;
    --success: #22c55e;
    --border: #333333;
    --message-sent: #1d4ed8;
    --message-received: #2a2a2a;
}

html, body {
    height: 100%;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    overflow: hidden;
}

.hidden {
    display: none !important;
}

/* ============================================
   SVG ICON BUTTONS
   ============================================ */

.btn-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    border: none;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, color 0.2s;
    flex-shrink: 0;
}

.btn-icon:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.btn-icon svg {
    width: 20px;
    height: 20px;
}

.btn-header-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, color 0.2s;
}

.btn-header-icon:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.btn-header-icon.btn-logout:hover {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

.btn-header-icon svg {
    width: 18px;
    height: 18px;
}

.btn-action {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s, color 0.2s, border-color 0.2s;
}

.btn-action:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    border-color: var(--text-secondary);
}

.btn-action svg {
    width: 16px;
    height: 16px;
}

.btn-send {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    border: none;
    background: var(--accent);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    flex-shrink: 0;
}

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

.btn-send svg {
    width: 18px;
    height: 18px;
}

/* ============================================
   WELCOME / SIGNUP / RESTORE SCREENS
   ============================================ */

.screen {
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.card {
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 40px;
    max-width: 500px;
    width: 100%;
    border: 1px solid var(--border);
}

.card h1 {
    font-size: 28px;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.card h1 .icon {
    font-size: 32px;
}

.card .subtitle {
    color: var(--text-secondary);
    margin-bottom: 30px;
}

.card h2 {
    font-size: 20px;
    margin-bottom: 20px;
}

.btn-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.btn {
    padding: 14px 24px;
    border-radius: 8px;
    border: none;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

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

.btn-primary:hover {
    background: var(--accent-hover);
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

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

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
}

.btn-small {
    padding: 8px 16px;
    font-size: 14px;
}

.btn-icon {
    padding: 8px 12px;
    font-size: 14px;
}

/* Key Display */
.key-display {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 16px;
    margin: 20px 0;
}

.key-label {
    font-size: 12px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 8px;
}

.key-value {
    font-family: 'Courier New', monospace;
    font-size: 14px;
    word-break: break-all;
    color: var(--accent);
    line-height: 1.5;
}

.key-actions {
    margin-top: 12px;
    display: flex;
    gap: 8px;
}

.warning-box {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 8px;
    padding: 16px;
    margin: 20px 0;
    color: #fca5a5;
    font-size: 14px;
    line-height: 1.5;
}

.warning-box strong {
    color: var(--danger);
}

/* Form Elements */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 12px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 14px;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--accent);
}

.form-group input::placeholder {
    color: var(--text-muted);
}

.error-text {
    color: var(--danger);
    font-size: 14px;
    margin-top: 8px;
}

.back-link {
    margin-top: 20px;
    text-align: center;
}

.back-link a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
}

.back-link a:hover {
    color: var(--text-primary);
}

/* ============================================
   MAIN APP LAYOUT
   ============================================ */

.app-container {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* Sidebar */
.sidebar {
    width: 320px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid var(--border);
}

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

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

.user-details {
    flex: 1;
    min-width: 0;
}

.user-name {
    font-weight: 600;
    font-size: 15px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-id {
    font-size: 12px;
    color: var(--text-secondary);
    font-family: monospace;
    display: flex;
    align-items: center;
    gap: 8px;
}

.connection-status {
    font-size: 10px;
}

.connection-status.connected {
    color: var(--success);
}

.connection-status.disconnected {
    color: var(--danger);
}

.user-actions {
    display: flex;
    gap: 8px;
}

/* New Chat */
.new-chat {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}

.new-chat-input {
    display: flex;
    gap: 8px;
}

.new-chat-input input {
    flex: 1;
    padding: 10px 12px;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 13px;
    font-family: monospace;
}

.new-chat-input input::placeholder {
    color: var(--text-muted);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Conversations List */
.conversations-list {
    flex: 1;
    overflow-y: auto;
}

.conversation-item {
    padding: 12px 20px;
    cursor: pointer;
    border-bottom: 1px solid var(--border);
    transition: background 0.2s;
    display: flex;
    align-items: center;
    gap: 12px;
}

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

.conversation-item.active {
    background: var(--bg-tertiary);
    border-left: 3px solid var(--accent);
}

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

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

.conv-name {
    font-weight: 500;
    margin-bottom: 4px;
}

.conv-id {
    font-size: 12px;
    color: var(--text-secondary);
    font-family: monospace;
}

.no-conversations {
    padding: 40px 20px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.6;
}

/* ============================================
   CHAT AREA
   ============================================ */

.chat-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-primary);
    min-width: 0;
    min-height: 0;
    overflow: hidden;
}

.chat-placeholder {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    font-size: 16px;
}

.chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
    position: relative;
}

/* Chat Header */
.chat-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-secondary);
    flex-shrink: 0;
}

.chat-recipient {
    display: flex;
    align-items: center;
    gap: 12px;
}

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

.recipient-name {
    font-weight: 600;
}

.recipient-id {
    font-size: 12px;
    color: var(--text-secondary);
    font-family: monospace;
}

/* Messages */
.messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-height: 0;
}

.message {
    max-width: 70%;
    padding: 12px 16px;
    border-radius: 16px;
    position: relative;
}

.message.sent {
    align-self: flex-end;
    background: var(--message-sent);
    border-bottom-right-radius: 4px;
}

.message.received {
    align-self: flex-start;
    background: var(--message-received);
    border-bottom-left-radius: 4px;
}

.message-content {
    font-size: 15px;
    line-height: 1.4;
    word-wrap: break-word;
}

.message-time {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.6);
    margin-top: 6px;
    text-align: right;
}

.system-message {
    text-align: center;
    color: var(--text-secondary);
    font-size: 13px;
    padding: 20px;
}

.typing-indicator {
    font-size: 13px;
    color: var(--text-secondary);
    padding: 8px 20px;
    font-style: italic;
    flex-shrink: 0;
}

/* Message Input */
.message-input-container {
    padding: 16px 20px;
    border-top: 1px solid var(--border);
    background: var(--bg-secondary);
    display: flex;
    gap: 12px;
    align-items: flex-end;
    position: relative;
    flex-shrink: 0;
}

.message-input-container textarea {
    flex: 1;
    padding: 12px 16px;
    border-radius: 24px;
    border: 1px solid var(--border);
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 15px;
    resize: none;
    max-height: 120px;
    min-height: 44px;
    line-height: 1.4;
}

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

.message-input-container textarea::placeholder {
    color: var(--text-muted);
}

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

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

/* ============================================
   MODALS
   ============================================ */

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 30px;
    max-width: 450px;
    width: 90%;
    border: 1px solid var(--border);
}

.modal-content h2 {
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 24px;
}

/* ============================================
   SCROLLBAR
   ============================================ */

::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: var(--bg-tertiary);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--border);
}

/* ============================================
   RESPONSIVE - MOBILE
   ============================================ */

/* Hide back button on desktop */
.btn-back-mobile {
    display: none;
}

@media (max-width: 768px) {
    .app-container {
        flex-direction: column;
        height: 100vh;
        height: 100dvh; /* Dynamic viewport height for mobile */
    }

    .sidebar {
        width: 100%;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 100;
        transition: transform 0.3s ease;
    }

    .sidebar.hidden-mobile {
        transform: translateX(-100%);
    }

    .chat-area {
        width: 100%;
        height: 100vh;
        height: 100dvh;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
    }

    .chat-container {
        height: 100%;
        display: flex;
        flex-direction: column;
    }

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

    /* Show back button on mobile */
    .btn-back-mobile {
        display: flex;
        margin-right: 8px;
    }

    .messages-container {
        flex: 1;
        min-height: 0;
        overflow-y: auto;
        padding: 12px;
        padding-bottom: 20px;
    }

    .message-input-container {
        flex-shrink: 0;
        padding: 12px;
        padding-bottom: max(12px, env(safe-area-inset-bottom));
        background: var(--bg-secondary);
        border-top: 1px solid var(--border);
    }

    .message {
        max-width: 85%;
    }

    .chat-placeholder {
        display: none;
    }

    /* Modal adjustments for mobile */
    .modal-content {
        width: 95%;
        max-height: 90vh;
        overflow-y: auto;
        padding: 20px;
    }

    /* Emoji picker mobile */
    .emoji-picker {
        left: 10px;
        right: 10px;
        max-width: none;
        grid-template-columns: repeat(8, 1fr);
    }

    /* Card adjustments */
    .card {
        padding: 24px;
        margin: 10px;
    }

    .screen {
        padding: 10px;
    }
}

/* ============================================
   AVATAR UPLOAD
   ============================================ */

.avatar-upload-container {
    display: flex;
    align-items: center;
    gap: 16px;
}

.avatar-preview {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--border);
}

.avatar-buttons {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* ============================================
   ONLINE STATUS & INDICATORS
   ============================================ */

.conv-avatar-wrapper {
    position: relative;
    flex-shrink: 0;
}

.conv-avatar-wrapper .online-indicator {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 12px;
    height: 12px;
    background: var(--success);
    border-radius: 50%;
    border: 2px solid var(--bg-secondary);
}

.online-status {
    font-size: 11px;
    margin-left: 8px;
}

.online-status.online {
    color: var(--success);
}

.online-status.offline {
    color: var(--text-secondary);
}

.recipient-meta {
    display: flex;
    align-items: center;
}

/* ============================================
   UNREAD BADGES
   ============================================ */

.conv-name-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.unread-badge {
    background: var(--accent);
    color: white;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
}

.conv-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    color: var(--text-secondary);
}

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

/* ============================================
   REPLY PREVIEW
   ============================================ */

.reply-preview {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 20px;
    background: var(--bg-tertiary);
    border-left: 3px solid var(--accent);
    font-size: 13px;
    color: var(--text-secondary);
    flex-shrink: 0;
}

.btn-cancel-reply {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 16px;
    padding: 4px 8px;
}

.btn-cancel-reply:hover {
    color: var(--text-primary);
}

/* Reply inside message */
.message-reply-preview {
    background: rgba(0, 0, 0, 0.2);
    border-left: 2px solid rgba(255, 255, 255, 0.3);
    padding: 6px 10px;
    margin-bottom: 8px;
    border-radius: 4px;
    font-size: 12px;
}

.message-reply-preview .reply-sender {
    color: rgba(255, 255, 255, 0.7);
    font-weight: 500;
    display: block;
    margin-bottom: 2px;
}

.message-reply-preview .reply-text {
    color: rgba(255, 255, 255, 0.6);
}

/* Message footer with reply button */
.message-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 6px;
}

.btn-reply {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.4);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    opacity: 0;
    transition: opacity 0.2s, color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-reply svg {
    width: 14px;
    height: 14px;
}

.message:hover .btn-reply {
    opacity: 1;
}

.btn-reply:hover {
    color: rgba(255, 255, 255, 0.8);
}

/* ============================================
   EMOJI PICKER
   ============================================ */

.emoji-picker {
    position: absolute;
    bottom: 60px;
    left: 0;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px;
    display: grid;
    grid-template-columns: repeat(10, 1fr);
    gap: 4px;
    max-width: 340px;
    z-index: 100;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.emoji-item {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: 4px;
    font-size: 18px;
    transition: background 0.2s;
}

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

/* ============================================
   BLOCKED USERS LIST
   ============================================ */

.blocked-list {
    max-height: 300px;
    overflow-y: auto;
}

.blocked-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-bottom: 1px solid var(--border);
}

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

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

.blocked-info {
    flex: 1;
}

.blocked-name {
    font-weight: 500;
    margin-bottom: 2px;
}

.blocked-id {
    font-size: 12px;
    color: var(--text-secondary);
    font-family: monospace;
}

.no-blocked {
    padding: 30px;
    text-align: center;
    color: var(--text-secondary);
}

.btn-unblock {
    padding: 6px 12px !important;
    font-size: 12px !important;
}

/* ============================================
   NEW CHAT ACTIONS
   ============================================ */

.new-chat-actions {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

.new-chat-actions .btn {
    flex: 1;
}

/* ============================================
   SIDEBAR SECTIONS
   ============================================ */

.sidebar-section {
    margin-top: 16px;
}

.section-header {
    padding: 8px 16px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-secondary);
    letter-spacing: 0.5px;
}

/* ============================================
   GROUPS LIST
   ============================================ */

.groups-list {
    max-height: 200px;
    overflow-y: auto;
}

.group-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    cursor: pointer;
    transition: background 0.2s;
}

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

.group-item.active {
    background: var(--bg-tertiary);
}

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

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

.group-name {
    font-weight: 500;
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.group-members {
    font-size: 12px;
    color: var(--text-secondary);
}

.no-groups {
    padding: 16px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 13px;
}

/* ============================================
   FILE UPLOAD
   ============================================ */

.btn-attach {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    font-size: 18px;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-attach:hover {
    background: var(--bg-hover);
}

.file-preview {
    padding: 12px 20px;
    background: var(--bg-tertiary);
    border-top: 1px solid var(--border);
}

.file-preview-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.file-preview-image {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 8px;
}

.file-icon {
    width: 60px;
    height: 60px;
    background: var(--bg-secondary);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
}

.file-preview-info {
    flex: 1;
}

.file-name {
    display: block;
    font-weight: 500;
    margin-bottom: 4px;
}

.file-size {
    font-size: 12px;
    color: var(--text-secondary);
}

.btn-remove-file {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--danger);
    border: none;
    color: white;
    font-size: 16px;
    cursor: pointer;
    transition: opacity 0.2s;
}

.btn-remove-file:hover {
    opacity: 0.8;
}

/* Drag & Drop State */
.chat-container.drag-over {
    background: var(--bg-tertiary);
}

.chat-container.drag-over::after {
    content: 'Drop file to upload';
    position: absolute;
    inset: 0;
    background: rgba(74, 144, 226, 0.1);
    border: 2px dashed var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: var(--accent);
    pointer-events: none;
    z-index: 10;
}

/* ============================================
   QR CODE
   ============================================ */

.qr-code-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px;
}

.qr-code-container canvas {
    border-radius: 12px;
    border: 4px solid white;
}

.qr-hint {
    margin-top: 12px;
    font-size: 13px;
    color: var(--text-secondary);
}

/* ============================================
   GROUP CONTACTS LIST
   ============================================ */

.group-contacts-list {
    max-height: 250px;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: 8px;
}

.group-contact-item {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
}

.group-contact-item:last-child {
    border-bottom: none;
}

.group-contact-item input[type="checkbox"] {
    margin-right: 12px;
    width: 18px;
    height: 18px;
}

.group-contact-item label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    flex: 1;
}

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

/* ============================================
   REACTIONS
   ============================================ */

.reaction-picker {
    display: flex;
    gap: 4px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 24px;
    padding: 6px 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 100;
    margin-bottom: 8px;
}

.reaction-emoji {
    font-size: 22px;
    cursor: pointer;
    padding: 4px;
    border-radius: 50%;
    transition: transform 0.15s, background 0.2s;
}

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

.message-reactions {
    display: flex;
    gap: 6px;
    margin-top: 6px;
    flex-wrap: wrap;
}

.reaction-badge {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 2px 8px;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.2s;
}

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

/* Message sender name (for groups) */
.message-sender {
    font-size: 12px;
    font-weight: 500;
    color: var(--accent);
    margin-bottom: 4px;
}

/* ============================================
   MESSAGE IMAGES & GIFS
   ============================================ */

.message-image {
    max-width: 100%;
    max-height: 300px;
    border-radius: 8px;
    cursor: pointer;
    display: block;
    margin: 4px 0;
}

.message-image:hover {
    opacity: 0.9;
}

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

.message.sent .message-content a {
    color: #a8d4ff;
}

/* ============================================
   GIF PICKER MODAL
   ============================================ */

.gif-modal-content {
    max-width: 500px;
    width: 90vw;
}

.gif-search {
    margin-bottom: 16px;
}

.gif-search input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    font-size: 14px;
}

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

.gif-results {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 8px;
    max-height: 350px;
    overflow-y: auto;
    padding: 4px;
}

.gif-result-item {
    width: 100%;
    height: 100px;
    object-fit: cover;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.15s, opacity 0.15s;
}

.gif-result-item:hover {
    transform: scale(1.05);
    opacity: 0.9;
}

.gif-loading {
    grid-column: 1 / -1;
    text-align: center;
    padding: 40px 20px;
    color: var(--text-secondary);
}

.giphy-attribution {
    text-align: center;
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

