/* Chat Modal Styles */

/* 🔥 Override side padding for chat modal - full edge-to-edge */
/* But keep bottom padding for nav bar */
.chat-modal .base-modal-body {
    padding: 0 0 var(--nav-height, 70px) 0 !important;
}

/* Drag handle needs padding even when modal has none */
.chat-mode .base-modal-drag-handle {
    margin-top: 12px;
    margin-bottom: 4px;
}

/* MESSAGES header - minimal bottom padding */
.chat-mode .modal-header {
    padding: 0 20px 8px;
    margin-bottom: 0;
}

.chat-container {
    display: flex;
    height: 100%; /* Fill parent (modal-body) */
    width: 100%;
    background: transparent; /* Inherit from modal */
    overflow: hidden;
}

.contacts-list {
    width: 35%;
    height: 100%;
    background: transparent;
    border-right: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.chat-view {
    width: 65%;
    display: flex;
    flex-direction: column;
    background: transparent;
    position: relative;
}

/* Mobile layout adjustment */
@media (max-width: 600px) {
    .chat-container {
        height: 100%;
        border-radius: 0;
    }
    
    .contacts-list {
        width: 100%;
        height: 100%;
        display: flex;
        flex-direction: column;
    }

    .chat-view {
        width: 100%;
        display: none;
        position: absolute;
        top: 0;
        left: 0;
        height: 100%;
        z-index: 10;
        background: var(--bg-color);
        will-change: transform; /* Smooth swipe-to-close animation */
    }

    .chat-view.active {
        display: flex;
    }
}

/* Contacts List */
.contacts-header {
    padding: 8px 16px 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: 44px;
    box-sizing: border-box;
    background: transparent;
    width: 100%;
}

.contacts-header h3 {
    font-size: 12px;
    color: var(--text-secondary);
    margin: 0;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
}

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

.contacts-header .btn-icon {
    background: none;
    border: none;
    color: var(--gold);
    font-size: 16px;
    cursor: pointer;
    padding: 4px;
}

.contacts-header .btn-icon:hover {
    opacity: 0.8;
}

/* Create Group Form Styling */
.create-group-form {
    width: 100%;
}

.create-group-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.create-group-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--white);
}

.create-group-form .group-name-input {
    width: 100%;
    margin-bottom: 8px;
}

.create-group-hint {
    margin: 0;
    font-size: 11px;
    color: var(--text-secondary);
}

.btn-add-contact {
    background: transparent;
    border: 1px solid rgba(207, 181, 106, 0.3);
    color: var(--gold);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: all 0.2s;
}

.btn-add-contact:hover {
    background: rgba(207, 181, 106, 0.1);
    border-color: var(--gold);
}

/* Contact Search Input (Add Mode) */
.contact-search-container {
    display: flex;
    align-items: center;
    width: 100%;
    gap: 8px;
}

.contact-search-input {
    flex: 1;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 10px 16px;
    color: var(--white);
    font-family: inherit;
    font-size: 14px;
    outline: none;
    transition: all 0.2s;
}

.contact-search-input::placeholder {
    color: var(--text-secondary);
}

.contact-search-input:focus {
    border-color: var(--gold);
    background: rgba(207, 181, 106, 0.05);
}

.btn-cancel-search {
    background: transparent;
    border: none;
    color: var(--gold);
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    padding: 8px;
    transition: color 0.2s;
    font-family: inherit;
}

.btn-cancel-search:hover {
    opacity: 0.8;
}

.contacts-scroll {
    flex: 1;
    overflow-y: auto;
    width: 100%;
    padding: 0;
    box-sizing: border-box;
}

.contact-item {
    width: 100%;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    transition: background 0.2s;
    border: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    background: transparent;
    text-align: left;
    font-family: inherit;
    box-sizing: border-box;
    margin: 0;
    color: inherit; /* Fix: Override default button black text */
}

.contact-item:hover, .contact-item.active {
    background: rgba(207, 181, 106, 0.1);
}

.contact-avatar {
    width: 44px;
    height: 44px;
    min-width: 44px;
    background: var(--gold);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #000;
    font-weight: 600;
    font-size: 14px;
}

