.message-row {
    display: flex;
    gap: 1rem;
    width: 100%;
    max-width: 90%;
    margin-bottom: 1.5rem;
    animation: bubble-fade-in 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.user-row {
    align-self: flex-end;
    margin-left: auto;
    flex-direction: row-reverse;
}

.ai-row {
    align-self: flex-start;
    margin-right: auto;
}

.message-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.user-row .message-avatar {
    background: var(--bg-surface);
    color: var(--text-main);
    border: 1px solid var(--border);
    box-shadow: 0 0 10px var(--border);
}

.ai-row .message-avatar {
    background: linear-gradient(135deg, #005f38 0%, #004024 100%);
    color: #e6fffa;
    border: 1px solid var(--accent);
    box-shadow: 0 0 10px var(--accent-glow);
}

.message-bubble {
    padding: 1.25rem 1.5rem;
    border-radius: 16px;
    position: relative;
    line-height: 1.6;
    font-size: 0.975rem;
    display: flex;
    flex-direction: column;
    width: 100%;
}

.user-bubble {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    color: var(--text-main);
    border-top-right-radius: 4px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.02);
}

.ai-bubble {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    color: var(--text-main);
    border-top-left-radius: 4px;
    box-shadow: 0 4px 25px rgba(0, 0, 0, 0.03);
}

.paywalled-bubble {
    border-color: var(--accent-glow);
}

.message-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
    font-size: 0.75rem;
    opacity: 0.6;
}

.sender-name {
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.message-time {
    font-family: monospace;
}

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

/* Paragraph spacing */
.message-content p {
    margin: 0 0 1rem 0;
}
.message-content p:last-child {
    margin-bottom: 0;
}

/* Paywall Blur Styles */
.paywall-teaser {
    position: relative;
    margin-bottom: 1.5rem;
    -webkit-mask-image: linear-gradient(to bottom, #000 30%, transparent 100%);
    mask-image: linear-gradient(to bottom, #000 30%, transparent 100%);
    filter: blur(2px);
    pointer-events: none;
    -webkit-user-select: none;
    user-select: none;
}

/* Upsell Card */
.upsell-card {
    background: var(--bg-base);
    border-radius: 12px;
    border: 1px solid var(--accent-glow);
    padding: 1.5rem;
    margin-top: 1rem;
    box-shadow: 0 8px 32px var(--accent-glow), 0 4px 12px var(--border);
    animation: card-slide-in 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.upsell-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.upsell-icon {
    font-size: 1.25rem;
}

.upsell-header h4 {
    margin: 0;
    color: var(--accent);
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.upsell-text {
    color: var(--text-main);
    font-size: 0.9rem;
    line-height: 1.55;
    margin: 0 0 1.25rem 0;
}

.upsell-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

.btn-upsell {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    text-decoration: none;
    letter-spacing: 0.5px;
    min-height: 44px;
}

.btn-primary {
    background: var(--accent);
    border: none;
    color: var(--bg-surface);
}

.btn-primary:hover:not(:disabled) {
    background: var(--accent);
    opacity: 0.9;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px var(--accent-glow);
}

.btn-primary:active:not(:disabled) {
    transform: translateY(0);
}

.btn-primary:disabled {
    background: var(--accent-glow);
    color: var(--text-muted);
    cursor: not-allowed;
}

.btn-secondary {
    background: transparent;
    border: 1px solid var(--accent);
    color: var(--accent);
}

.btn-secondary:hover {
    background: var(--accent-glow);
    transform: translateY(-2px);
}

.btn-secondary:active {
    transform: translateY(0);
}

/* Success Banner */
.success-unlock-banner {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: var(--accent-glow);
    border: 1px solid var(--accent);
    color: var(--accent);
    padding: 1rem;
    border-radius: 8px;
    margin-top: 1.25rem;
    font-size: 0.9rem;
    font-weight: 600;
    animation: fade-in 0.5s ease-out;
}

.success-icon {
    font-weight: bold;
    font-size: 1.1rem;
}

/* Payment Spinner */
.payment-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    margin-right: 0.75rem;
    animation: spin 0.8s linear infinite;
}

/* Keyframes */
@keyframes bubble-fade-in {
    0% { opacity: 0; transform: translateY(12px) scale(0.98); }
    100% { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes card-slide-in {
    0% { opacity: 0; transform: translateY(10px); }
    100% { opacity: 1; transform: translateY(0); }
}

@keyframes fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ============================================================
   LIGHT THEME OVERRIDES — "Warm Paper / Soft Sepia"
   ============================================================ */

.theme-light .ai-row .message-avatar {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: #ffffff;
    border: 1px solid rgba(16, 185, 129, 0.2);
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.15);
}

.theme-light .user-row .message-avatar {
    box-shadow: 0 2px 8px rgba(139, 130, 115, 0.1);
}

.theme-light .upsell-card {
    box-shadow: 0 8px 32px rgba(16, 185, 129, 0.08), 0 4px 12px rgba(0, 0, 0, 0.04);
}

.theme-light .btn-primary {
    background: var(--accent);
    color: #ffffff;
}

.theme-light .btn-primary:hover:not(:disabled) {
    background: #059669;
    color: #ffffff;
    opacity: 1;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.15);
}

.theme-light .btn-secondary {
    border-color: var(--accent);
    color: var(--accent);
}

.theme-light .btn-secondary:hover {
    background: rgba(16, 185, 129, 0.05);
}

.theme-light .paywall-teaser {
    -webkit-mask-image: linear-gradient(to bottom, #000 30%, transparent 100%);
    mask-image: linear-gradient(to bottom, #000 30%, transparent 100%);
}

