/* ============================================
   BADROMANCE - Chat / Messaging Styles
   ============================================ */

/* --- Chat Layout (2-panel) --- */
.chat-layout {
    display: flex;
    height: calc(100vh - var(--header-height) - 82px);
    background: var(--card-bg);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}

/* --- Sidebar (Conversations List) --- */
.chat-sidebar {
    width: 320px;
    border-right: 1px solid var(--gray-300);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.chat-sidebar-header {
    padding: 16px 18px;
    border-bottom: 1px solid var(--gray-300);
}

.chat-sidebar-header h3 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--dark);
}

/* --- Online Pulse Animation --- */
.online-pulse {
    animation: onlinePulse 2s ease-in-out infinite;
    box-shadow: 0 0 0 0 rgba(52, 168, 83, 0.4);
}

@keyframes onlinePulse {
    0% { box-shadow: 0 0 0 0 rgba(52, 168, 83, 0.4); }
    70% { box-shadow: 0 0 0 6px rgba(52, 168, 83, 0); }
    100% { box-shadow: 0 0 0 0 rgba(52, 168, 83, 0); }
}

/* --- Message Request Banner --- */
.msg-request-banner {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: var(--primary-light);
    border-bottom: 1px solid var(--gray-300);
    font-size: 0.82rem;
    color: var(--dark);
    flex-shrink: 0;
}

.msg-request-banner i {
    color: var(--primary);
    font-size: 1.1rem;
    flex-shrink: 0;
}

.msg-request-banner p {
    flex: 1;
    margin: 0;
    line-height: 1.3;
}

.msg-request-banner .btn {
    flex-shrink: 0;
}

[data-theme="passion"] .msg-request-banner {
    background: rgba(233,30,99,0.08);
}

[data-theme="passion"] .msg-request-banner i {
    color: #e91e63;
}

/* --- Blocked Banner --- */
.chat-blocked-banner {
    text-align: center;
    padding: 20px;
    color: var(--gray-500);
    font-size: 0.85rem;
}

.chat-blocked-banner i {
    font-size: 1.5rem;
    margin-bottom: 8px;
    display: block;
}

/* --- Profile Peek (hover card) --- */
.profile-peek {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 0;
    background: var(--card-bg);
    border: 1px solid var(--gray-300);
    border-radius: 14px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.2);
    width: 240px;
    z-index: 100;
    display: none;
    overflow: hidden;
}

.profile-peek.show {
    display: block;
}

.profile-peek-cover {
    height: 60px;
    background: linear-gradient(135deg, #1a1a2e, #0f3460);
}

.profile-peek-body {
    padding: 0 14px 14px;
    text-align: center;
    margin-top: -28px;
}

.profile-peek-body img {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--card-bg);
    margin-bottom: 6px;
}

.profile-peek-name {
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 2px;
}

.profile-peek-meta {
    font-size: 0.75rem;
    color: var(--gray-500);
    margin-bottom: 4px;
}

.profile-peek-mood {
    font-size: 0.75rem;
    color: var(--primary);
    font-style: italic;
}

.profile-peek-actions {
    display: flex;
    gap: 6px;
    margin-top: 10px;
}

.profile-peek-actions .btn {
    flex: 1;
    font-size: 0.75rem;
    padding: 5px 8px;
}

[data-theme="passion"] .profile-peek {
    background: #3a3538;
    border-color: rgba(233,30,99,0.12);
}

[data-theme="passion"] .profile-peek-cover {
    background: linear-gradient(135deg, #2e2a2c, #44383e);
}

[data-theme="passion"] .profile-peek-mood {
    color: #f06292;
}

/* --- Report Modal Options --- */
.report-options {
    display: flex;
    flex-direction: column;
    gap: 6px;
    text-align: left;
}

.report-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border: 1px solid var(--gray-300);
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
    font-size: 0.88rem;
}

.report-option:hover {
    background: var(--gray-100);
    border-color: var(--primary);
}

.report-option input[type="radio"] {
    accent-color: var(--primary);
}

[data-theme="passion"] .report-option:hover {
    border-color: #e91e63;
}

/* --- Chat Header Actions Menu --- */
.chat-actions-menu {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    background: var(--card-bg);
    border: 1px solid var(--gray-300);
    border-radius: 10px;
    box-shadow: 0 6px 24px rgba(0,0,0,0.18);
    min-width: 160px;
    padding: 4px;
    z-index: 1050;
    display: none;
}

.chat-actions-menu.open {
    display: block;
}

.chat-actions-menu a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 14px;
    color: var(--dark);
    font-size: 0.85rem;
    border-radius: 7px;
    text-decoration: none;
    transition: background 0.12s;
}

.chat-actions-menu a:hover {
    background: var(--gray-100);
    text-decoration: none;
}

.chat-actions-menu a.danger {
    color: var(--danger);
}

.chat-actions-menu hr {
    border: none;
    border-top: 1px solid var(--gray-100);
    margin: 4px 0;
}

