﻿@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --primary: #FF6B9D;
    --secondary: #C66EFD;
    --dark: #0F0F14;
    --darker: #08080B;
    --light: #FFFFFF;
    --gray: #6B6B7C;
    --danger: #EF4444;
    --success: #22C55E;
    --gradient: linear-gradient(135deg, var(--primary), var(--secondary));
    
    /* Light mode variables (will be overridden by .light-mode) */
    --bg-color: var(--darker);
    --surface-color: var(--dark);
    --text-color: var(--light);
    --text-muted: var(--gray);
    --border-color: rgba(255,255,255,0.05);
    --card-bg: rgba(255,255,255,0.03);
    --card-hover: rgba(255,255,255,0.06);
    --input-bg: rgba(255,255,255,0.05);
    --bubble-ai-bg: rgba(255,255,255,0.05);
    --bubble-ai-text: var(--light);
    --shadow-color: rgba(0,0,0,0.3);
}

/* Light Mode Theme */
.light-mode {
    --bg-color: #F8FAFC;
    --surface-color: #FFFFFF;
    --text-color: #1E293B;
    --text-muted: #64748B;
    --border-color: #E2E8F0;
    --card-bg: rgba(0,0,0,0.02);
    --card-hover: rgba(0,0,0,0.04);
    --input-bg: #FFFFFF;
    --bubble-ai-bg: #F1F5F9;
    --bubble-ai-text: #1E293B;
    --shadow-color: rgba(0,0,0,0.1);
}

body {
    font-family: 'Inter', sans-serif;
    background: var(--bg-color);
    color: var(--text-color);
    height: 100vh;
    overflow: hidden;
}

.app-container { display: flex; height: 100vh; }

/* Sidebar */
.sidebar {
    width: var(--sidebar-width, 320px);
    background: var(--surface-color);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    transition: width 0.3s ease, min-width 0.3s ease;
    position: relative;
}

.sidebar-header {
    padding: 24px 24px 8px 24px;
}

.logo {
    font-size: 24px;
    font-weight: 700;
    background: var(--gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 4px;
}

.credits-display {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    margin-top: 20px;
    background: var(--card-bg);
    border-radius: 12px;
    width: fit-content;
}

.credits-icon {
    width: 40px;
    height: 40px;
    background: var(--gradient);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.credits-info { flex: 1; }
.credits-label {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 4px;
}
.credits-value {
    font-size: 18px;
    font-weight: 600;
}

.upgrade-btn {
    background: var(--gradient);
    border: none;
    color: white;
    padding: 8px 16px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s;
    text-decoration: none;
    white-space: nowrap;
}
.upgrade-btn:hover { opacity: 0.9; text-decoration: none; }
.upgrade-btn:disabled {
    opacity: 0.7;
    cursor: wait;
    transform: none;
}

/* Light mode: Credits display */
.light-mode .credits-display {
    background: rgba(0,0,0,0.04);
    border: 1px solid var(--border-color);
}

.light-mode .credits-icon {
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.characters-section {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0 12px 20px 12px;
}

.section-title {
    font-size: 14px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 16px;
    padding-top: 20px;
}

.character-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--card-bg);
    border-radius: 12px;
    margin-bottom: 12px;
    margin-right: 4px;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid var(--border-color);
}

.character-card:hover {
    background: var(--card-hover);
    transform: translateX(4px);
}

.character-card.active {
    border-width: 2px;
    background: rgba(255,107,157,0.1);
    border-color: var(--primary);
}

/* Light mode: active character card */
.light-mode .character-card.active {
    border-width: 2px;
    background: rgba(255,107,157,0.12);
    border-color: #FF6B9D;
    box-shadow: inset 0 0 20px rgba(255,107,157,0.15);
}

.character-avatar {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    position: relative;
}

.character-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 12px;
}

.character-status {
    position: absolute;
    bottom: -2px;
    right: -2px;
    width: 14px;
    height: 14px;
    background: #00D26A;
    border: 3px solid var(--dark);
    border-radius: 50%;
}

