/* Spectr E2EE Chat Application - Mobile-Friendly Stylesheet */

/* ========================================
   CSS Variables for Color Palette
   ======================================== */

:root {
    --primary-purple: #3F1CBC;
    --primary-blue: #004CD3;
    --lumo-purple: #B84FFF;
    --lumo-blue: #22E0FF;
    --text-white: #FFFFFF;
    --background-black: #000000;
    --background-dark: #0D0D0D;
    --background-card: #1A1A1A;
    --background-input: #252525;
    --border-color: #333333;
    --success-green: #00C853;
    --error-red: #FF5252;
    --warning-yellow: #FFD740;
    --shadow-soft: 0 4px 20px rgba(0, 0, 0, 0.4);
    --shadow-glow-purple: 0 0 20px rgba(191, 79, 255, 0.3);
    --shadow-glow-blue: 0 0 20px rgba(34, 224, 255, 0.3);
    --transition-fast: 0.15s ease;
    --transition-normal: 0.25s ease;
    --border-radius-sm: 8px;
    --border-radius-md: 12px;
    --border-radius-lg: 20px;
}

/* ========================================
   Reset and Base Styles
   ======================================== */

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

html {
    font-size: 16px;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: var(--background-black);
    color: var(--text-white);
    line-height: 1.5;
    min-height: 100vh;
    overflow-x: hidden;
}

input, button, textarea, select {
    font-family: inherit;
    font-size: inherit;
}

a {
    color: var(--lumo-blue);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--lumo-purple);
}

/* ========================================
   Layout and Container
   ======================================== */

.app-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    max-width: 100vw;
}

.container {
    width: 100%;
    max-width: 480px;
    margin: 0 auto;
    padding: 0 20px;
}

.page {
    display: none;
    flex-direction: column;
    min-height: 100vh;
    padding: 20px;
    animation: fadeIn 0.3s ease;
}

#page-chat {
    height: 100vh;
    min-height: unset;
    overflow: hidden;
    padding: 0;
    flex-direction: row;
}

/* ========================================
   Sidebar
   ======================================== */

.sidebar {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100vh;
    overflow-y: auto;
    overflow-x: hidden;
    background: var(--background-dark);
    flex-shrink: 0;
}

.sidebar.sidebar-hidden {
    display: none;
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px 20px;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

.sidebar .chat-page-badges {
    padding: 10px 20px;
    flex-shrink: 0;
}

.sidebar .card {
    margin: 0 12px 12px;
    flex: 1;
}

/* Desktop: sidebar always visible beside chat */
@media (min-width: 900px) {
    .sidebar {
        width: 320px;
        border-right: 1px solid var(--border-color);
        display: flex !important; /* always show on desktop */
    }

    .sidebar.sidebar-hidden {
        display: flex !important;
    }

    .chat-container {
        display: flex !important;
    }

    #chat-view.hidden {
        /* On desktop show a placeholder when no chat selected */
        display: flex !important;
        align-items: center;
        justify-content: center;
        flex: 1;
    }

    #chat-view.hidden .chat-header,
    #chat-view.hidden .chat-messages,
    #chat-view.hidden .chat-input-container {
        display: none;
    }

    #chat-view.hidden::after {
        content: 'Select a conversation';
        color: #555;
        font-size: 1rem;
    }
}

.page.active {
    display: flex;
}

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

/* ========================================
   Header and Navigation
   ======================================== */

.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px 0;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-white);
}

.logo-icon {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--lumo-purple), var(--lumo-blue));
    border-radius: var(--border-radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
}

.back-btn {
    background: none;
    border: none;
    color: var(--text-white);
    cursor: pointer;
    padding: 10px;
    margin: -10px;
    border-radius: var(--border-radius-sm);
    transition: background var(--transition-fast);
}

.back-btn:hover {
    background: var(--background-input);
}

/* ========================================
   Typography
   ======================================== */

h1 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 10px;
    text-align: center;
}

h2 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 15px;
}

.subtitle {
    color: #AAAAAA;
    text-align: center;
    margin-bottom: 30px;
    font-size: 0.95rem;
}