[data-theme="passion"] .chat-actions-menu {
    background: #3a3538;
    border-color: rgba(233,30,99,0.12);
}

[data-theme="passion"] .chat-actions-menu a {
    color: var(--dark);
}

[data-theme="passion"] .chat-actions-menu a:hover {
    background: rgba(255,255,255,0.06);
}

/* --- Encryption Indicator Bar --- */
.chat-encrypted-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 5px 12px;
    background: var(--gray-100);
    color: var(--gray-500);
    font-size: 0.7rem;
    font-weight: 500;
    letter-spacing: 0.3px;
    flex-shrink: 0;
}

.chat-encrypted-bar i {
    font-size: 0.65rem;
    color: var(--success);
}

[data-theme="passion"] .chat-encrypted-bar {
    background: rgba(255,255,255,0.03);
}

/* --- Screenshot Alert (in-chat notification) --- */
.chat-screenshot-alert {
    text-align: center;
    padding: 8px 16px;
    margin: 8px auto;
    background: rgba(255, 152, 0, 0.12);
    color: #e65100;
    font-size: 0.78rem;
    font-weight: 600;
    border-radius: 20px;
    max-width: 80%;
    animation: screenshotFlash 0.5s ease;
}

.chat-screenshot-alert i {
    margin-right: 4px;
}

[data-theme="passion"] .chat-screenshot-alert {
    background: rgba(255, 152, 0, 0.15);
    color: #ffab40;
}

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

/* --- Chat Search Bar --- */
.chat-search-bar {
    padding: 8px 12px;
    border-bottom: 1px solid var(--gray-100);
    flex-shrink: 0;
}

.chat-search-wrapper {
    position: relative;
}

.chat-search-wrapper i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray-500);
    font-size: 0.8rem;
}

.chat-search-wrapper input {
    width: 100%;
    padding: 8px 12px 8px 32px;
    border: 1px solid var(--gray-300);
    border-radius: 20px;
    font-size: 0.82rem;
    font-family: inherit;
    background: var(--gray-100);
    color: var(--dark);
    outline: none;
    transition: border-color 0.2s;
}

.chat-search-wrapper input:focus {
    border-color: var(--primary);
    background: var(--card-bg);
}

[data-theme="passion"] .chat-search-wrapper input {
    background: rgba(255,255,255,0.06);
    border-color: rgba(255,255,255,0.1);
    color: var(--dark);
}

[data-theme="passion"] .chat-search-wrapper input:focus {
    border-color: #e91e63;
}

/* --- Mood Badge --- */
.chat-mood-badge {
    display: inline-block;
    font-size: 0.65rem;
    font-weight: 500;
    color: var(--primary);
    background: var(--primary-light);
    padding: 1px 8px;
    border-radius: 10px;
    margin-left: 6px;
    vertical-align: middle;
}

[data-theme="passion"] .chat-mood-badge {
    color: #f06292;
    background: rgba(233,30,99,0.12);
}

/* --- Secret Message --- */
.msg-secret {
    position: relative;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    min-width: 200px;
    min-height: 48px;
    overflow: hidden;
}

.msg-secret .msg-secret-overlay {
    position: absolute;
    inset: 0;
    background: #1a1a2e;
    border-radius: inherit;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: rgba(255,255,255,0.8);
    font-size: 0.85rem;
    font-weight: 500;
    white-space: nowrap;
    padding: 0 16px;
    backdrop-filter: blur(20px);
    transition: opacity 0.3s;
    z-index: 1;
}

.msg-secret .msg-secret-overlay i {
    font-size: 1.1rem;
    flex-shrink: 0;
}

.msg-secret.revealed .msg-secret-overlay {
    opacity: 0;
    pointer-events: none;
}

[data-theme="passion"] .msg-secret .msg-secret-overlay {
    background: rgba(30,10,20,0.92);
}

/* Secret toggle active */
#chat-secret-toggle.active {
    color: var(--primary) !important;
}

[data-theme="passion"] #chat-secret-toggle.active {
    color: #e91e63 !important;
}