/* Base badge style (shared by all badge types) */
.character-badge {
    position: absolute;
    bottom: -4px;
    right: -4px;
    width: 20px;
    height: 20px;
    border: 2px solid var(--dark);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

.character-badge svg {
    width: 12px;
    height: 12px;
    color: #ffffff;
}

/* Premium badge - black background with crown */
.character-badge--premium {
    background: #1a1a1a;
}

/* NSFW badge - transparent, the 18+ icon is already a red circle */
.character-badge--nsfw {
    background: transparent;
    border: none;
    box-shadow: none;
    width: 22px;
    height: 22px;
}

.character-badge--nsfw svg {
    width: 22px;
    height: 22px;
}

/* Premium + NSFW badge - red background with crown */
.character-badge--premium-nsfw {
    background: #dc2626;
}

/* Draft badge - orange background with pencil */
.character-badge--draft {
    background: #f59e0b;
    animation: pulse-draft 2s infinite;
}

@keyframes pulse-draft {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

/* Light mode adjustments */
.light-mode .character-status {
    border-color: #ffffff;
}

.light-mode .character-badge {
    border-color: #ffffff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* NSFW badge stays transparent in light mode too */
.light-mode .character-badge--nsfw {
    border: none;
    box-shadow: none;
}

/* ========================================
   NSFW Avatar Blur System
   ======================================== */

/* Soft blur for NSFW avatars (unverified users only) */
.character-avatar--blur img {
    filter: blur(3px);
}

/* Sidebar compact mode: inactive characters are grayscale */
/* Dark mode: grayscale + darkened */
.sidebar-semi .character-card:not(.active) .character-avatar img {
    filter: grayscale(100%) brightness(0.6);
    transition: filter 0.3s ease;
}

/* Light mode: grayscale only */
.light-mode .sidebar-semi .character-card:not(.active) .character-avatar img {
    filter: grayscale(100%);
}

/* Sidebar compact + blur combination (dark mode) */
.sidebar-semi .character-card:not(.active) .character-avatar--blur img {
    filter: grayscale(100%) brightness(0.6) blur(3px);
}

/* Sidebar compact + blur combination (light mode) */
.light-mode .sidebar-semi .character-card:not(.active) .character-avatar--blur img {
    filter: grayscale(100%) blur(3px);
}

/* Active character with blur (keep blur but remove grayscale) */
.sidebar-semi .character-card.active .character-avatar--blur img {
    filter: blur(3px);
}

/* Fully collapsed sidebar - same rules apply */
.sidebar-collapsed .character-card:not(.active) .character-avatar img {
    filter: grayscale(100%) brightness(0.6);
}

.light-mode .sidebar-collapsed .character-card:not(.active) .character-avatar img {
    filter: grayscale(100%);
}

.sidebar-collapsed .character-card:not(.active) .character-avatar--blur img {
    filter: grayscale(100%) brightness(0.6) blur(3px);
}

.light-mode .sidebar-collapsed .character-card:not(.active) .character-avatar--blur img {
    filter: grayscale(100%) blur(3px);
}

.character-info { flex: 1; }
.character-name {
    font-weight: 600;
    margin-bottom: 4px;
}
.character-traits {
    font-size: 12px;
    color: var(--text-muted);
}

/* Category Styles */
.category-group {
    margin-bottom: 8px;
}

.category-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    cursor: pointer;
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: all 0.2s;
    border-radius: 8px;
}

.category-header:hover {
    background: var(--card-hover);
    color: var(--text-color);
}

.category-icon { font-size: 16px; }
.category-name { flex: 1; }
.category-count { font-weight: 400; opacity: 0.7; }
.category-arrow { font-size: 10px; transition: transform 0.2s; }
.category-header.expanded .category-arrow { transform: rotate(0deg); }
.category-header:not(.expanded) .category-arrow { transform: rotate(-90deg); }
.category-characters { overflow: hidden; transition: max-height 0.3s ease; }

/* Chat */
.chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-color);
    position: relative;
}

#chatMenuBtn {
    margin: 12px;
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    font-size: 18px;
    cursor: pointer;
    padding: 6px 12px;
    border-radius: 20px;
    transition: all 0.2s;
}

#chatMenuBtn:hover {
    background: var(--card-hover);
    border-color: var(--border-color);
}

#chatMenu {
    display: none;
    position: absolute;
    top: 50px;
    right: 12px;
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 4px;
    min-width: 200px;
    box-shadow: 0 8px 24px var(--shadow-color);
    z-index: 100;
}

#chatMenu button {
    width: 100%;
    text-align: left;
    padding: 10px 16px;
    background: transparent;
    border: none;
    color: var(--text-color);
    cursor: pointer;
    border-radius: 8px;
    font-size: 14px;
    transition: background 0.2s;
}