.text-center {
    text-align: center;
}

.text-muted {
    color: #888888;
}

/* ========================================
   Forms and Inputs
   ======================================== */

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

.form-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-white);
    font-size: 0.9rem;
}

.form-input {
    width: 100%;
    padding: 14px 16px;
    background: var(--background-input);
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius-md);
    color: var(--text-white);
    font-size: 1rem;
    transition: all var(--transition-fast);
}

.form-input:focus {
    outline: none;
    border-color: var(--primary-purple);
    box-shadow: var(--shadow-glow-purple);
}

.form-input::placeholder {
    color: #666666;
}

.form-input.error {
    border-color: var(--error-red);
}

.form-error {
    color: var(--error-red);
    font-size: 0.85rem;
    margin-top: 6px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 28px;
    border: none;
    border-radius: var(--border-radius-md);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
    width: 100%;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-purple), var(--primary-blue));
    color: var(--text-white);
    box-shadow: var(--shadow-glow-purple);
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(191, 79, 255, 0.4);
}

.btn-secondary {
    background: var(--background-card);
    color: var(--text-white);
    border: 2px solid var(--border-color);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--background-input);
    border-color: var(--lumo-purple);
}

.btn-ghost {
    background: transparent;
    color: var(--text-white);
}

.btn-ghost:hover:not(:disabled) {
    background: var(--background-input);
}

.btn-icon {
    width: 44px;
    height: 44px;
    padding: 0;
    border-radius: 50%;
}

/* ========================================
   Cards and Panels
   ======================================== */

.card {
    background: var(--background-card);
    border-radius: var(--border-radius-lg);
    padding: 25px;
    box-shadow: var(--shadow-soft);
    border: 1px solid var(--border-color);
}

.card-header {
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border-color);
}

/* ========================================
   Auth Pages
   ======================================== */

.auth-page {
    justify-content: center;
    padding-top: 40px;
}

.auth-logo {
    text-align: center;
    margin-bottom: 40px;
}

.auth-logo .logo-icon {
    width: 60px;
    height: 60px;
    margin: 0 auto 15px;
    font-size: 1.5rem;
}

.auth-logo .logo-text {
    font-size: 2rem;
}

.auth-footer {
    margin-top: 30px;
    text-align: center;
    color: #888888;
}

/* ========================================
   Chat Interface
   ======================================== */

.chat-container {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    height: 100vh;
    margin: 0;
    overflow: hidden;
}

.chat-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    background: var(--background-card);
    border-bottom: 1px solid var(--border-color);
}

.chat-header-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--lumo-purple), var(--lumo-blue));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 1.1rem;
}

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

.chat-header-name {
    font-weight: 600;
    font-size: 1rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-header-status {
    font-size: 0.8rem;
    color: #888888;
}

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

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.message {
    max-width: 80%;
    padding: 12px 16px;
    border-radius: var(--border-radius-lg);
    animation: messageIn 0.3s ease;
}

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

.message-sent {
    align-self: flex-end;
    background: linear-gradient(135deg, var(--primary-purple), var(--primary-blue));
    border-bottom-right-radius: 4px;
}

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

.message-sender {
    font-size: 0.72rem;
    font-weight: 600;
    opacity: 0.7;
    margin-bottom: 2px;
}

.message-content {
    word-wrap: break-word;
}

.message-time {
    font-size: 0.7rem;
    opacity: 0.7;
    margin-top: 6px;
    text-align: right;
}

.message-status {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.chat-input-container {
    padding: 15px 20px;
    background: var(--background-card);
    border-top: 1px solid var(--border-color);
}

.chat-input-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--background-input);
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: 4px 4px 4px 16px;
    transition: border-color var(--transition-fast);
}

.chat-input-wrapper:focus-within {
    border-color: var(--lumo-purple);
}

.chat-input {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-white);
    padding: 12px 0;
    outline: none;
}

.chat-input::placeholder {
    color: #666666;
}

.chat-send-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--lumo-purple), var(--lumo-blue));
    border: none;
    color: var(--text-white);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform var(--transition-fast);
}

.chat-send-btn:hover {
    transform: scale(1.05);
}

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