/* --- Chat Wallpaper --- */
.chat-messages[data-wallpaper="gradient1"] { background: linear-gradient(135deg, #667eea22, #764ba222); }
.chat-messages[data-wallpaper="gradient2"] { background: linear-gradient(135deg, #f093fb22, #f5576c22); }
.chat-messages[data-wallpaper="gradient3"] { background: linear-gradient(135deg, #4facfe22, #00f2fe22); }
.chat-messages[data-wallpaper="gradient4"] { background: linear-gradient(135deg, #43e97b22, #38f9d722); }
.chat-messages[data-wallpaper="gradient5"] { background: linear-gradient(135deg, #fa709a22, #fee14022); }
.chat-messages[data-wallpaper="dark1"]     { background: linear-gradient(135deg, #0f0c2922, #302b6322); }
.chat-messages[data-wallpaper="dark2"]     { background: linear-gradient(135deg, #1a1a2e22, #e91e6310); }
.chat-messages[data-wallpaper="dark3"]     { background: linear-gradient(135deg, #16213e22, #0f346022); }

/* Wallpaper picker */
.wallpaper-picker {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    padding: 4px;
}

.wallpaper-option {
    width: 100%;
    aspect-ratio: 1.4;
    border-radius: 8px;
    border: 2px solid transparent;
    cursor: pointer;
    transition: border-color 0.15s, transform 0.1s;
}

.wallpaper-option:hover {
    transform: scale(1.05);
}

.wallpaper-option.active {
    border-color: var(--primary);
}

[data-theme="passion"] .wallpaper-option.active {
    border-color: #e91e63;
}

.wallpaper-option[data-wp="gradient1"] { background: linear-gradient(135deg, #667eea, #764ba2); }
.wallpaper-option[data-wp="gradient2"] { background: linear-gradient(135deg, #f093fb, #f5576c); }
.wallpaper-option[data-wp="gradient3"] { background: linear-gradient(135deg, #4facfe, #00f2fe); }
.wallpaper-option[data-wp="gradient4"] { background: linear-gradient(135deg, #43e97b, #38f9d7); }
.wallpaper-option[data-wp="gradient5"] { background: linear-gradient(135deg, #fa709a, #fee140); }
.wallpaper-option[data-wp="dark1"]     { background: linear-gradient(135deg, #0f0c29, #302b63); }
.wallpaper-option[data-wp="dark2"]     { background: linear-gradient(135deg, #1a1a2e, #e91e63); }
.wallpaper-option[data-wp="dark3"]     { background: linear-gradient(135deg, #16213e, #0f3460); }
.wallpaper-option[data-wp="none"]      { background: var(--gray-100); display:flex;align-items:center;justify-content:center;font-size:0.7rem;color:var(--gray-500); }

/* --- New Messages Scroll Button --- */
.chat-new-msg-btn {
    position: absolute;
    bottom: 70px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 20px;
    padding: 6px 16px;
    font-size: 0.8rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    z-index: 5;
    display: none;
    animation: slideUp 0.2s ease;
}

.chat-new-msg-btn.show {
    display: block;
}

.chat-new-msg-btn i {
    margin-right: 4px;
}

[data-theme="passion"] .chat-new-msg-btn {
    background: #e91e63;
}

@keyframes slideUp {
    from { transform: translateX(-50%) translateY(10px); opacity: 0; }
    to { transform: translateX(-50%) translateY(0); opacity: 1; }
}

/* --- Link Preview --- */
.msg-link-preview {
    display: block;
    margin-top: 8px;
    border: 1px solid rgba(0,0,0,0.1);
    border-radius: 10px;
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    transition: opacity 0.15s;
}

.msg-link-preview:hover {
    opacity: 0.9;
    text-decoration: none;
}

.msg-link-preview img {
    width: 100%;
    height: 100px;
    object-fit: cover;
}

.msg-link-preview-body {
    padding: 8px 10px;
}

.msg-link-preview-title {
    font-size: 0.8rem;
    font-weight: 600;
    margin-bottom: 2px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.msg-link-preview-domain {
    font-size: 0.7rem;
    color: var(--gray-500);
}

.msg.sent .msg-link-preview {
    border-color: rgba(255,255,255,0.15);
}

/* Links inside message bubbles */
.msg.sent .msg-bubble a {
    color: #fff;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.msg.sent .msg-bubble a:hover {
    opacity: 0.85;
}

.msg.received .msg-bubble a {
    color: var(--primary);
    text-decoration: underline;
    text-underline-offset: 2px;
}

[data-theme="passion"] .msg.received .msg-bubble a {
    color: #e91e63;
}

/* --- Text Formatting --- */
.msg-bubble strong { font-weight: 700; }
.msg-bubble em { font-style: italic; }
.msg-bubble del { text-decoration: line-through; opacity: 0.6; }

/* --- Read Avatar (seen indicator) --- */
.msg-read-avatar {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    object-fit: cover;
    margin-left: 4px;
    vertical-align: middle;
    opacity: 0.8;
}

/* --- Chat Tabs (Direct / Groups) --- */
.chat-tabs {
    display: flex;
    border-bottom: 1px solid var(--gray-300);
    flex-shrink: 0;
}

.chat-tab {
    flex: 1;
    border: none;
    background: none;
    padding: 12px 8px;
    font-size: 0.85rem;
    font-weight: 600;
    font-family: inherit;
    color: var(--gray-500);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: color 0.15s, border-color 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.chat-tab:hover {
    color: var(--dark);
}

.chat-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

[data-theme="passion"] .chat-tab.active {
    color: #e91e63;
    border-bottom-color: #e91e63;
}

.chat-tab-content {
    display: none;
    flex: 1;
    overflow-y: auto;
    flex-direction: column;
}

.chat-tab-content.active {
    display: flex;
}

.chat-group-actions {
    padding: 10px 12px;
    border-bottom: 1px solid var(--gray-100);
}

/* Group avatar placeholder */
.chat-group-avatar {
    width: 48px;
    height: 48px;
    background: var(--primary-light);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    font-size: 1.1rem;
}

[data-theme="passion"] .chat-group-avatar {
    background: rgba(233,30,99,0.12);
    color: #e91e63;
}

/* --- Group Info Panel --- */
.group-info-panel {
    border-bottom: 1px solid var(--gray-300);
    padding: 16px;
    background: var(--gray-100);
    max-height: 300px;
    overflow-y: auto;
}

.group-info-header {
    margin-bottom: 12px;
}

.group-info-header h4 {
    font-size: 1rem;
    margin-bottom: 2px;
}

.group-info-header p {
    font-size: 0.8rem;
    color: var(--gray-500);
}

/* Group edit (admin) */
.group-edit-avatar {
    display: flex;
    justify-content: center;
    margin-bottom: 10px;
    cursor: pointer;
}

.group-edit-avatar-preview {
    position: relative;
    width: 72px;
    height: 72px;
}

.group-edit-avatar-preview img {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    object-fit: cover;
}

.group-edit-avatar-placeholder {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: var(--gray-200);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: var(--gray-500);
}

.group-edit-avatar-overlay {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    border: 2px solid var(--card-bg);
}

[data-theme="passion"] .group-edit-avatar-overlay {
    background: #e91e63;
}


.group-edit-modal-form .group-edit-avatar {
    margin-bottom: 14px;
}

.group-edit-modal-form .form-group {
    margin-bottom: 10px;
}

.group-edit-modal-form label {
    font-size: 0.82rem;
    font-weight: 600;
    margin-bottom: 4px;
    display: block;
}

.group-member-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 0;
}

.group-member-item img {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    object-fit: cover;
}

.group-member-info {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 6px;
}

.group-member-name {
    font-size: 0.85rem;
    font-weight: 500;
}

.group-role-badge {
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--primary);
    background: var(--primary-light);
    padding: 1px 6px;
    border-radius: 4px;
    text-transform: uppercase;
}

[data-theme="passion"] .group-role-badge {
    color: #e91e63;
    background: rgba(233,30,99,0.12);
}

.group-member-actions {
    flex-shrink: 0;
}

.group-member-actions .btn-xs {
    font-size: 0.7rem;
    padding: 2px 8px;
    border-radius: 4px;
}

.group-info-actions {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--gray-300);
}

[data-theme="passion"] .group-info-panel {
    background: rgba(255,255,255,0.04);
}

/* --- Create Group Modal content --- */
.create-group-form .selected-members {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 10px 0;
    min-height: 30px;
}

.selected-member-chip {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px 4px 4px;
    background: var(--gray-100);
    border-radius: 16px;
    font-size: 0.8rem;
}

.selected-member-chip img {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    object-fit: cover;
}

.selected-member-chip .remove-member {
    cursor: pointer;
    color: var(--gray-500);
    margin-left: 2px;
    font-size: 0.7rem;
}

.selected-member-chip .remove-member:hover {
    color: var(--danger);
}

/* Group photo picker */
.group-photo-picker {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    padding: 8px;
    border: 2px dashed var(--gray-300);
    border-radius: 12px;
    transition: border-color 0.2s;
}

.group-photo-picker:hover {
    border-color: var(--primary);
}

[data-theme="passion"] .group-photo-picker:hover {
    border-color: #e91e63;
}

.group-photo-preview {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--gray-100);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--gray-500);
    font-size: 1.3rem;
    flex-shrink: 0;
    overflow: hidden;
}

.group-photo-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.group-photo-label {
    font-size: 0.85rem;
    color: var(--gray-500);
}

[data-theme="passion"] .group-photo-preview {
    background: rgba(255,255,255,0.06);
}

/* Group description in info panel */
.group-desc {
    font-size: 0.85rem;
    color: var(--gray-700);
    margin: 4px 0 8px;
    line-height: 1.4;
}

.group-meta {
    font-size: 0.8rem;
    color: var(--gray-500);
}

.member-search-results {
    max-height: 150px;
    overflow-y: auto;
    margin-top: 8px;
}

.member-search-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.12s;
    font-size: 0.85rem;
}

.member-search-item:hover {
    background: var(--gray-100);
}

.member-search-item img {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    object-fit: cover;
}

.member-search-item.added {
    opacity: 0.4;
    pointer-events: none;
}

.chat-conversation-list {
    flex: 1;
    overflow-y: auto;
    scrollbar-width: thin;
}

.chat-conv-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    text-decoration: none;
    color: var(--dark);
    transition: background 0.15s;
    border-bottom: 1px solid var(--gray-100);
}

.chat-conv-item:hover {
    background: var(--gray-100);
    text-decoration: none;
}

.chat-conv-item.active {
    background: var(--primary-light);
}

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

.chat-conv-avatar img {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
}

.chat-conv-avatar .online-dot {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 10px;
    height: 10px;
    border: 2px solid var(--card-bg);
}

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

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

.chat-conv-preview {
    font-size: 0.8rem;
    color: var(--gray-500);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 2px;
}

.chat-conv-meta {
    text-align: right;
    flex-shrink: 0;
}

.chat-conv-time {
    font-size: 0.7rem;
    color: var(--gray-500);
    margin-bottom: 4px;
}

.chat-conv-badge {
    display: inline-block;
    background: var(--primary);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 10px;
    min-width: 20px;
    text-align: center;
}

[data-theme="passion"] .chat-conv-badge {
    background: #e91e63;
}

.chat-empty {
    text-align: center;
    padding: 40px 20px;
    color: var(--gray-500);
}

.chat-empty i {
    font-size: 2.5rem;
    margin-bottom: 12px;
    display: block;
    opacity: 0.4;
}

/* --- Chat Window --- */
.chat-window {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.chat-window-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    border-bottom: 1px solid var(--gray-300);
    flex-shrink: 0;
}

.chat-back-btn {
    display: none;
    width: 36px;
    height: 36px;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    color: var(--gray-700);
    transition: background 0.15s;
}

.chat-back-btn:hover {
    background: var(--gray-100);
    text-decoration: none;
}

.chat-user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    text-decoration: none;
    color: var(--dark);
}

.chat-user-info:hover {
    text-decoration: none;
}

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

.chat-user-name {
    font-weight: 600;
    font-size: 0.95rem;
}

.chat-user-status {
    font-size: 0.75rem;
}

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

.status-offline {
    color: var(--gray-500);
}

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

.chat-action-btn {
    width: 36px;
    height: 36px;
    border: none;
    background: none;
    border-radius: 50%;
    color: var(--gray-700);
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, color 0.15s;
}

.chat-action-btn:hover {
    background: var(--gray-100);
    color: var(--primary);
}

[data-theme="passion"] .chat-action-btn:hover {
    color: #e91e63;
}

/* --- Messages Area --- */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    scrollbar-width: thin;
}

.chat-loading {
    text-align: center;
    padding: 20px;
    color: var(--gray-500);
}

/* Message bubbles */
.msg {
    display: flex;
    flex-direction: column;
    max-width: 70%;
    position: relative;
}

.msg.sent {
    align-self: flex-end;
    align-items: flex-end;
}

.msg.received {
    align-self: flex-start;
    align-items: flex-start;
}

.msg-bubble {
    padding: 10px 14px;
    border-radius: 18px;
    font-size: 0.9rem;
    line-height: 1.45;
    word-break: break-word;
    position: relative;
}

.msg.sent .msg-bubble {
    background: var(--primary);
    color: #fff;
    border-bottom-right-radius: 4px;
}

.msg.received .msg-bubble {
    background: var(--gray-100);
    color: var(--dark);
    border-bottom-left-radius: 4px;
}

[data-theme="passion"] .msg.sent .msg-bubble {
    background: #e91e63;
}

[data-theme="passion"] .msg.received .msg-bubble {
    background: rgba(255,255,255,0.08);
    color: var(--dark);
}

/* Reply reference inside bubble */
.msg-reply-ref {
    background: rgba(0,0,0,0.1);
    border-left: 3px solid rgba(255,255,255,0.4);
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.78rem;
    margin-bottom: 6px;
    opacity: 0.8;
    max-height: 40px;
    overflow: hidden;
}

.msg.received .msg-reply-ref {
    background: rgba(0,0,0,0.05);
    border-left-color: var(--primary);
}

/* Message meta (time, seen) */
.msg-meta {
    font-size: 0.65rem;
    color: var(--gray-500);
    margin-top: 2px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.msg-meta .seen-icon {
    color: var(--primary);
    font-size: 0.6rem;
}

[data-theme="passion"] .msg-meta .seen-icon {
    color: #f06292;
}

/* System message (group join/leave) */
.msg-system {
    text-align: center;
    padding: 6px 0;
    align-self: center;
    max-width: 100%;
}

.msg-system span {
    display: inline-block;
    background: var(--gray-100);
    color: var(--gray-500);
    font-size: 0.75rem;
    padding: 4px 14px;
    border-radius: 12px;
    font-style: italic;
}

[data-theme="passion"] .msg-system span {
    background: rgba(255,255,255,0.05);
}

/* Sender name in group chat */
.msg-sender-name {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 2px;
    padding-left: 4px;
}

[data-theme="passion"] .msg-sender-name {
    color: #f06292;
}

/* Load older messages button */
.chat-load-older {
    text-align: center;
    padding: 12px 0;
}

.chat-load-older .btn {
    font-size: 0.78rem;
    border-radius: 16px;
}

/* Emoji-only message (no bubble, just big emoji) */
.msg-emoji-only {
    background: transparent !important;
    padding: 4px 2px !important;
    font-size: 2.8rem;
    line-height: 1.2;
}

/* Flirt message (bigger, no background fill, 4px border) */
.msg-flirt {
    padding: 14px;
    background: transparent !important;
}

.msg.sent .msg-flirt {
    border: 4px solid var(--primary);
    border-radius: 18px;
    border-bottom-right-radius: 4px;
}

.msg.received .msg-flirt {
    border: 4px solid var(--gray-300);
    border-radius: 18px;
    border-bottom-left-radius: 4px;
}

[data-theme="passion"] .msg.sent .msg-flirt {
    border-color: #e91e63;
}

[data-theme="passion"] .msg.received .msg-flirt {
    border-color: var(--gray-300);
}

.msg-flirt .flirt-svg {
    width: 80px;
    height: 80px;
    display: block;
}

.msg-flirt .flirt-svg svg {
    width: 100%;
    height: 100%;
}

/* Image message */
.msg-image img {
    max-width: 250px;
    max-height: 300px;
    border-radius: 12px;
    cursor: pointer;
    transition: transform 0.15s;
}

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

/* Location message - map card with erotic pin */
.msg-location-card {
    padding: 0 !important;
    overflow: hidden;
    border-radius: 14px !important;
    width: 240px;
}

.location-map-link {
    display: block;
    text-decoration: none;
    color: inherit;
}

.location-map-link:hover {
    text-decoration: none;
}

.location-map-preview {
    width: 240px;
    height: 140px;
    background-size: cover;
    background-position: center;
    background-color: var(--gray-100);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.location-map-preview::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.08);
    transition: background 0.2s;
}

.location-map-link:hover .location-map-preview::after {
    background: rgba(0,0,0,0.02);
}

.location-pin {
    width: 36px;
    height: 50px;
    position: relative;
    z-index: 1;
    filter: drop-shadow(0 4px 8px rgba(0,0,0,0.35));
    animation: pinBounce 2s ease-in-out infinite;
}

.location-pin svg {
    width: 100%;
    height: 100%;
}

@keyframes pinBounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
}

.location-label {
    padding: 8px 14px;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--gray-700);
    background: var(--card-bg);
    border-top: 1px solid var(--gray-100);
}

.location-label i {
    color: #e53935;
    margin-right: 4px;
}

.msg.sent .location-label {
    background: var(--primary-dark);
    border-top-color: rgba(255,255,255,0.1);
    color: rgba(255,255,255,0.85);
}

.msg.sent .location-label i {
    color: rgba(255,255,255,0.7);
}

[data-theme="passion"] .msg.sent .location-label {
    background: #c2185b;
}

[data-theme="passion"] .location-label {
    background: var(--card-bg);
    border-top-color: var(--gray-300);
}

@media (max-width: 480px) {
    .msg-location-card,
    .location-map-preview {
        width: 200px;
    }

    .location-map-preview {
        height: 120px;
    }
}

/* Disappeared message */
.msg-disappeared {
    font-style: italic;
    opacity: 0.5;
    font-size: 0.82rem;
}

/* Message reactions */
.msg-reactions {
    display: flex;
    gap: 2px;
    margin-top: 2px;
}

.msg-reaction {
    width: 24px;
    height: 24px;
    background: var(--card-bg);
    border: 1px solid var(--gray-300);
    border-radius: 12px;
    padding: 3px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.msg-reaction svg {
    width: 100%;
    height: 100%;
}

/* --- Unsend button --- */
.msg-unsend-btn {
    border: none;
    background: none;
    color: var(--gray-500);
    font-size: 0.6rem;
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 4px;
    opacity: 0;
    transition: opacity 0.15s, color 0.15s;
    margin-left: 2px;
}

.msg:hover .msg-unsend-btn {
    opacity: 1;
}

.msg-unsend-btn:hover {
    color: var(--danger);
}

/* On mobile always show (no hover) */
@media (pointer: coarse) {
    .msg-unsend-btn {
        opacity: 0.5;
    }
}

/* --- Typing indicator --- */
.chat-typing-indicator {
    padding: 4px 16px 8px;
    font-size: 0.8rem;
    color: var(--gray-500);
    display: flex;
    align-items: center;
    gap: 6px;
}

.typing-dots span {
    display: inline-block;
    width: 6px;
    height: 6px;
    background: var(--gray-500);
    border-radius: 50%;
    animation: typingBounce 1.4s infinite ease-in-out;
}

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

@keyframes typingBounce {
    0%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-6px); }
}

/* --- Reply bar --- */
.chat-reply-bar {
    display: flex;
    align-items: center;
    padding: 8px 16px;
    background: var(--gray-100);
    border-top: 1px solid var(--gray-300);
    gap: 10px;
}

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

.reply-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--primary);
    display: block;
}

[data-theme="passion"] .reply-label {
    color: #e91e63;
}

.reply-text {
    font-size: 0.8rem;
    color: var(--gray-700);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
}

.reply-close {
    border: none;
    background: none;
    color: var(--gray-500);
    cursor: pointer;
    font-size: 1rem;
    padding: 4px;
}

/* --- Input area --- */
.chat-input-area {
    border-top: 1px solid var(--gray-300);
    padding: 10px 12px;
    flex-shrink: 0;
}

.chat-input-actions {
    display: flex;
    gap: 2px;
    margin-bottom: 8px;
}

.chat-input-wrapper {
    display: flex;
    align-items: flex-end;
    gap: 8px;
}

#chat-input {
    flex: 1;
    border: 1px solid var(--gray-300);
    border-radius: 20px;
    padding: 10px 16px;
    font-size: 0.9rem;
    font-family: inherit;
    resize: none;
    max-height: 120px;
    min-height: 40px;
    outline: none;
    background: var(--white);
    color: var(--dark);
    transition: border-color 0.2s;
}

#chat-input:focus {
    border-color: var(--primary);
}

[data-theme="passion"] #chat-input {
    background-color: rgba(255,255,255,0.08);
    border-color: rgba(255,255,255,0.12);
    color: var(--dark);
}

[data-theme="passion"] #chat-input:focus {
    border-color: #e91e63;
}

.chat-send-btn {
    width: 40px;
    height: 40px;
    border: none;
    background: var(--primary);
    color: #fff;
    border-radius: 50%;
    font-size: 1rem;
    cursor: pointer;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, transform 0.1s;
}

.chat-send-btn:hover {
    background: var(--primary-dark);
}

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

[data-theme="passion"] .chat-send-btn {
    background: #e91e63;
}

[data-theme="passion"] .chat-send-btn:hover {
    background: #c2185b;
}

/* --- Emoji Picker (classic) --- */
.emoji-picker {
    border-top: 1px solid var(--gray-300);
    background: var(--card-bg);
}

.emoji-tabs {
    display: flex;
    border-bottom: 1px solid var(--gray-100);
    padding: 4px 8px 0;
}

.emoji-tab {
    flex: 1;
    border: none;
    background: none;
    font-size: 1.2rem;
    padding: 8px 4px;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: border-color 0.15s;
    opacity: 0.5;
}

.emoji-tab:hover {
    opacity: 0.8;
}

.emoji-tab.active {
    opacity: 1;
    border-bottom-color: var(--primary);
}

[data-theme="passion"] .emoji-tab.active {
    border-bottom-color: #e91e63;
}

.emoji-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 2px;
    padding: 8px;
    max-height: 200px;
    overflow-y: auto;
    scrollbar-width: thin;
}

.emoji-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: none;
    font-size: 1.4rem;
    padding: 6px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.1s, transform 0.1s;
    line-height: 1;
}

.emoji-btn:hover {
    background: var(--gray-100);
    transform: scale(1.2);
}

[data-theme="passion"] .emoji-btn:hover {
    background: rgba(255,255,255,0.06);
}

@media (max-width: 480px) {
    .emoji-grid {
        grid-template-columns: repeat(7, 1fr);
        max-height: 160px;
    }

    .emoji-btn {
        font-size: 1.25rem;
        padding: 5px;
    }
}

/* --- Flirt Picker --- */
.flirt-picker {
    border-top: 1px solid var(--gray-300);
    padding: 12px;
    background: var(--card-bg);
}

.flirt-picker-header {
    padding: 8px 14px 4px;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.flirt-picker-header i {
    margin-right: 4px;
}

[data-theme="passion"] .flirt-picker-header {
    color: #e91e63;
}

.flirt-picker-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}

.flirt-icon-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 10px 4px;
    border: none;
    background: none;
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.15s, transform 0.1s;
}

.flirt-icon-btn:hover {
    background: var(--gray-100);
    transform: scale(1.08);
}

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

.flirt-icon-btn .flirt-svg {
    width: 48px;
    height: 48px;
    display: block;
}

.flirt-icon-btn .flirt-svg svg {
    width: 100%;
    height: 100%;
}

.flirt-icon-btn .flirt-label {
    font-size: 0.65rem;
    color: var(--gray-500);
    font-family: inherit;
}

[data-theme="passion"] .flirt-icon-btn:hover {
    background: rgba(255,255,255,0.06);
}

/* --- Reaction Picker (floating) --- */
.reaction-picker {
    position: fixed;
    background: var(--card-bg);
    border: 1px solid var(--gray-300);
    border-radius: 24px;
    padding: 6px 8px;
    display: flex;
    gap: 2px;
    box-shadow: 0 6px 24px rgba(0,0,0,0.2);
    z-index: 1050;
}

.reaction-btn {
    width: 36px;
    height: 36px;
    border: none;
    background: none;
    border-radius: 50%;
    padding: 5px;
    cursor: pointer;
    transition: transform 0.12s, background 0.12s;
}

.reaction-btn:hover {
    transform: scale(1.3);
    background: var(--gray-100);
}

.reaction-btn svg {
    width: 100%;
    height: 100%;
}

[data-theme="passion"] .reaction-picker {
    background: #3a3538;
    border-color: rgba(233,30,99,0.15);
}

[data-theme="passion"] .reaction-btn:hover {
    background: rgba(255,255,255,0.08);
}

/* --- Disappearing messages dropdown --- */
.disappear-dropdown {
    position: relative;
}

.disappear-menu {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    background: var(--card-bg);
    border: 1px solid var(--gray-300);
    border-radius: 10px;
    padding: 4px;
    min-width: 160px;
    box-shadow: 0 6px 24px rgba(0,0,0,0.18);
    z-index: 1050;
}

.disappear-menu.open {
    display: block;
}

.disappear-title {
    padding: 8px 12px 4px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.disappear-option {
    display: block;
    padding: 8px 12px;
    font-size: 0.85rem;
    color: var(--dark);
    text-decoration: none;
    border-radius: 6px;
    transition: background 0.12s;
}

.disappear-option:hover {
    background: var(--gray-100);
    text-decoration: none;
}

.disappear-option.active {
    color: var(--primary);
    font-weight: 600;
}

[data-theme="passion"] .disappear-menu {
    background: #3a3538;
    border-color: rgba(233,30,99,0.12);
}

[data-theme="passion"] .disappear-option.active {
    color: #f06292;
}

/* --- Image Lightbox (standalone overlay) --- */
.chat-lightbox-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.85);
    z-index: 10000;
    align-items: center;
    justify-content: center;
    cursor: zoom-out;
}

.chat-lightbox-overlay.active {
    display: flex;
}

.chat-lightbox-content {
    position: relative;
    max-width: 92vw;
    max-height: 92vh;
}

.chat-lightbox-img {
    max-width: 90vw;
    max-height: 88vh;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 8px 40px rgba(0,0,0,0.5);
    cursor: default;
}

.chat-lightbox-close {
    position: absolute;
    top: -16px;
    right: -16px;
    width: 40px;
    height: 40px;
    border: none;
    background: rgba(255,255,255,0.15);
    color: #fff;
    border-radius: 50%;
    font-size: 1.1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    backdrop-filter: blur(4px);
}

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

/* Navigation arrows */
.lb-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 48px;
    height: 48px;
    border: none;
    background: rgba(255,255,255,0.12);
    color: #fff;
    border-radius: 50%;
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, transform 0.15s;
    backdrop-filter: blur(4px);
    z-index: 2;
}

.lb-nav:hover {
    background: rgba(255,255,255,0.25);
    transform: translateY(-50%) scale(1.08);
}

.lb-nav:active {
    transform: translateY(-50%) scale(0.95);
}

.lb-prev {
    left: 16px;
}

.lb-next {
    right: 16px;
}

/* Counter */
.lb-counter {
    text-align: center;
    color: rgba(255,255,255,0.6);
    font-size: 0.8rem;
    margin-top: 10px;
    font-weight: 500;
    letter-spacing: 1px;
}

@media (max-width: 768px) {
    .chat-lightbox-close {
        top: 8px;
        right: 8px;
    }

    .lb-nav {
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }

    .lb-prev {
        left: 8px;
    }

    .lb-next {
        right: 8px;
    }
}

/* Active disappear indicator */
.active-disappear {
    color: var(--primary) !important;
    position: relative;
}

.active-disappear::after {
    content: '';
    position: absolute;
    bottom: 4px;
    right: 4px;
    width: 6px;
    height: 6px;
    background: var(--primary);
    border-radius: 50%;
}

[data-theme="passion"] .active-disappear {
    color: #e91e63 !important;
}

[data-theme="passion"] .active-disappear::after {
    background: #e91e63;
}

/* New message sound indicator */
.chat-conv-item.has-new {
    animation: newMsgPulse 0.5s ease;
}

@keyframes newMsgPulse {
    0%, 100% { background: transparent; }
    50% { background: var(--primary-light); }
}

/* --- Empty chat window --- */
.chat-empty-window {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--gray-500);
    text-align: center;
    padding: 40px;
}

.chat-empty-icon {
    width: 80px;
    height: 80px;
    opacity: 0.3;
    margin-bottom: 16px;
}

.chat-empty-icon svg {
    width: 100%;
    height: 100%;
}

.chat-empty-window h3 {
    font-size: 1.2rem;
    margin-bottom: 8px;
    color: var(--dark);
    opacity: 0.6;
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .chat-layout {
        height: calc(100vh - var(--header-height) - 80px);
        border-radius: 0;
    }

    .chat-sidebar {
        width: 100%;
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: var(--card-bg);
        z-index: 2;
    }

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

    .chat-window-hidden-mobile {
        display: none;
    }

    .chat-back-btn {
        display: flex;
    }

    .chat-layout {
        position: relative;
    }

    .flirt-picker-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 4px;
    }

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

    .msg {
        max-width: 85%;
    }
}

@media (max-width: 480px) {
    .flirt-picker-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}