#chatMenu button:hover { background: var(--card-hover); }

.messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-height: 0;
}

.message {
    display: flex;
    gap: 12px;
    animation: fadeInUp 0.3s ease;
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.message.user { flex-direction: row-reverse; }

.message-avatar {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
    overflow: hidden;
}

.message-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.message-content { max-width: 70%; }

.message-bubble {
    padding: 12px 16px;
    border-radius: 16px;
    background: var(--bubble-ai-bg);
    color: var(--bubble-ai-text);
}

.message.user .message-bubble { background: var(--bubble-user-color1); color: white; position: relative; }

/* Light mode: user bubble with neutral gray */
.light-mode .message.user .message-bubble {
    background: var(--bubble-user-color1);
    color: #1E293B;
}

.message-text {
    line-height: 1.5;
    word-wrap: break-word;
}

/* Edit message button */
.edit-message-btn {
    position: absolute;
    top: 50%;
    left: -32px;
    transform: translateY(-50%);
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 50%;
    width: 26px;
    height: 26px;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s, background 0.2s;
    font-size: 12px;
}

.message.user .message-bubble:hover .edit-message-btn {
    opacity: 1;
}

.edit-message-btn:hover {
    background: rgba(255,255,255,0.25);
    border-color: rgba(255,255,255,0.3);
}

/* Light mode: edit button */
.light-mode .edit-message-btn {
    background: transparent;
    border: none;
    color: rgba(0,0,0,0.4);
}

.light-mode .edit-message-btn:hover {
    background: rgba(0,0,0,0.1);
    color: rgba(0,0,0,0.7);
}

/* Edit mode */
.edit-textarea {
    width: 100%;
    min-height: 60px;
    background: rgba(0,0,0,0.3);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 8px;
    color: var(--light);
    font-family: inherit;
    font-size: 14px;
    padding: 10px;
    resize: vertical;
    margin-bottom: 8px;
}

.edit-textarea:focus {
    outline: none;
    border-color: var(--primary);
}

.edit-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.edit-save-btn, .edit-cancel-btn {
    padding: 6px 12px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
}

.edit-save-btn {
    background: var(--gradient);
    color: white;
}

.edit-cancel-btn {
    background: rgba(255,255,255,0.1);
    color: var(--light);
}

.edit-save-btn:hover { filter: brightness(1.1); }
.edit-cancel-btn:hover { background: rgba(255,255,255,0.2); }

/* Light mode edit */
.light-mode .edit-textarea {
    background: #ffffff;
    border-color: rgba(0,0,0,0.2);
    color: #1e293b;
}

.light-mode .edit-textarea:focus {
    border-color: var(--primary);
}

.light-mode .edit-cancel-btn {
    background: #E2E8F0;
    color: #1E293B;
    border: 1px solid #CBD5E1;
}

.light-mode .edit-cancel-btn:hover {
    background: #94A3B8;
    color: #ffffff;
}

.message-time {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
}

.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
}

.typing-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-muted);
    animation: typing 1.4s ease-in-out infinite;
}

.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
    30% { transform: translateY(-10px); opacity: 1; }
}

.input-container {
    flex-shrink: 0;
    overflow: visible;
    background: transparent !important;
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
    padding: 0;
}

.input-wrapper {
    display: flex;
    flex-direction: column;
    background: var(--input-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 4px;
    overflow: visible;
    margin: 0 20px 4px;
}

.message-input {
    width: 100%;
    background: none;
    border: none;
    color: var(--text-color);
    padding: 12px 16px;
    font-size: 15px;
    font-family: inherit;
    line-height: 1.4;
    outline: none;
    resize: none;
    min-height: 44px;
    max-height: 150px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.3) transparent;
}

.message-input::-webkit-scrollbar {
    width: 6px;
}

.message-input::-webkit-scrollbar-track {
    background: transparent;
}

.message-input::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.3);
    border-radius: 3px;
}

.message-input::-webkit-scrollbar-thumb:hover {
    background: rgba(255,255,255,0.45);
}

/* Light mode scrollbar */
.light-mode .message-input {
    scrollbar-color: rgba(0,0,0,0.25) transparent;
}

.light-mode .message-input::-webkit-scrollbar-thumb {
    background: rgba(0,0,0,0.25);
}