/* ========================================
   User List
   ======================================== */

.user-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.user-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    background: var(--background-card);
    border-radius: var(--border-radius-md);
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.user-item:hover {
    border-color: var(--lumo-purple);
    background: var(--background-input);
}

.user-item.active {
    border-color: var(--lumo-purple);
    box-shadow: var(--shadow-glow-purple);
}

.user-item-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-purple), var(--primary-blue));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 1.1rem;
    flex-shrink: 0;
}

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

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

.user-item-status {
    font-size: 0.8rem;
    color: #888888;
}

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

/* ========================================
   Loading and States
   ======================================== */

.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-color);
    border-top-color: var(--lumo-purple);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #888888;
}

.empty-state-icon {
    font-size: 3rem;
    margin-bottom: 15px;
    opacity: 0.5;
}

/* ========================================
   Toast Notifications
   ======================================== */

.toast-container {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    padding: 14px 20px;
    background: var(--background-card);
    border-radius: var(--border-radius-md);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-soft);
    animation: toastIn 0.3s ease;
    max-width: 90vw;
}

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

.toast.success {
    border-left: 4px solid var(--success-green);
}

.toast.error {
    border-left: 4px solid var(--error-red);
}

.toast.warning {
    border-left: 4px solid var(--warning-yellow);
}

/* ========================================
   Modal Dialogs
   ======================================== */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-normal);
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--background-card);
    border-radius: var(--border-radius-lg);
    padding: 25px;
    width: 90%;
    max-width: 400px;
    max-height: 90vh;
    overflow-y: auto;
    transform: scale(0.9);
    transition: transform var(--transition-normal);
    border: 1px solid var(--border-color);
}

.modal-overlay.active .modal {
    transform: scale(1);
}

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

.modal-title {
    font-size: 1.25rem;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    color: #888888;
    cursor: pointer;
    padding: 5px;
    font-size: 1.5rem;
    line-height: 1;
}

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

/* ========================================
   Encryption Badge
   ======================================== */

.encryption-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: rgba(34, 224, 255, 0.1);
    border: 1px solid var(--lumo-blue);
    border-radius: 20px;
    font-size: 0.75rem;
    color: var(--lumo-blue);
}

.encryption-badge::before {
    content: '';
    width: 8px;
    height: 8px;
    background: var(--lumo-blue);
    border-radius: 50%;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* ========================================
   Responsive Design
   ======================================== */

@media (min-width: 768px) {
    .container {
        max-width: 420px;
    }

    .message {
        max-width: 70%;
    }
}

/* ========================================
   Utility Classes
   ======================================== */

.hidden {
    display: none !important;
}

.flex {
    display: flex;
}

.flex-col {
    flex-direction: column;
}

.items-center {
    align-items: center;
}

.justify-center {
    justify-content: center;
}

.justify-between {
    justify-content: space-between;
}

.gap-1 { gap: 4px; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }

.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }

.mb-1 { margin-bottom: 4px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }

.p-1 { padding: 4px; }
.p-2 { padding: 8px; }
.p-3 { padding: 12px; }
.p-4 { padding: 16px; }


/* ========================================
   Connection Status Indicator
   ======================================== */

.encryption-badge {
    transition: all 0.3s ease;
}

.encryption-badge.connected {
    background: rgba(34, 197, 94, 0.1);
    border-color: rgba(34, 197, 94, 0.3);
}

.encryption-badge.connected::before {
    content: '● ';
    color: #22c55e;
}

.encryption-badge.disconnected {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.3);
}

.encryption-badge.disconnected::before {
    content: '● ';
    color: #ef4444;
}

/* ========================================
   Chat Status Improvements
   ======================================== */

.chat-header-status.encrypted {
    color: #22c55e;
    font-weight: 500;
}


/* Empty state improvements for the new "Start Chat" UI */
.empty-state {
    text-align: center;
}

.empty-state .empty-state-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}


/* ========================================
   Separate Connection Status Indicator
   ======================================== */