/* Group avatar - gradient */
.contact-avatar.group-avatar {
    background: linear-gradient(135deg, var(--gold) 0%, #9a7b3c 100%);
    font-size: 16px;
}

/* Archived contact avatar - muted */
.contact-avatar.archived-avatar {
    background: var(--border-color-strong);
    color: var(--text-secondary);
}

/* Archived contact styling */
.contact-item.archived-contact {
    opacity: 0.7;
}

.contact-item.archived-contact .contact-name {
    color: var(--text-secondary);
}

.contact-info {
    flex: 1;
}

.contact-name {
    display: block;
    font-weight: 600;
    color: var(--white);
    font-size: 14px;
}

.contact-status {
    display: block;
    font-size: 12px;
    color: var(--gray);
}

/* Suggestions Style */
.suggestion-item {
    padding: 14px 20px;
}

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

.suggestion-item .contact-name {
    color: var(--gold); /* Highlight potential adds */
}

.suggestion-action {
    color: var(--text-secondary);
    font-size: 14px;
}

/* Group item styling - same as contact item */
.group-item {
    width: 100%;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    transition: background 0.2s;
    border: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    background: transparent;
    text-align: left;
    font-family: inherit;
    box-sizing: border-box;
    margin: 0;
    color: inherit;
}

.group-item:hover, .group-item.active {
    background: rgba(207, 181, 106, 0.1);
}


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

.chat-user-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.btn-back-contacts {
    background: transparent;
    border: none;
    color: var(--white);
    font-size: 16px;
    cursor: pointer;
    padding: 0;
    margin-right: 8px;
    display: none; /* Desktop hidden */
}

@media (max-width: 600px) {
    .btn-back-contacts {
        display: block;
    }
}

.messages-area {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: var(--bg-color);
}

.message-bubble {
    max-width: 75%;
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.4;
    position: relative;
}

.message-bubble.sent {
    align-self: flex-end;
    background: var(--gold);
    color: #000;
    border-top-right-radius: 2px;
}

.message-bubble.received {
    align-self: flex-start;
    background: var(--input-bg);
    color: var(--text-primary);
    border-top-left-radius: 2px;
}

.message-time {
    font-size: 10px;
    opacity: 0.7;
    margin-top: 4px;
    display: block;
    text-align: right;
}

/* Payment Bubble */
.payment-bubble {
    padding: 12px;
    background: linear-gradient(135deg, #2d2d2d, #1a1a1a);
    border: 1px solid var(--gold);
    border-radius: 12px;
    color: #f0f0f0; /* Explicitly light greyish white */
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 200px;
}

.payment-bubble span {
    color: #e0e0e0; /* Ensure inner span is also light */
}

.payment-amount {
    font-size: 20px;
    font-weight: bold;
    color: var(--gold);
}

.payment-details {
    font-size: 12px;
    color: #b0b0b0; /* Lighter grey for better visibility on dark bg */
}

/* Light mode: Sent message bubbles - white text on darker gold */
body[data-theme="light"] .message-bubble.sent {
    color: #FFFFFF;
}

body[data-theme="light"] .message-bubble.sent .message-time {
    color: rgba(255, 255, 255, 0.8);
}

/* Light mode: Payment bubbles */
body[data-theme="light"] .payment-bubble {
    background: linear-gradient(135deg, #ffffff, #f5f5f5);
    border: 1px solid var(--gold);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

body[data-theme="light"] .payment-bubble,
body[data-theme="light"] .payment-bubble span {
    color: #333;
}

body[data-theme="light"] .payment-details {
    color: #666;
}

/* Input Area */
.chat-input-area {
    padding: 12px;
    padding-bottom: calc(12px + var(--nav-height, 70px)); /* Account for nav bar overlap */
    background: var(--bg-color);
    border-top: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.quick-actions {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 4px;
}

.pill-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--white);
    padding: 4px 12px;
    border-radius: 16px;
    font-size: 12px;
    white-space: nowrap;
    cursor: pointer;
    transition: all 0.2s;
}

.pill-btn:hover {
    background: rgba(207, 181, 106, 0.2);
    border-color: var(--gold);
}

.pill-btn.action-send {
    color: var(--gold);
    border-color: rgba(207, 181, 106, 0.3);
}

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

.chat-input {
    flex: 1;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 10px 16px;
    color: var(--white);
    font-family: inherit;
    font-size: 14px;
    outline: none;
}

.chat-input:focus {
    border-color: var(--gold);
}

.btn-send-msg {
    width: 40px;
    height: 40px;
    background: var(--gold);
    border: none;
    border-radius: 50%;
    color: #000;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.1s;
}

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

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--gray);
    text-align: center;
    padding: 20px;
}

.empty-state i {
    font-size: 40px;
    margin-bottom: 16px;
    color: rgba(255, 255, 255, 0.1);
}

/* ============================================
   SKELETON LOADING STATES
   ============================================ */
@keyframes chat-shimmer {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

.message-skeleton {
    background: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0.02) 25%,
        rgba(255, 255, 255, 0.05) 50%,
        rgba(255, 255, 255, 0.02) 75%
    );
    background-size: 200% 100%;
    animation: chat-shimmer 1.5s infinite;
    border-radius: 12px;
    height: 40px;
    margin-bottom: 12px;
}