.light-mode .message-input::-webkit-scrollbar-thumb:hover {
    background: rgba(0,0,0,0.35);
}

.message-input::placeholder { color: var(--text-muted); }

.send-button {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: var(--gradient);
    border: none;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s, opacity 0.2s;
    flex-shrink: 0;
    font-size: 14px;
    position: relative;
}

.send-button:hover:not(:disabled) { transform: scale(1.05); }
.send-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Send button loader */
.send-button .send-icon { transition: opacity 0.2s; }
.send-button .send-loader {
    display: none;
    position: absolute;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
.send-button.loading .send-icon { opacity: 0; }
.send-button.loading .send-loader { display: block; }

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.8);
    backdrop-filter: blur(10px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.active { display: flex; }

.modal-content {
    background: var(--surface-color);
    border-radius: 20px;
    padding: 32px;
    max-width: 480px;
    width: 90%;
    border: 1px solid var(--border-color);
    color: var(--text-color);
}

.modal-title {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 8px;
    background: var(--gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.close-modal {
    width: 100%;
    padding: 12px;
    background: var(--card-bg);
    border: none;
    color: var(--text-color);
    border-radius: 12px;
    cursor: pointer;
    font-weight: 600;
}

.close-modal:hover { background: var(--card-hover); }

/* Theme Toggle Button */
.theme-toggle-btn {
    background: transparent;
    border: none;
    padding: 6px;
    margin: 12px 8px 12px 12px;
    cursor: pointer;
    font-size: 18px;
    transition: transform 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.theme-toggle-btn:hover {
    transform: scale(1.15);
}

/* Show/hide icons based on theme */
body:not(.light-mode) .theme-icon-light { display: inline; }
body:not(.light-mode) .theme-icon-dark { display: none; }
body.light-mode .theme-icon-light { display: none; }
body.light-mode .theme-icon-dark { display: inline; }

/* Welcome */
.welcome-screen {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    text-align: center;
}

.welcome-icon { font-size: 64px; margin-bottom: 24px; }

.welcome-title {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 12px;
    background: var(--gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.welcome-text {
    color: var(--gray);
    font-size: 16px;
    max-width: 400px;
    line-height: 1.6;
}

/* Fix chat layout overflow bug */
#chatInterface {
    display: flex;
    flex: 1;
    flex-direction: column;
    position: relative;
    min-height: 0;
    overflow: hidden;
}

/* Profile Navigation */
.profile-nav {
    padding: 12px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.profile-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: rgba(255,255,255,0.03);
    border-radius: 12px;
    text-decoration: none;
    color: var(--light);
    transition: all 0.2s;
    border: 1px solid var(--border-color);
}

.profile-link:hover {
    background: rgba(255,107,157,0.1);
    border-color: var(--primary);
    transform: translateX(4px);
}

.profile-icon {
    width: 40px;
    height: 40px;
    background: var(--gradient);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}

.profile-text {
    flex: 1;
}

.profile-label {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 2px;
}

.profile-desc {
    font-size: 12px;
    color: var(--gray);
}

.profile-arrow {
    color: var(--gray);
    font-size: 18px;
    transition: transform 0.2s;
}

.profile-link:hover .profile-arrow {
    transform: translateX(4px);
    color: var(--primary);
}

/* Menu separator - styles in assets/css/menu.css */

/* Clickable logo */
.logo-link {
    text-decoration: none;
    display: block;
    cursor: pointer;
    transition: transform 0.2s;
}

/* Sticky section header */
.sticky-header {
    position: sticky;
    top: 0;
    background: var(--dark);
    padding: 16px 0 8px 0;
    z-index: 10;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    margin-bottom: 8px;
}
/* Logo clickable */
.logo-link {
    text-decoration: none;
    display: block;
}

/* Sticky section title */
.sticky-title {
    position: sticky;
    top: 0;
    background: var(--dark);
    z-index: 10;
    padding: 12px 0;
    margin: -12px 0 16px 0;
}

/* Sticky header for AI Characters */
.sticky-header {
    position: sticky;
    top: 0;
    background: var(--dark);
    z-index: 10;
    padding: 12px 0;
    margin: -12px 0 16px 0;
}
/* Sticky section title - stays visible when scrolling */
.section-title.section-title-sticky {
    position: sticky;
    top: 0;
    background: var(--dark);
    z-index: 10;
    padding: 16px 0 12px 0;
    margin: 0 0 12px 0;
}

/* ===== Custom Scrollbars (All Browsers) ===== */

/* Firefox - uses scrollbar-width and scrollbar-color */
.characters-section,
.messages-container {
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.3) rgba(255,255,255,0.08);
}

/* Light mode Firefox */
.light-mode .characters-section,
.light-mode .messages-container,
[data-theme="light"] .characters-section,
[data-theme="light"] .messages-container {
    scrollbar-color: rgba(0,0,0,0.25) rgba(0,0,0,0.05);
}

/* Chrome/Edge/Safari - uses ::-webkit-scrollbar */
.characters-section::-webkit-scrollbar,
.messages-container::-webkit-scrollbar {
    width: 6px;
}

.characters-section::-webkit-scrollbar-track,
.messages-container::-webkit-scrollbar-track {
    background: rgba(255,255,255,0.08);
    border-radius: 3px;
}

.characters-section::-webkit-scrollbar-thumb,
.messages-container::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.3);
    border-radius: 3px;
}

.characters-section::-webkit-scrollbar-thumb:hover,
.messages-container::-webkit-scrollbar-thumb:hover {
    background: rgba(255,255,255,0.45);
}

/* Light mode Chrome/Edge/Safari */
.light-mode .characters-section::-webkit-scrollbar-track,
.light-mode .messages-container::-webkit-scrollbar-track,
[data-theme="light"] .characters-section::-webkit-scrollbar-track,
[data-theme="light"] .messages-container::-webkit-scrollbar-track {
    background: rgba(0,0,0,0.05);
}

.light-mode .characters-section::-webkit-scrollbar-thumb,
.light-mode .messages-container::-webkit-scrollbar-thumb,
[data-theme="light"] .characters-section::-webkit-scrollbar-thumb,
[data-theme="light"] .messages-container::-webkit-scrollbar-thumb {
    background: rgba(0,0,0,0.25);
}

.light-mode .characters-section::-webkit-scrollbar-thumb:hover,
.light-mode .messages-container::-webkit-scrollbar-thumb:hover,
[data-theme="light"] .characters-section::-webkit-scrollbar-thumb:hover,
[data-theme="light"] .messages-container::-webkit-scrollbar-thumb:hover {
    background: rgba(0,0,0,0.4);
}


/* ==========================================
   ASSET IMAGES IN CHAT
   ========================================== */
.madbot-asset-wrapper {
    display: inline-block;
    margin: 8px 0;
}

.madbot-asset-image {
    display: block;
    max-width: 200px;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    transition: transform 0.2s ease;
}

.madbot-asset-image:hover {
    transform: scale(1.02);
}

.madbot-asset-link {
    display: inline-block;
}

/* Light mode adjustments */
.light-mode .madbot-asset-image,
[data-theme="light"] .madbot-asset-image {
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}


/* ==========================================
   ASSET IMAGES IN CHAT - CENTERED
   ========================================== */
.madbot-asset-wrapper {
    display: block !important;
    text-align: center !important;
    margin: 16px 0 !important;
}

.madbot-asset-image {
    display: inline-block !important;
    max-width: 220px !important;
    height: auto;
    border-radius: 10px !important;
    box-shadow: 0 4px 20px rgba(0,0,0,0.4) !important;
    transition: transform 0.3s ease, box-shadow 0.3s ease !important;
}

.madbot-asset-image:hover {
    transform: scale(1.05) !important;
    box-shadow: 0 8px 30px rgba(99, 102, 241, 0.4) !important;
}



/* ==========================================
   ASSET LIGHTBOX MODAL
   ========================================== */
.asset-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.asset-lightbox-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.asset-lightbox-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    animation: lightboxFadeIn 0.2s ease;
}

@keyframes lightboxFadeIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.asset-lightbox-content img {
    max-width: 90vw;
    max-height: 80vh;
    object-fit: contain;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.asset-lightbox-close {
    position: absolute;
    top: -40px;
    right: -10px;
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.asset-lightbox-caption {
    margin-top: 16px;
    color: rgba(255, 255, 255, 0.8);
    font-size: 14px;
    text-align: center;
    max-width: 80%;
}

/* Mobile adjustments */
@media (max-width: 768px) {
    .asset-lightbox-content img {
        max-width: 95vw;
        max-height: 75vh;
    }
    
    .asset-lightbox-close {
        top: -50px;
        right: 0;
    }
}