.connection-status {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.connection-status .status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.connection-status.connected {
    background: rgba(34, 197, 94, 0.1);
    border-color: rgba(34, 197, 94, 0.3);
}

.connection-status.connected .status-dot {
    background: #22c55e;
    box-shadow: 0 0 8px rgba(34, 197, 94, 0.6);
}

.connection-status.disconnected {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.3);
}

.connection-status.disconnected .status-dot {
    background: #ef4444;
    box-shadow: 0 0 8px rgba(239, 68, 68, 0.6);
}

/* Keep E2EE badge clean without indicators */
.encryption-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.05);
}

/* ========================================
   Chat Status Improvements
   ======================================== */

.chat-header-status.encrypted {
    color: #22c55e;
    font-weight: 500;
}

/* ========================================
   Conversation List Styling
   ======================================== */

.user-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s ease;
    margin-bottom: 8px;
}

.user-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.user-item-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 1.1rem;
    flex-shrink: 0;
}

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

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

.user-item-preview {
    font-size: 0.85rem;
    opacity: 0.6;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ========================================
   Start Chat Form Styling
   ======================================== */

#start-chat-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

#start-chat-form .form-input {
    margin: 0;
}

#start-chat-form .btn {
    margin: 0;
}

/* ========================================
   Message Expiry Controls
   ======================================== */

.chat-input-controls {
    padding: 8px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.expiry-select {
    background: var(--background-input);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 6px 12px;
    color: var(--text-white);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23aaaaaa' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 30px;
}

.expiry-select option {
    background: var(--background-card);
    color: var(--text-white);
}

.expiry-select:hover {
    border-color: var(--lumo-purple);
    background-color: var(--background-card);
}

.expiry-select:focus {
    outline: none;
    border-color: var(--lumo-purple);
    box-shadow: var(--shadow-glow-purple);
}

/* ========================================
   Countdown Timer
   ======================================== */

.message-countdown {
    margin-top: 4px;
    font-size: 0.75rem;
    color: #ef4444;
    font-weight: 600;
    animation: pulse 1s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.6;
    }
}

/* Make read-once messages slightly different visually */
.message[data-msg-id] .message-content {
    border-left: 2px solid rgba(239, 68, 68, 0.3);
    padding-left: 8px;
}

/* ========================================
   Message Delete Button
   ======================================== */

.message {
    position: relative;
}

.message-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 4px;
}

.message-delete-btn {
    opacity: 0;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 4px;
    padding: 4px 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
}

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

.message-delete-btn:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: rgba(239, 68, 68, 0.5);
}

.message-delete-btn svg {
    color: #ef4444;
}

/* ========================================
   Emoji Picker
   ======================================== */

.emoji-btn {
    background: none;
    border: none;
    font-size: 1.4rem;
    cursor: pointer;
    padding: 0 8px;
    transition: transform 0.2s ease;
    flex-shrink: 0;
}

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

.emoji-picker {
    position: absolute;
    bottom: 100%;
    left: 10px;
    background: rgba(20, 20, 20, 0.98);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 12px;
    margin-bottom: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    z-index: 1000;
    width: 280px;
    max-height: 200px;
    overflow-y: auto;
}

.emoji-picker.hidden {
    display: none;
}

.emoji-grid {
    display: inline;
    font-size: 1.8rem;
    line-height: 2.2rem;
    letter-spacing: 4px;
    word-spacing: 2px;
    cursor: default;
}

/* Individual emoji spans need to be clickable */
.emoji-grid span {
    display: inline-block;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: background 0.2s ease;
    user-select: none;
}

.emoji-grid span:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Chat input wrapper needs relative positioning for emoji picker */
.chat-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
}
/* ========================================
   Unread Badge
   ======================================== */

.unread-badge {
    min-width: 22px;
    height: 22px;
    background: var(--error-red);
    color: var(--text-white);
    border-radius: 11px;
    font-size: 0.75rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 6px;
    margin-left: auto;
    flex-shrink: 0;
    animation: badge-pop 0.2s ease;
}

@keyframes badge-pop {
    0%   { transform: scale(0.5); opacity: 0; }
    70%  { transform: scale(1.2); }
    100% { transform: scale(1);   opacity: 1; }
}