.message-skeleton.sent {
    align-self: flex-end;
    width: 60%;
}

.message-skeleton.received {
    align-self: flex-start;
    width: 70%;
}

.message-skeleton.short {
    width: 40%;
    height: 32px;
}

/* Empty chat state */
.chat-empty-hint {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: auto;
    min-height: 200px;
    color: var(--text-secondary);
    text-align: center;
    padding: 40px 20px;
}

.chat-empty-hint i {
    font-size: 32px;
    margin-bottom: 12px;
    color: var(--text-secondary);
    opacity: 0.5;
}

.chat-empty-hint p {
    margin: 0;
    font-size: 14px;
}

.chat-empty-hint .empty-title {
    color: var(--white);
    font-weight: 500;
    margin-top: 0;
}

.chat-empty-hint .empty-subtitle {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* ============================================
   ✓✓ READ RECEIPTS
   ============================================ */
.read-receipt {
    margin-left: 4px;
    font-size: 10px;
    color: rgba(0, 0, 0, 0.5);
    display: inline-flex;
    align-items: center;
}

.read-receipt.read {
    color: #4FC3F7; /* Nice blue for read */
}

/* For received messages (darker text) */
.message-bubble.received .read-receipt {
    color: var(--text-secondary);
}

.message-bubble.received .read-receipt.read {
    color: #4FC3F7;
}

/* Payment bubble read receipts */
.payment-bubble .read-receipt {
    color: rgba(255, 255, 255, 0.5);
    margin-left: 6px;
}

.payment-bubble .read-receipt.read {
    color: #4FC3F7;
}

/* ============================================
   🔥 TYPING INDICATOR
   ============================================ */
.typing-indicator {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-left: 8px;
    padding: 4px 8px;
    background: rgba(207, 181, 106, 0.1);
    border-radius: 12px;
    font-size: 11px;
}

.typing-text {
    color: var(--gold);
    font-weight: 500;
}

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

.typing-dots .dot {
    width: 4px;
    height: 4px;
    background: var(--gold);
    border-radius: 50%;
    animation: typing-bounce 1.4s infinite ease-in-out both;
}

.typing-dots .dot:nth-child(1) {
    animation-delay: 0s;
}

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

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

@keyframes typing-bounce {
    0%, 80%, 100% {
        transform: scale(0.6);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* ============================================
   ✨ MESSAGE ANIMATIONS
   ============================================ */
.message-bubble {
    animation: message-appear 0.3s ease-out;
}

.message-bubble.sent {
    animation: message-send 0.3s ease-out;
}

.message-bubble.received {
    animation: message-receive 0.3s ease-out;
}

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

@keyframes message-send {
    from {
        opacity: 0;
        transform: translateY(10px) translateX(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0) translateX(0);
    }
}

@keyframes message-receive {
    from {
        opacity: 0;
        transform: translateY(10px) translateX(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0) translateX(0);
    }
}

/* Light mode adjustments */
body[data-theme="light"] .read-receipt {
    color: rgba(0, 0, 0, 0.4);
}

body[data-theme="light"] .read-receipt.read {
    color: #2196F3;
}

body[data-theme="light"] .typing-indicator {
    background: rgba(184, 151, 63, 0.1);
}

body[data-theme="light"] .typing-text {
    color: var(--gold);
}

body[data-theme="light"] .typing-dots .dot {
    background: var(--gold);
}

/* ============================================
   📷 MEDIA MESSAGES
   ============================================ */
.media-bubble {
    padding: 4px !important;
    background: transparent !important;
    overflow: hidden;
}

.chat-media-img {
    max-width: 250px;
    max-height: 300px;
    border-radius: 12px;
    cursor: pointer;
    display: block;
    transition: transform 0.2s;
}

.chat-media-img:hover {
    transform: scale(1.02);
}

.chat-media-video {
    max-width: 280px;
    max-height: 300px;
    border-radius: 12px;
    display: block;
}

.chat-audio-player {
    background: var(--input-bg);
    padding: 8px 12px;
    border-radius: 20px;
    min-width: 200px;
}

.chat-audio-player audio {
    width: 100%;
    height: 36px;
}

.media-bubble .message-time {
    display: block;
    padding: 4px 8px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 8px;
    margin-top: 4px;
    color: white;
}

/* ============================================
   📤 UPLOAD STATES
   ============================================ */
.btn-media-attach {
    width: 40px;
    height: 40px;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.btn-media-attach:hover {
    border-color: var(--gold);
    color: var(--gold);
    background: rgba(207, 181, 106, 0.1);
}

.upload-progress,
.upload-error {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: var(--input-bg);
    border-radius: 12px;
    color: var(--text-secondary);
    font-size: 13px;
}

.upload-error {
    color: #ff6b6b;
}

.message-bubble.uploading {
    opacity: 0.7;
}

/* ============================================
   🔍 LIGHTBOX
   ============================================ */
.media-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9999;
}

.lightbox-overlay {
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
}

.lightbox-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    transition: background 0.2s;
    z-index: 10;
}

.lightbox-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

.lightbox-img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 8px;
}

/* Light mode media adjustments */
body[data-theme="light"] .btn-media-attach {
    border-color: rgba(0, 0, 0, 0.1);
    color: var(--text-secondary);
}

body[data-theme="light"] .btn-media-attach:hover {
    border-color: var(--gold);
    color: var(--gold);
}

body[data-theme="light"] .chat-audio-player {
    background: rgba(0, 0, 0, 0.05);
}

/* ============================================
   🎤 VOICE RECORDING
   ============================================ */
.btn-voice-record {
    width: 40px;
    height: 40px;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.btn-voice-record:hover {
    border-color: #ff4757;
    color: #ff4757;
    background: rgba(255, 71, 87, 0.1);
}

.btn-voice-record.recording {
    background: #ff4757;
    border-color: #ff4757;
    color: white;
    animation: pulse-recording 1s infinite;
}

@keyframes pulse-recording {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(255, 71, 87, 0.4);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 0 0 10px rgba(255, 71, 87, 0);
    }
}

.voice-recording-indicator {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: rgba(255, 71, 87, 0.1);
    border-radius: 20px;
    color: #ff4757;
    font-size: 13px;
    margin-top: 8px;
}

.recording-pulse {
    width: 10px;
    height: 10px;
    background: #ff4757;
    border-radius: 50%;
    animation: recording-blink 1s infinite;
}

@keyframes recording-blink {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.3;
    }
}