/* ========================================
   Chat Page — Badges Row
   ======================================== */

.chat-page-badges {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    justify-content: center;
    flex-wrap: wrap;
}

/* ========================================
   Auth Page — Encryption Badge
   ======================================== */

.auth-encryption-badge {
    margin-top: 30px;
    justify-content: center;
}

/* ========================================
   Logout Button
   ======================================== */

.btn-logout {
    width: auto;
    padding: 10px 20px;
}

/* ========================================
   User List Title
   ======================================== */

.user-list-title {
    margin-bottom: 15px;
}

/* ========================================
   Modal Description
   ======================================== */

.modal-description {
    margin-bottom: 20px;
}

/* ========================================
   Form Hint
   ======================================== */

.form-hint {
    font-size: 0.8rem;
    margin-top: 6px;
}

/* ========================================
   Read-once static label (before countdown starts)
   ======================================== */

.message-read-once {
    opacity: 0.8;
    font-style: italic;
}

/* ========================================
   Header Actions Group
   ======================================== */

.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ========================================
   Detonate Button
   ======================================== */

.btn-detonate {
    width: auto;
    padding: 8px 14px;
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.4);
    color: #ef4444;
    border-radius: var(--border-radius-md);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-detonate:hover {
    background: rgba(239, 68, 68, 0.25);
    border-color: #ef4444;
    box-shadow: 0 0 12px rgba(239, 68, 68, 0.3);
}

/* ========================================
   Clear Chat Button (in chat header)
   ======================================== */

.btn-clear-chat {
    background: none;
    border: none;
    color: #888888;
    cursor: pointer;
    padding: 8px;
    border-radius: var(--border-radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
    margin-left: auto;
}

.btn-clear-chat:hover {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
}

/* ========================================
   Detonate Modal
   ======================================== */

.modal-detonate {
    text-align: center;
    padding: 35px 30px;
}

.detonate-title {
    font-size: 1.3rem;
    color: #ef4444;
}

.detonate-description {
    margin-bottom: 30px;
    line-height: 1.6;
    color: #aaaaaa;
}

.detonate-description strong {
    color: var(--text-white);
}

/* Circular countdown ring */
.detonate-countdown-wrap {
    position: relative;
    width: 100px;
    height: 100px;
    margin: 0 auto 28px;
}

.detonate-ring {
    width: 100px;
    height: 100px;
    transform: rotate(-90deg);
}

.detonate-ring-bg {
    fill: none;
    stroke: rgba(239, 68, 68, 0.15);
    stroke-width: 8;
}

.detonate-ring-fill {
    fill: none;
    stroke: #ef4444;
    stroke-width: 8;
    stroke-linecap: round;
    stroke-dasharray: 276.46; /* 2 * pi * 44 */
    stroke-dashoffset: 0;
    transition: stroke-dashoffset 1s linear;
}

.detonate-countdown-num {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.2rem;
    font-weight: 700;
    color: #ef4444;
}

.btn-cancel-detonate {
    width: 100%;
    padding: 14px;
    background: var(--background-input);
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius-md);
    color: var(--text-white);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-cancel-detonate:hover {
    border-color: var(--lumo-purple);
    background: var(--background-card);
}

/* ========================================
   Payment Page
   ======================================== */

.payment-card {
    padding: 28px 24px;
}

.payment-header {
    text-align: center;
    margin-bottom: 20px;
}

.payment-amount {
    font-size: 2.2rem;
    font-weight: 800;
    color: var(--text-white);
    line-height: 1;
}

.payment-amount span {
    font-size: 1rem;
    font-weight: 400;
    color: #888;
}

.payment-network {
    font-size: 0.8rem;
    color: var(--lumo-purple);
    font-weight: 600;
    margin-top: 4px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.payment-instruction {
    font-size: 0.88rem;
    color: #aaa;
    text-align: center;
    line-height: 1.6;
    margin-bottom: 20px;
}

.payment-instruction strong {
    color: var(--text-white);
}

.payment-address-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--background-input);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    padding: 12px 14px;
    margin-bottom: 18px;
}