.recording-time {
    margin-left: auto;
    font-family: monospace;
    font-weight: 600;
}

/* Voice note audio player in chat */
.chat-audio-player {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--input-bg);
    padding: 8px 12px;
    border-radius: 20px;
    min-width: 200px;
}

.chat-audio-player audio {
    width: 100%;
    height: 36px;
    border-radius: 18px;
}

/* Style the audio element */
.chat-audio-player audio::-webkit-media-controls-panel {
    background: transparent;
}

body[data-theme="light"] .btn-voice-record {
    border-color: rgba(0, 0, 0, 0.1);
}

body[data-theme="light"] .btn-voice-record:hover {
    border-color: #ff4757;
    color: #ff4757;
}

body[data-theme="light"] .voice-recording-indicator {
    background: rgba(255, 71, 87, 0.1);
}

/* ============================================
   🧾 INVOICE MESSAGES
   ============================================ */
.invoice-bubble {
    padding: 16px;
    background: linear-gradient(135deg, #2d2d2d, #1a1a1a);
    border: 1px solid var(--gold);
    border-radius: 12px;
    color: #f0f0f0;
    min-width: 220px;
    max-width: 280px;
}

.invoice-bubble .btn-view-invoice:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

body[data-theme="light"] .invoice-bubble {
    background: linear-gradient(135deg, #ffffff, #f5f5f5);
    border: 1px solid var(--gold);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    color: #333;
}

/* ============================================
   📄 DOCUMENT (PDF) MESSAGES
   ============================================ */
.document-bubble {
    padding: 12px;
    background: linear-gradient(135deg, #2d2d2d, #1a1a1a);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    color: #f0f0f0;
    min-width: 200px;
    max-width: 280px;
}

.document-bubble:hover {
    border-color: var(--gold);
}

.document-link {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: inherit;
}

body[data-theme="light"] .document-bubble {
    background: linear-gradient(135deg, #ffffff, #f5f5f5);
    border: 1px solid rgba(0, 0, 0, 0.1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    color: #333;
}

/* ============================================
   📄 PDF & INVOICE BUTTONS
   ============================================ */
.btn-pdf-attach,
.btn-invoice {
    width: 36px;
    height: 36px;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.btn-pdf-attach:hover {
    border-color: #ff4444;
    color: #ff4444;
    background: rgba(255, 68, 68, 0.1);
}

.btn-invoice:hover {
    border-color: var(--gold);
    color: var(--gold);
    background: rgba(207, 181, 106, 0.1);
}

body[data-theme="light"] .btn-pdf-attach,
body[data-theme="light"] .btn-invoice {
    border-color: rgba(0, 0, 0, 0.1);
}

body[data-theme="light"] .btn-pdf-attach:hover {
    border-color: #ff4444;
    color: #ff4444;
}

body[data-theme="light"] .btn-invoice:hover {
    border-color: var(--gold);
    color: var(--gold);
}

/* ============================================
   📦 CHAT ARCHIVE & CONTEXT MENU
   ============================================ */
.contact-item-wrapper {
    position: relative;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

/* Archived section */
.archived-section {
    margin-top: 8px;
    border-top: 1px solid rgba(255,255,255,0.05);
    padding-top: 8px;
}

.archived-header {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-family: inherit;
}

.archived-header:hover {
    color: var(--gold);
}

.archived-contacts {
    padding-top: 4px;
}

.contact-item-wrapper.archived .contact-avatar {
    background: rgba(255, 255, 255, 0.1) !important;
    border: 1px dashed rgba(255, 255, 255, 0.2);
}

/* Light mode archive styles */
body[data-theme="light"] .archived-header {
    color: var(--text-secondary);
}

body[data-theme="light"] .archived-header:hover {
    color: var(--gold);
}

body[data-theme="light"] .contact-item-wrapper.archived .contact-avatar {
    background: rgba(0, 0, 0, 0.05) !important;
    border: 1px dashed rgba(0, 0, 0, 0.2);
}

/* ============================================
   🫧 CONTEXT MENU BUBBLE (WhatsApp style)
   ============================================ */
.contact-context-menu {
    position: fixed;
    z-index: 9999;
    animation: context-menu-appear 0.15s ease-out;
}

@keyframes context-menu-appear {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.context-menu-bubble {
    background: var(--card-bg, #1a1a1a);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    overflow: hidden;
    min-width: 160px;
}

.context-menu-item {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    background: transparent;
    border: none;
    color: var(--text-primary, #fff);
    font-size: 14px;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.15s;
    text-align: left;
}

.context-menu-item:hover {
    background: rgba(207, 181, 106, 0.15);
}

.context-menu-item:active {
    background: rgba(207, 181, 106, 0.25);
}

.context-menu-item i {
    width: 18px;
    text-align: center;
    color: var(--gold);
    font-size: 14px;
}

.context-menu-item.danger {
    color: #ff4757;
}

.context-menu-item.danger i {
    color: #ff4757;
}

.context-menu-item.danger:hover {
    background: rgba(255, 71, 87, 0.15);
}

/* Divider between menu items */
.context-menu-item + .context-menu-item {
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

/* Light mode context menu */
body[data-theme="light"] .context-menu-bubble {
    background: #fff;
    border: 1px solid rgba(0, 0, 0, 0.1);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
}

body[data-theme="light"] .context-menu-item {
    color: var(--text-primary);
}

body[data-theme="light"] .context-menu-item:hover {
    background: rgba(139, 115, 40, 0.1);
}

body[data-theme="light"] .context-menu-item + .context-menu-item {
    border-top: 1px solid rgba(0, 0, 0, 0.05);
}