.payment-address {
    font-family: 'Courier New', monospace;
    font-size: 0.75rem;
    color: var(--text-white);
    word-break: break-all;
    flex: 1;
    user-select: all;
}

.btn-copy-address {
    background: none;
    border: none;
    color: #888;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    display: flex;
    flex-shrink: 0;
    transition: color var(--transition-fast);
}

.btn-copy-address:hover { color: var(--lumo-purple); }
.btn-copy-address.copied { color: #22c55e; }

.payment-qr-wrap {
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
}

.payment-qr-wrap canvas,
.payment-qr-wrap img {
    border-radius: 12px;
    border: 4px solid #fff;
    width: 160px !important;
    height: 160px !important;
}

.payment-status-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 12px;
    color: #aaa;
    font-size: 0.88rem;
}

.payment-status-row .spinner {
    width: 16px;
    height: 16px;
    border-width: 2px;
}

.payment-status-confirmed {
    color: #22c55e;
    font-weight: 600;
}

.payment-expiry {
    text-align: center;
    font-size: 0.78rem;
    color: #666;
}

.payment-expiry span {
    font-family: 'Courier New', monospace;
    color: #aaa;
}

.payment-footer-note {
    font-size: 0.8rem;
    color: #666;
    text-align: center;
    margin-bottom: 6px;
    line-height: 1.5;
}

/* Detonate confirmation step */
.detonate-warning-icon {
    font-size: 2.5rem;
    text-align: center;
    margin-bottom: 12px;
}

.detonate-cost-notice {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: var(--border-radius-md);
    padding: 12px 16px;
    text-align: center;
    font-size: 0.9rem;
    color: #aaa;
    margin-bottom: 24px;
}

.detonate-cost-notice strong {
    color: #ef4444;
    font-size: 1.1rem;
}

.detonate-confirm-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.btn-detonate-confirm {
    width: 100%;
    padding: 14px;
    background: #ef4444;
    border: none;
    border-radius: var(--border-radius-md);
    color: #fff;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-detonate-confirm:hover {
    background: #dc2626;
    box-shadow: 0 0 16px rgba(239, 68, 68, 0.4);
}

/* Payment progress bar */
.payment-progress-wrap {
    margin-bottom: 16px;
}

.payment-progress-label {
    display: flex;
    justify-content: space-between;
    font-size: 0.78rem;
    color: #888;
    margin-bottom: 6px;
}

.payment-progress-bar {
    height: 8px;
    background: var(--background-input);
    border-radius: 99px;
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.payment-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--lumo-purple), #a855f7);
    border-radius: 99px;
    transition: width 0.6s ease;
    width: 0%;
}

.payment-short-notice {
    margin-top: 8px;
    font-size: 0.8rem;
    color: #f59e0b;
    text-align: center;
    line-height: 1.5;
}

/* ── Group Settings Modal ─────────────────────────────────────── */

.group-member-list {
    max-height: 280px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.member-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 10px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.04);
}

.member-row:hover {
    background: rgba(255, 255, 255, 0.07);
}

.member-row-name {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
}

.admin-badge {
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    color: #90cdf4;
    background: rgba(144, 205, 244, 0.15);
    border: 1px solid rgba(144, 205, 244, 0.3);
    border-radius: 4px;
    padding: 1px 5px;
}

.member-row-actions {
    display: flex;
    gap: 6px;
}

.member-action-btn {
    font-size: 0.75rem;
    padding: 3px 10px;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: transparent;
    color: inherit;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}

.member-action-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.35);
}

.member-action-danger {
    border-color: rgba(229, 62, 62, 0.4);
    color: #fc8181;
}

.member-action-danger:hover {
    background: rgba(229, 62, 62, 0.15);
    border-color: rgba(229, 62, 62, 0.6);
}

.group-action-btn {
    flex: 1;
    padding: 10px;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    cursor: pointer;
    font-weight: 600;
    transition: opacity 0.15s;
}

.group-action-btn:hover {
    opacity: 0.85;
}

.group-action-leave {
    background: #c53030;
    color: #fff;
}

.group-action-delete {
    background: #742a2a;
    color: #fff;
}
